Commit 41bf4cb7 authored by Daniel Garcia Moreno's avatar Daniel Garcia Moreno

Report widget, not functional yet

parent 5eb163cc
Pipeline #52711 passed with stage
in 54 seconds
......@@ -2,6 +2,177 @@
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkStack" id="main-stack">
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="main-box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="timer">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">00:00:00</property>
<style>
<class name="timer"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="width_request">310</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">center</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="width_request">300</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="border_width">0</property>
<child>
<object class="GtkListBox" id="activity-list">
<property name="width_request">300</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="name">main</property>
<property name="title" translatable="yes">page0</property>
</packing>
</child>
<child>
<object class="GtkStack" id="report-stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">day</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="name">day</property>
<property name="title" translatable="yes">Day</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Week</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="name">week</property>
<property name="title" translatable="yes">Week</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Month</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="name">month</property>
<property name="title" translatable="yes">Month</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="name">report</property>
<property name="title" translatable="yes">page1</property>
<property name="position">1</property>
</packing>
</child>
</object>
<object class="GtkHeaderBar" id="reportbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkButton" id="back-button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">app.list</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">go-previous-symbolic</property>
</object>
</child>
</object>
</child>
<child type="title">
<object class="GtkStackSwitcher" id="report-stack-switcher">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stack">report-stack</property>
</object>
</child>
</object>
<object class="GtkPopover" id="menubutton_popover">
<property name="can_focus">False</property>
<child>
......@@ -13,6 +184,31 @@
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkModelButton" id="menubutton_popover_report_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">app.report</property>
<property name="text" translatable="yes">Report</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkModelButton" id="menubutton_popover_settings_button">
<property name="visible">True</property>
......@@ -24,7 +220,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="position">2</property>
</packing>
</child>
<child>
......@@ -38,7 +234,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">3</property>
</packing>
</child>
<child>
......@@ -52,7 +248,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">4</property>
</packing>
</child>
</object>
......
......@@ -88,3 +88,4 @@ class Application(Gtk.Application):
if __name__ == "__main__":
app = Application()
app.run(sys.argv)
......@@ -15,6 +15,10 @@ class MainWindow(Gtk.ApplicationWindow):
application = NotImplemented
current_activity = NotImplemented
activity_list = NotImplemented
main_stack = NotImplemented
report_stack = NotImplemented
report_stack_switcher = NotImplemented
reportbar = NotImplemented
timer = NotImplemented
quit_dialog = NotImplemented
headerbar = NotImplemented
......@@ -32,12 +36,17 @@ class MainWindow(Gtk.ApplicationWindow):
self.logging_manager = kwargs['application'].get_logger()
self.assemble_window()
self.set_size_request(-1, 500)
# TODO: implement delete
def assemble_window(self):
self.create_headerbar()
self.create_container()
self.custom_css()
# TODO: Report by activity / date
def create_headerbar(self):
builder = Gtk.Builder()
builder.add_from_resource("/org/gnome/timetrack/main_window.ui")
......@@ -57,27 +66,24 @@ class MainWindow(Gtk.ApplicationWindow):
context = self.get_style_context()
#context.add_class("devel")
# TODO: Add comments
def create_container(self):
container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
container.set_size_request(-1, 400)
builder = Gtk.Builder()
builder.add_from_resource("/org/gnome/timetrack/main_window.ui")
self.activity_list = Gtk.ListBox()
self.activity_list.set_selection_mode(Gtk.SelectionMode.NONE)
self.timer = Gtk.Label(label="00:00:00")
context = self.timer.get_style_context()
context.add_class("timer")
self.main_stack = builder.get_object('main-stack')
self.report_stack = builder.get_object('report-stack')
frame = Gtk.Frame()
frame.add(self.activity_list)
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.add(frame)
self.reportbar = builder.get_object("reportbar")
container.pack_start(self.timer, False, False, 6)
container.pack_start(scrolled_window, True, True, 6)
self.timer = builder.get_object('timer')
self.activity_list = builder.get_object('activity-list')
container.show_all()
self.add(container)
self.add(self.main_stack)
self.show_all()
# TODO: Edit?
def set_headerbar(self):
self.set_titlebar(self.headerbar)
......@@ -105,6 +111,22 @@ class MainWindow(Gtk.ApplicationWindow):
stop_action.connect("activate", self.stop_activity)
self.application.add_action(stop_action)
action = Gio.SimpleAction.new("report", None)
action.connect("activate", self.show_report)
self.application.add_action(action)
action = Gio.SimpleAction.new("list", None)
action.connect("activate", self.show_list)
self.application.add_action(action)
def show_report(self, *args, **kwargs):
self.main_stack.set_visible_child_name("report")
self.set_titlebar(self.reportbar)
def show_list(self, *args, **kwargs):
self.main_stack.set_visible_child_name("main")
self.set_titlebar(self.headerbar)
def start_activity(self, *args, **kwargs):
self.activity_stack.set_visible_child_name("working")
self.button_stack.set_visible_child_name("working")
......@@ -120,6 +142,7 @@ class MainWindow(Gtk.ApplicationWindow):
def stop_activity(self, *args, **kwargs):
self.activity_stack.set_visible_child_name("waiting")
self.button_stack.set_visible_child_name("waiting")
self.timer.set_text("00:00:00")
name = self.activity_label.get_text()
start = self.start_date
......
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