From 896c4a3cffafa33bd360955e88539129276a00ca Mon Sep 17 00:00:00 2001 From: Christophe Gueret Date: Sat, 10 Nov 2012 13:30:23 +0000 Subject: Fixed a few bugs --- diff --git a/activity_review/src/Model.py b/activity_review/src/Model.py index 096dc39..2176d44 100644 --- a/activity_review/src/Model.py +++ b/activity_review/src/Model.py @@ -75,7 +75,6 @@ class ReviewModel(object): # If the graph is not found, create it if graph == None: graph = gstore.create_graph(name="Comments") - graph.add_share(util.public_uri()) # Record the comment comment_resource = graph.create_resource(uid=None, category='Comment') diff --git a/activity_review/src/View.py b/activity_review/src/View.py index fc477b1..f9fc923 100644 --- a/activity_review/src/View.py +++ b/activity_review/src/View.py @@ -3,7 +3,7 @@ Created on 22 Oct 2012 @author: cgueret ''' -from gi.repository import Gtk, GObject +from gi.repository import Gtk, Gdk, GObject from semanticxo import graphstore from Model import ReviewModel @@ -92,9 +92,6 @@ class TalkPanel(object): # Load the comments self.update_comments(model) - # The timeout to reload the talks - self._timeout_id = GObject.timeout_add(120000, self.update_comments, model) - # Connect the mood bar buttons to the call back for mood_id in [1, 2, 3, 4]: radio = builder.get_object("radiobutton%d" % mood_id) @@ -102,7 +99,9 @@ class TalkPanel(object): # Connect the question send button to the call back button = builder.get_object("new_question_button") - button.connect("clicked", self.on_comment_button_clicked, builder.get_object("new_question")) + text_entry = builder.get_object("new_question") + button.connect("clicked", self.on_comment_button_clicked, text_entry) + text_entry.connect("key-press-event", self.on_entry_key_pressed) def get_widget(self): return self._widget @@ -125,11 +124,20 @@ class TalkPanel(object): model.add_new_comment_for_talk(talk=self._identifier, comment=entry.get_text()) entry.set_text("") self.update_comments(model) - + + def on_entry_key_pressed(self, entry, event): + ''' + If the key pressed is enter, post the comment + ''' + if event.keyval == Gdk.KEY_Return: + model = ReviewModel() + model.add_new_comment_for_talk(talk=self._identifier, comment=entry.get_text()) + entry.set_text("") + self.update_comments(model) + def update_comments(self, model): for (comment_id, message, date, author) in model.get_comments_for_talk(talk=self._identifier): if comment_id not in self._comments: self._comments_store.append([message, author.split('/')[-1], date]) self._comments.add(comment_id) - return True \ No newline at end of file diff --git a/activity_review/src/review_ui.glade b/activity_review/src/review_ui.glade index a40516e..5851392 100644 --- a/activity_review/src/review_ui.glade +++ b/activity_review/src/review_ui.glade @@ -110,26 +110,6 @@ button3 - - True - False - face-plain - - - True - False - face-smile - - - True - False - face-smirk - - - True - False - face-surprise - True False @@ -260,10 +240,10 @@ False + :-) True True False - face-smile 0 True @@ -276,10 +256,10 @@ + :-o True True False - face-surprise 0 True True @@ -294,10 +274,10 @@ + :-/ True True False - face-smirk 0 True radiobutton1 @@ -311,10 +291,10 @@ + :-| True True False - face-plain 0 True radiobutton1 -- cgit v0.9.1