def show(self): dummy, x, y = self.get_window().get_origin() alloc = self.get_allocation() self.popup.move(x + alloc.x, y + alloc.y + alloc.height) self.get_widget("day_preview").set_text( stuff.format_range(self.today, self.today)) self.get_widget("week_preview").set_text( stuff.format_range(*stuff.week(self.today))) self.get_widget("month_preview").set_text( stuff.format_range(*stuff.month(self.today))) start_cal = self.get_widget("start_calendar") start_cal.select_month(self.start_date.month - 1, self.start_date.year) start_cal.select_day(self.start_date.day) end_cal = self.get_widget("end_calendar") end_cal.select_month(self.end_date.month - 1, self.end_date.year) end_cal.select_day(self.end_date.day) self.popup.show_all() self.get_widget("day").grab_focus() self.set_active(True)
def on_show(self, user_data): self.get_widget("day_preview").set_text( stuff.format_range(self.today, self.today)) self.get_widget("week_preview").set_text( stuff.format_range(*stuff.week(self.today))) self.get_widget("month_preview").set_text( stuff.format_range(*stuff.month(self.today))) start_cal = self.get_widget("start_calendar") start_cal.select_month(self.start_date.month - 1, self.start_date.year) start_cal.select_day(self.start_date.day) end_cal = self.get_widget("end_calendar") end_cal.select_month(self.end_date.month - 1, self.end_date.year) end_cal.select_day(self.end_date.day) self.get_widget("day").grab_focus()
def show(self): dummy, x, y = self.get_window().get_origin() alloc = self.get_allocation() self.popup.move(x + alloc.x,y + alloc.y + alloc.height) self.get_widget("day_preview").set_text(stuff.format_range(self.today, self.today)) self.get_widget("week_preview").set_text(stuff.format_range(*stuff.week(self.today))) self.get_widget("month_preview").set_text(stuff.format_range(*stuff.month(self.today))) start_cal = self.get_widget("start_calendar") start_cal.select_month(self.start_date.month - 1, self.start_date.year) start_cal.select_day(self.start_date.day) end_cal = self.get_widget("end_calendar") end_cal.select_month(self.end_date.month - 1, self.end_date.year) end_cal.select_day(self.end_date.day) self.popup.show_all() self.get_widget("day").grab_focus() self.set_active(True)
def __init__(self, parent=None): Controller.__init__(self, parent) self.window.set_position(gtk.WindowPosition.CENTER) self.window.set_default_icon_name("hamster-time-tracker") self.window.set_default_size(700, 500) self.storage = hamster.client.Storage() self.storage.connect("facts-changed", self.on_facts_changed) self.storage.connect("activities-changed", self.on_facts_changed) self.header_bar = HeaderBar() self.window.set_titlebar(self.header_bar) main = gtk.Box(orientation=1) self.window.add(main) self.report_chooser = None self.search_box = gtk.Revealer() space = gtk.Box(border_width=5) self.search_box.add(space) self.filter_entry = gtk.Entry() self.filter_entry.set_icon_from_icon_name( gtk.EntryIconPosition.PRIMARY, "edit-find-symbolic") self.filter_entry.connect("changed", self.on_search_changed) self.filter_entry.connect("icon-press", self.on_search_icon_press) space.pack_start(self.filter_entry, True, True, 0) main.pack_start(self.search_box, False, True, 0) window = gtk.ScrolledWindow() window.set_policy(gtk.PolicyType.NEVER, gtk.PolicyType.AUTOMATIC) self.fact_tree = FactTree() self.fact_tree.connect("on-activate-row", self.on_row_activated) self.fact_tree.connect("on-delete-called", self.on_row_delete_called) window.add(self.fact_tree) main.pack_start(window, True, True, 1) self.totals = Totals() main.pack_start(self.totals, False, True, 1) date_range = stuff.week( dt.datetime.today()) # TODO - do the hamster day self.header_bar.range_pick.set_range(*date_range) self.header_bar.range_pick.connect("range-selected", self.on_range_selected) self.header_bar.add_activity_button.connect( "clicked", self.on_add_activity_clicked) self.header_bar.search_button.connect("toggled", self.on_search_toggled) self.header_bar.menu_prefs.connect("activate", self.on_prefs_clicked) self.header_bar.menu_export.connect("activate", self.on_export_clicked) self.window.connect("key-press-event", self.on_key_press) self.facts = [] self.find_facts() self.window.show_all()
def __init__(self, parent = None): Controller.__init__(self, parent) self.window.set_position(gtk.WindowPosition.CENTER) self.window.set_default_icon_name("hamster-time-tracker") self.window.set_default_size(700, 500) self.storage = hamster.client.Storage() self.storage.connect("facts-changed", self.on_facts_changed) self.storage.connect("activities-changed", self.on_facts_changed) self.header_bar = HeaderBar() self.window.set_titlebar(self.header_bar) main = gtk.Box(orientation=1) self.window.add(main) self.report_chooser = None self.search_box = gtk.Revealer() space = gtk.Box(border_width=5) self.search_box.add(space) self.filter_entry = gtk.Entry() self.filter_entry.set_icon_from_icon_name(gtk.EntryIconPosition.PRIMARY, "edit-find-symbolic") self.filter_entry.connect("changed", self.on_search_changed) self.filter_entry.connect("icon-press", self.on_search_icon_press) space.pack_start(self.filter_entry, True, True, 0) main.pack_start(self.search_box, False, True, 0) window = gtk.ScrolledWindow() window.set_policy(gtk.PolicyType.NEVER, gtk.PolicyType.AUTOMATIC) self.fact_tree = FactTree() self.fact_tree.connect("on-activate-row", self.on_row_activated) self.fact_tree.connect("on-delete-called", self.on_row_delete_called) window.add(self.fact_tree) main.pack_start(window, True, True, 1) self.totals = Totals() main.pack_start(self.totals, False, True, 1) date_range = stuff.week(dt.datetime.today()) # TODO - do the hamster day self.header_bar.range_pick.set_range(*date_range) self.header_bar.range_pick.connect("range-selected", self.on_range_selected) self.header_bar.add_activity_button.connect("clicked", self.on_add_activity_clicked) self.header_bar.search_button.connect("toggled", self.on_search_toggled) self.header_bar.menu_prefs.connect("activate", self.on_prefs_clicked) self.header_bar.menu_export.connect("activate", self.on_export_clicked) self.window.connect("key-press-event", self.on_key_press) self.facts = [] self.find_facts() self.window.show_all()
def on_week_clicked(self, button): self.current_range = "week" self.start_date, self.end_date = stuff.week(self.today) self.emit_range("week", self.start_date, self.end_date)