def __init__(self, journal, *args, **kwargs): AssistantPage.__init__(self, *args, **kwargs) self.journal = journal self.all_days_button = Gtk.RadioButton(label=_('Export all days')) self.selected_text_button = Gtk.RadioButton( group=self.all_days_button) self.one_day_button = Gtk.RadioButton( label=_('Export currently visible day'), group=self.all_days_button) self.sel_days_button = Gtk.RadioButton( label=_('Export days in the selected time range'), group=self.all_days_button) self.pack_start(self.all_days_button, False, False, 0) self.pack_start(self.one_day_button, False, False, 0) self.pack_start(self.selected_text_button, False, False, 0) self.pack_start(self.sel_days_button, False, False, 0) label1 = Gtk.Label() label1.set_markup('<b>' + _('From:') + '</b>') label2 = Gtk.Label() label2.set_markup('<b>' + _('To:') + '</b>') show_week_numbers = self.journal.config.read('weekNumbers') self.calendar1 = Calendar(week_numbers=show_week_numbers) self.calendar2 = Calendar(week_numbers=show_week_numbers) vbox1 = Gtk.VBox() vbox2 = Gtk.VBox() vbox1.pack_start(label1, False, False, 0) vbox1.pack_start(self.calendar1, True, True, 0) vbox2.pack_start(label2, False, False, 0) vbox2.pack_start(self.calendar2, True, True, 0) hbox = Gtk.HBox() hbox.pack_start(vbox1, True, True, 0) hbox.pack_start(vbox2, True, True, 0) self.pack_start(hbox, True, True, 0) self.sel_days_button.connect('toggled', self._on_select_days_toggled) self.all_days_button.set_active(True) self._set_select_days(False)
def __init__(self, journal, *args, **kwargs): AssistantPage.__init__(self, *args, **kwargs) self.journal = journal self.all_days_button = gtk.RadioButton(label=_('Export all days')) self.selected_text_button = gtk.RadioButton( label=_('Export currently selected text'), group=self.all_days_button) self.one_day_button = gtk.RadioButton( label=_('Export currently visible day'), group=self.all_days_button) self.sel_days_button = gtk.RadioButton( label=_('Export days in the selected time range'), group=self.all_days_button) self.pack_start(self.all_days_button, False) self.pack_start(self.one_day_button, False) self.pack_start(self.selected_text_button, False) self.pack_start(self.sel_days_button, False) label1 = gtk.Label() label1.set_markup('<b>' + _('From:') + '</b>') label2 = gtk.Label() label2.set_markup('<b>' + _('To:') + '</b>') self.calendar1 = Calendar() self.calendar2 = Calendar() vbox1 = gtk.VBox() vbox2 = gtk.VBox() vbox1.pack_start(label1, False) vbox1.pack_start(self.calendar1) vbox2.pack_start(label2, False) vbox2.pack_start(self.calendar2) hbox = gtk.HBox() hbox.pack_start(vbox1) hbox.pack_start(vbox2) self.pack_start(hbox) self.sel_days_button.connect('toggled', self._on_select_days_toggled) self.all_days_button.set_active(True) self._set_select_days(False)
def __init__(self, journal, *args, **kwargs): AssistantPage.__init__(self, *args, **kwargs) self.journal = journal self.all_days_button = gtk.RadioButton(label=_('Export all days')) self.sel_days_button = gtk.RadioButton(label=_('Export only the days in the selected time range'), group=self.all_days_button) self.pack_start(self.all_days_button, False) self.pack_start(self.sel_days_button, False) label1 = gtk.Label() label1.set_markup('<b>' + _('From:') + '</b>') label2 = gtk.Label() label2.set_markup('<b>' + _('To:') + '</b>') self.calendar1 = Calendar() self.calendar2 = Calendar() vbox1 = gtk.VBox() vbox2 = gtk.VBox() vbox1.pack_start(label1, False) vbox1.pack_start(self.calendar1) vbox2.pack_start(label2, False) vbox2.pack_start(self.calendar2) hbox = gtk.HBox() hbox.pack_start(vbox1) hbox.pack_start(vbox2) self.pack_start(hbox) self.sel_days_button.connect('toggled', self._on_select_days_toggled) self.all_days_button.set_active(True) self._set_select_days(False)
class DatePage(AssistantPage): def __init__(self, journal, *args, **kwargs): AssistantPage.__init__(self, *args, **kwargs) self.journal = journal self.all_days_button = Gtk.RadioButton(label=_('Export all days')) self.selected_text_button = Gtk.RadioButton(group=self.all_days_button) self.one_day_button = Gtk.RadioButton( label=_('Export currently visible day'), group=self.all_days_button) self.sel_days_button = Gtk.RadioButton( label=_('Export days in the selected time range'), group=self.all_days_button) self.pack_start(self.all_days_button, False, False, 0) self.pack_start(self.one_day_button, False, False, 0) self.pack_start(self.selected_text_button, False, False, 0) self.pack_start(self.sel_days_button, False, False, 0) label1 = Gtk.Label() label1.set_markup('<b>' + _('From:') + '</b>') label2 = Gtk.Label() label2.set_markup('<b>' + _('To:') + '</b>') show_week_numbers = self.journal.config.read('weekNumbers') self.calendar1 = Calendar(week_numbers=show_week_numbers) self.calendar2 = Calendar(week_numbers=show_week_numbers) vbox1 = Gtk.VBox() vbox2 = Gtk.VBox() vbox1.pack_start(label1, False, False, 0) vbox1.pack_start(self.calendar1, True, True, 0) vbox2.pack_start(label2, False, False, 0) vbox2.pack_start(self.calendar2, True, True, 0) hbox = Gtk.HBox() hbox.pack_start(vbox1, True, True, 0) hbox.pack_start(vbox2, True, True, 0) self.pack_start(hbox, True, True, 0) self.sel_days_button.connect('toggled', self._on_select_days_toggled) self.all_days_button.set_active(True) self._set_select_days(False) def _on_select_days_toggled(self, button): select = self.sel_days_button.get_active() self._set_select_days(select) def _set_select_days(self, sensitive): self.calendar1.set_sensitive(sensitive) self.calendar2.set_sensitive(sensitive) self.select_days = sensitive def export_all_days(self): return self.all_days_button.get_active() def export_selected_text(self): return self.selected_text_button.get_active() def get_date_range(self): if self.select_days: return (self.calendar1.get_date(), self.calendar2.get_date()) return (self.journal.day.date, ) * 2 def refresh_dates(self): self.calendar1.set_date(datetime.date.today()) self.calendar2.set_date(datetime.date.today()) def prepare(self): selected_text_label = _('Export currently selected text') self.selected_text = self.journal.frame.day_text_field.get_selected_text( ) enable_selected_text_button = bool( self.selected_text and not self.journal.frame.preview_mode) self.selected_text_button.set_sensitive(enable_selected_text_button) if enable_selected_text_button: self.selected_text_button.set_label(selected_text_label) else: self.selected_text_button.set_label( selected_text_label + ' ' + _('(Only available when text is selected in edit mode)')) if self.selected_text_button.get_active(): self.selected_text_button.set_active(False) self.all_days_button.set_active(True)
class DatePage(AssistantPage): def __init__(self, journal, *args, **kwargs): AssistantPage.__init__(self, *args, **kwargs) self.journal = journal self.all_days_button = gtk.RadioButton(label=_('Export all days')) self.one_day_button = gtk.RadioButton( label=_('Export currently visible day'), group=self.all_days_button) self.sel_days_button = gtk.RadioButton( label=_('Export days in the selected time range'), group=self.all_days_button) self.pack_start(self.all_days_button, False) self.pack_start(self.one_day_button, False) self.pack_start(self.sel_days_button, False) label1 = gtk.Label() label1.set_markup('<b>' + _('From:') + '</b>') label2 = gtk.Label() label2.set_markup('<b>' + _('To:') + '</b>') self.calendar1 = Calendar() self.calendar2 = Calendar() vbox1 = gtk.VBox() vbox2 = gtk.VBox() vbox1.pack_start(label1, False) vbox1.pack_start(self.calendar1) vbox2.pack_start(label2, False) vbox2.pack_start(self.calendar2) hbox = gtk.HBox() hbox.pack_start(vbox1) hbox.pack_start(vbox2) self.pack_start(hbox) self.sel_days_button.connect('toggled', self._on_select_days_toggled) self.all_days_button.set_active(True) self._set_select_days(False) def _on_select_days_toggled(self, button): select = self.sel_days_button.get_active() self._set_select_days(select) def _set_select_days(self, sensitive): self.calendar1.set_sensitive(sensitive) self.calendar2.set_sensitive(sensitive) self.select_days = sensitive def export_all_days(self): return self.all_days_button.get_active() def get_date_range(self): if self.select_days: return (self.calendar1.get_date(), self.calendar2.get_date()) return (self.journal.day.date,) * 2 def refresh_dates(self): self.calendar1.set_date(datetime.date.today()) self.calendar2.set_date(datetime.date.today())
class DatePage(AssistantPage): def __init__(self, journal, *args, **kwargs): AssistantPage.__init__(self, *args, **kwargs) self.journal = journal self.all_days_button = gtk.RadioButton(label=_('Export all days')) self.selected_text_button = gtk.RadioButton( group=self.all_days_button) self.one_day_button = gtk.RadioButton( label=_('Export currently visible day'), group=self.all_days_button) self.sel_days_button = gtk.RadioButton( label=_('Export days in the selected time range'), group=self.all_days_button) self.pack_start(self.all_days_button, False) self.pack_start(self.one_day_button, False) self.pack_start(self.selected_text_button, False) self.pack_start(self.sel_days_button, False) label1 = gtk.Label() label1.set_markup('<b>' + _('From:') + '</b>') label2 = gtk.Label() label2.set_markup('<b>' + _('To:') + '</b>') self.calendar1 = Calendar() self.calendar2 = Calendar() vbox1 = gtk.VBox() vbox2 = gtk.VBox() vbox1.pack_start(label1, False) vbox1.pack_start(self.calendar1) vbox2.pack_start(label2, False) vbox2.pack_start(self.calendar2) hbox = gtk.HBox() hbox.pack_start(vbox1) hbox.pack_start(vbox2) self.pack_start(hbox) self.sel_days_button.connect('toggled', self._on_select_days_toggled) self.all_days_button.set_active(True) self._set_select_days(False) def _on_select_days_toggled(self, button): select = self.sel_days_button.get_active() self._set_select_days(select) def _set_select_days(self, sensitive): self.calendar1.set_sensitive(sensitive) self.calendar2.set_sensitive(sensitive) self.select_days = sensitive def export_all_days(self): return self.all_days_button.get_active() def export_selected_text(self): return self.selected_text_button.get_active() def get_date_range(self): if self.select_days: return (self.calendar1.get_date(), self.calendar2.get_date()) return (self.journal.day.date,) * 2 def refresh_dates(self): self.calendar1.set_date(datetime.date.today()) self.calendar2.set_date(datetime.date.today()) def prepare(self): selected_text_label = _('Export currently selected text') self.selected_text = self.journal.frame.day_text_field.get_selected_text() enable_selected_text_button = bool(self.selected_text and not self.journal.frame.preview_mode) self.selected_text_button.set_sensitive(enable_selected_text_button) if enable_selected_text_button: self.selected_text_button.set_label(selected_text_label) else: self.selected_text_button.set_label( selected_text_label + ' ' + _('(Only available when text is selected in edit mode)')) if self.selected_text_button.get_active(): self.selected_text_button.set_active(False) self.all_days_button.set_active(True)
class DatePage(AssistantPage): def __init__(self, journal, *args, **kwargs): AssistantPage.__init__(self, *args, **kwargs) self.journal = journal self.all_days_button = gtk.RadioButton(label=_('Export all days')) self.sel_days_button = gtk.RadioButton(label=_('Export only the days in the selected time range'), group=self.all_days_button) self.pack_start(self.all_days_button, False) self.pack_start(self.sel_days_button, False) label1 = gtk.Label() label1.set_markup('<b>' + _('From:') + '</b>') label2 = gtk.Label() label2.set_markup('<b>' + _('To:') + '</b>') self.calendar1 = Calendar() self.calendar2 = Calendar() vbox1 = gtk.VBox() vbox2 = gtk.VBox() vbox1.pack_start(label1, False) vbox1.pack_start(self.calendar1) vbox2.pack_start(label2, False) vbox2.pack_start(self.calendar2) hbox = gtk.HBox() hbox.pack_start(vbox1) hbox.pack_start(vbox2) self.pack_start(hbox) self.sel_days_button.connect('toggled', self._on_select_days_toggled) self.all_days_button.set_active(True) self._set_select_days(False) def _on_select_days_toggled(self, button): select = self.sel_days_button.get_active() self._set_select_days(select) def _set_select_days(self, sensitive): self.calendar1.set_sensitive(sensitive) self.calendar2.set_sensitive(sensitive) self.select_days = sensitive def export_all_days(self): return self.all_days_button.get_active() def get_date_range(self): if self.select_days: return (self.calendar1.get_date(), self.calendar2.get_date()) return None def refresh_dates(self): start = self.journal.get_edit_date_of_entry_number(0) end = self.journal.get_edit_date_of_entry_number(-1) self.calendar1.set_date(start) self.calendar2.set_date(end)