Ejemplo n.º 1
0
    def __init__(self, parent = None):
        self._gui = load_ui_file("stats.ui")
        self.report_chooser = None
        self.window = self.get_widget("stats_window")

        self.parent = parent# determine if app should shut down on close

        self.stat_facts = None

        day_start = conf.get("day_start_minutes")
        day_start = dt.time(day_start / 60, day_start % 60)
        self.timechart = widgets.TimeChart()
        self.timechart.interactive = False
        self.timechart.day_start = day_start

        self.get_widget("explore_everything").add(self.timechart)
        self.get_widget("explore_everything").show_all()

        runtime.storage.connect('activities-changed',self.after_fact_update)
        runtime.storage.connect('facts-changed',self.after_fact_update)

        self.init_stats()

        self.window.set_position(gtk.WIN_POS_CENTER)

        self._gui.connect_signals(self)
        self.window.show_all()
        self.stats()
Ejemplo n.º 2
0
    def __init__(self, parent = None):
        self.parent = parent# determine if app should shut down on close
        self._gui = load_ui_file("overview.ui")
        self.report_chooser = None
        self.window = self.get_widget("tabs_window")
        self.window.connect("delete_event", self.on_delete_window)

        self.range_pick = widgets.RangePick()
        self.get_widget("range_pick_box").add(self.range_pick)
        self.range_pick.connect("range-selected", self.on_range_selected)

        self.overview = OverviewBox()
        self.get_widget("overview_tab").add(self.overview)
        self.fact_tree = self.overview.fact_tree # TODO - this is upside down, should maybe get the overview tab over here
        self.fact_tree.connect("cursor-changed", self.on_fact_selection_changed)

        self.fact_tree.connect("button-press-event", self.on_fact_tree_button_press)

        self.reports = TotalsBox()
        self.get_widget("reports_tab").add(self.reports)

        self.timechart = widgets.TimeChart()
        self.timechart.connect("zoom-out-clicked", self.on_timechart_zoom_out_clicked)
        self.timechart.connect("range-picked", self.on_timechart_new_range)
        self.get_widget("by_day_box").add(self.timechart)

        self._gui.connect_signals(self)
        runtime.storage.connect('activities-changed',self.after_activity_update)
        runtime.storage.connect('facts-changed',self.after_activity_update)

        conf.connect('conf-changed', self.on_conf_change)
        self.show()
Ejemplo n.º 3
0
    def __init__(self, parent=None):
        self._gui = load_ui_file("stats.ui")
        self.report_chooser = None
        self.window = self.get_widget("stats_window")

        self.parent = parent  # determine if app should shut down on close

        self.timechart = widgets.TimeChart()
        self.timechart.interactive = False

        self.get_widget("explore_everything").add(self.timechart)
        self.get_widget("explore_everything").show_all()

        runtime.storage.connect('activities-changed', self.after_fact_update)
        runtime.storage.connect('facts-changed', self.after_fact_update)
        self.window.set_position(gtk.WIN_POS_CENTER)

        self.chart_category_totals = charting.Chart(value_format="%.1f",
                                                    max_bar_width=20,
                                                    legend_width=70,
                                                    interactive=False)
        self.get_widget("explore_category_totals").add(
            self.chart_category_totals)

        self.chart_weekday_totals = charting.Chart(value_format="%.1f",
                                                   max_bar_width=20,
                                                   legend_width=70,
                                                   interactive=False)
        self.get_widget("explore_weekday_totals").add(
            self.chart_weekday_totals)

        self.chart_weekday_starts_ends = charting.HorizontalDayChart(
            max_bar_width=20, legend_width=70)
        self.get_widget("explore_weekday_starts_ends").add(
            self.chart_weekday_starts_ends)

        self.chart_category_starts_ends = charting.HorizontalDayChart(
            max_bar_width=20, legend_width=70)
        self.get_widget("explore_category_starts_ends").add(
            self.chart_category_starts_ends)

        #ah, just want summary look just like all the other text on the page
        class CairoText(graphics.Scene):
            def __init__(self):
                graphics.Scene.__init__(self)
                self.text = ""
                self.label = graphics.Label(self.text, 10)
                self.label.wrap = pango.WRAP_WORD
                self.add_child(self.label)
                self.connect("on-enter-frame", self.on_enter_frame)

            def set_text(self, text):
                self.label.text = text
                self.redraw()

            def on_enter_frame(self, scene, context):
                # now for the text - we want reduced contrast for relaxed visuals
                fg_color = self.get_style().fg[gtk.STATE_NORMAL].to_string()
                self.label.color = self.colors.contrast(fg_color, 80)

                self.label.width = self.width

        self.explore_summary = CairoText()
        self.get_widget("explore_summary").add(self.explore_summary)
        self.get_widget("explore_summary").show_all()

        self._gui.connect_signals(self)
        self.show()
Ejemplo n.º 4
0
    def __init__(self, parent=None):
        self.parent = parent  # determine if app should shut down on close
        self._gui = load_ui_file("overview.ui")
        self.report_chooser = None

        self.facts = None

        self.window = self.get_widget("tabs_window")

        self.day_start = conf.get("day_start_minutes")
        self.day_start = dt.time(self.day_start / 60, self.day_start % 60)

        self.view_date = (dt.datetime.today() - dt.timedelta(
            hours=self.day_start.hour, minutes=self.day_start.minute)).date()

        self.range_pick = widgets.RangePick()
        self.get_widget("range_pick_box").add(self.range_pick)
        self.range_pick.connect("range-selected", self.on_range_selected)

        #set to monday
        self.start_date = self.view_date - dt.timedelta(
            self.view_date.weekday() + 1)

        # look if we need to start on sunday or monday
        self.start_date = self.start_date + dt.timedelta(
            stuff.locale_first_weekday())

        # see if we have not gotten carried away too much in all these calculations
        if (self.view_date - self.start_date) == dt.timedelta(7):
            self.start_date += dt.timedelta(7)

        self.end_date = self.start_date + dt.timedelta(6)

        self.overview = OverviewBox()
        self.get_widget("overview_tab").add(self.overview)
        self.fact_tree = self.overview.fact_tree  # TODO - this is upside down, should maybe get the overview tab over here
        self.fact_tree.connect("cursor-changed",
                               self.on_fact_selection_changed)

        self.fact_tree.connect("button-press-event",
                               self.on_fact_tree_button_press)

        self.reports = TotalsBox()
        self.get_widget("reports_tab").add(self.reports)

        self.current_range = "week"

        self.timechart = widgets.TimeChart()
        self.timechart.connect("zoom-out-clicked",
                               self.on_timechart_zoom_out_clicked)
        self.timechart.connect("range-picked", self.on_timechart_new_range)
        self.timechart.day_start = self.day_start

        self.get_widget("by_day_box").add(self.timechart)

        self._gui.connect_signals(self)
        runtime.storage.connect('activities-changed',
                                self.after_activity_update)
        runtime.storage.connect('facts-changed', self.after_activity_update)

        conf.connect('conf-changed', self.on_conf_change)

        if conf.get("overview_window_maximized"):
            self.window.maximize()
        else:
            window_box = conf.get("overview_window_box")
            if window_box:
                x, y, w, h = (int(i) for i in window_box)
                self.window.move(x, y)
                self.window.resize(w, h)
            else:
                self.window.set_position(gtk.WIN_POS_CENTER)

        self.window.show_all()

        self.search()