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):
activity_stack = NotImplemented
activity_entry = NotImplemented
activity_label = NotImplemented
comments = None
start_date = None
activity_id = None
......@@ -333,6 +334,7 @@ class MainWindow(Gtk.ApplicationWindow):
self.button_stack.set_visible_child_name("working")
self.start_date = datetime.now()
self.comments = ""
activity = self.activity_entry.get_text()
self.activity_label.set_text(activity)
GLib.timeout_add(1000, self.update_timer, None)
......@@ -353,11 +355,13 @@ class MainWindow(Gtk.ApplicationWindow):
name = self.activity_label.get_text()
start = self.start_date
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.insert_activity(activity)
self.comments = ""
self.start_date = None
self.activity_id = None
......@@ -568,7 +572,7 @@ class MainWindow(Gtk.ApplicationWindow):
comments_buf = self.current_comments.get_buffer()
comments_start = comments_buf.get_start_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,
new_date.month + 1,
......@@ -580,5 +584,5 @@ class MainWindow(Gtk.ApplicationWindow):
name=name,
start=self.start_date,
stop=None,
comments=comments)
comments=self.comments)
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