Commit 2a8250eb authored by Daniel Garcia Moreno's avatar Daniel Garcia Moreno

Add comment to the widget after stop

parent 13678f87
Pipeline #55234 passed with stage
in 47 seconds
...@@ -35,6 +35,7 @@ class MainWindow(Gtk.ApplicationWindow): ...@@ -35,6 +35,7 @@ class MainWindow(Gtk.ApplicationWindow):
activity_stack = NotImplemented activity_stack = NotImplemented
activity_entry = NotImplemented activity_entry = NotImplemented
activity_label = NotImplemented activity_label = NotImplemented
comments = None
start_date = None start_date = None
activity_id = None activity_id = None
...@@ -333,6 +334,7 @@ class MainWindow(Gtk.ApplicationWindow): ...@@ -333,6 +334,7 @@ class MainWindow(Gtk.ApplicationWindow):
self.button_stack.set_visible_child_name("working") self.button_stack.set_visible_child_name("working")
self.start_date = datetime.now() self.start_date = datetime.now()
self.comments = ""
activity = self.activity_entry.get_text() activity = self.activity_entry.get_text()
self.activity_label.set_text(activity) self.activity_label.set_text(activity)
GLib.timeout_add(1000, self.update_timer, None) GLib.timeout_add(1000, self.update_timer, None)
...@@ -353,11 +355,13 @@ class MainWindow(Gtk.ApplicationWindow): ...@@ -353,11 +355,13 @@ class MainWindow(Gtk.ApplicationWindow):
name = self.activity_label.get_text() name = self.activity_label.get_text()
start = self.start_date start = self.start_date
stop = datetime.now() stop = datetime.now()
activity = Activity(id=self.activity_id, name=name, start=start, stop=stop) activity = Activity(id=self.activity_id, name=name,
start=start, stop=stop, comments=self.comments)
self.application.db.set_stop(self.activity_id, stop, activity.seconds) self.application.db.set_stop(self.activity_id, stop, activity.seconds)
self.insert_activity(activity) self.insert_activity(activity)
self.comments = ""
self.start_date = None self.start_date = None
self.activity_id = None self.activity_id = None
...@@ -568,7 +572,7 @@ class MainWindow(Gtk.ApplicationWindow): ...@@ -568,7 +572,7 @@ class MainWindow(Gtk.ApplicationWindow):
comments_buf = self.current_comments.get_buffer() comments_buf = self.current_comments.get_buffer()
comments_start = comments_buf.get_start_iter() comments_start = comments_buf.get_start_iter()
comments_end = comments_buf.get_end_iter() comments_end = comments_buf.get_end_iter()
comments = comments_buf.get_text(comments_start, comments_end, False) self.comments = comments_buf.get_text(comments_start, comments_end, False)
self.start_date = datetime(new_date.year, self.start_date = datetime(new_date.year,
new_date.month + 1, new_date.month + 1,
...@@ -580,5 +584,5 @@ class MainWindow(Gtk.ApplicationWindow): ...@@ -580,5 +584,5 @@ class MainWindow(Gtk.ApplicationWindow):
name=name, name=name,
start=self.start_date, start=self.start_date,
stop=None, stop=None,
comments=comments) comments=self.comments)
self.application.db.update(activity) self.application.db.update(activity)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment