Пример #1
0
    def show(self):
        self.position_window()
        self.window.show_all()

        self.facts = None

        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()

        # 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.current_range = "week"

        self.timechart.day_start = self.day_start

        self.search()
Пример #2
0
    def on_home_activate(self, action):
        self.view_date = (dt.datetime.today() - dt.timedelta(
            hours=self.day_start.hour, minutes=self.day_start.minute)).date()
        if self.current_range == "day":
            self.start_date = self.view_date
            self.end_date = self.start_date + dt.timedelta(0)

        elif self.current_range == "week":
            self.start_date = self.view_date - dt.timedelta(
                self.view_date.weekday() + 1)
            self.start_date = self.start_date + dt.timedelta(
                stuff.locale_first_weekday())
            self.end_date = self.start_date + dt.timedelta(6)
        elif self.current_range == "month":
            self.start_date = self.view_date - dt.timedelta(
                self.view_date.day - 1)  #set to beginning of month
            first_weekday, days_in_month = calendar.monthrange(
                self.view_date.year, self.view_date.month)
            self.end_date = self.start_date + dt.timedelta(days_in_month - 1)
        else:
            days = (self.end_date - self.start_date)
            self.start_date = self.view_date
            self.end_date = self.view_date + days

        self.search()
Пример #3
0
    def show(self):
        self.position_window()
        self.window.show_all()

        self.facts = None

        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()

        #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.current_range = "week"

        self.timechart.day_start = self.day_start


        self.search()
Пример #4
0
    def on_home_activate(self, action):
        self.view_date = (dt.datetime.today() - dt.timedelta(hours = self.day_start.hour,
                                                        minutes = self.day_start.minute)).date()
        if self.current_range == "day":
            self.start_date = self.view_date
            self.end_date = self.start_date + dt.timedelta(0)

        elif self.current_range == "week":
            self.start_date = self.view_date - dt.timedelta(self.view_date.weekday() + 1)
            self.start_date = self.start_date + dt.timedelta(stuff.locale_first_weekday())
            self.end_date = self.start_date + dt.timedelta(6)
        elif self.current_range == "month":
            self.start_date = self.view_date - dt.timedelta(self.view_date.day - 1) #set to beginning of month
            first_weekday, days_in_month = calendar.monthrange(self.view_date.year, self.view_date.month)
            self.end_date = self.start_date + dt.timedelta(days_in_month - 1)
        else:
            days =  (self.end_date - self.start_date)
            self.start_date = self.view_date
            self.end_date = self.view_date + days

        self.search()
Пример #5
0
    def show(self):
        self.position_window()
        self.window.show_all()

        self.facts = None

        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()

        #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.current_range = "week"

        self.timechart.day_start = self.day_start

        # [lb] likes to see today's activities by default, rather than having
        # to scroll all the way down. (At first I wanted to sort reverse
        # chronologically so that the latest activity was at the top of the
        # list, but showing just the day's activities seems good enough, and
        # it's super easy to do; I assume trying to figure out how to reverse
        # sort the Activities list would be a lot more work.)
        self.on_day_activate(None)

        self.search()
Пример #6
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()