コード例 #1
0
    def __init__(self, journal, assistant, *args, **kwargs):
        AssistantPage.__init__(self, *args, **kwargs)

        self.journal = journal
        self.assistant = assistant

        self.text_and_tags_button = Gtk.RadioButton(
            label=_('Export text and tags'))
        self.text_only_button = Gtk.RadioButton(
            label=_('Export text only'), group=self.text_and_tags_button)
        self.tags_only_button = Gtk.RadioButton(
            label=_('Export tags only'), group=self.text_and_tags_button)
        self.filter_tags_button = Gtk.CheckButton(
            label=_('Filter days by tags'))

        self.pack_start(self.text_and_tags_button, False, False, 0)
        self.pack_start(self.text_only_button, False, False, 0)
        self.pack_start(self.tags_only_button, False, False, 0)
        self.pack_start(Gtk.HSeparator(), False, False, 0)
        self.pack_start(self.filter_tags_button, False, False, 0)

        self.available_categories = customwidgets.CustomListView([
            (_('Available tags'), str)
        ])
        self.selected_categories = customwidgets.CustomListView([
            (_('Selected tags'), str)
        ])

        left_scroll = Gtk.ScrolledWindow()
        left_scroll.add(self.available_categories)

        right_scroll = Gtk.ScrolledWindow()
        right_scroll.add(self.selected_categories)

        self.select_button = Gtk.Button(_('Select') + ' >>')
        self.deselect_button = Gtk.Button('<< ' + _('Deselect'))

        self.select_button.connect('clicked', self.on_select_category)
        self.deselect_button.connect('clicked', self.on_deselect_category)

        centered_vbox = Gtk.VBox()
        centered_vbox.pack_start(self.select_button, True, False, 0)
        centered_vbox.pack_start(self.deselect_button, True, False, 0)

        vbox = Gtk.VBox()
        vbox.pack_start(centered_vbox, True, False, 0)

        hbox = Gtk.HBox()
        hbox.pack_start(left_scroll, True, True, 0)
        hbox.pack_start(vbox, False, False, 0)
        hbox.pack_start(right_scroll, True, True, 0)
        self.pack_start(hbox, True, True, 0)

        self.error_text = Gtk.Label(label='')
        self.error_text.set_alignment(0.0, 0.5)

        self.pack_end(self.error_text, False, False, 0)

        self.text_and_tags_button.set_active(True)
        self.filter_tags_button.connect('toggled', self.check_selection)
コード例 #2
0
    def __init__(self, journal, assistant, *args, **kwargs):
        AssistantPage.__init__(self, *args, **kwargs)

        self.journal = journal
        self.assistant = assistant

        # Make the config available for the date format option
        options.Option.config = journal.config
        # Set default date format string
        options.Option.config['exportDateFormat'] = '%A, %x'
        self.date_format = options.DateFormatOption(_('Date format'),
                                                    'exportDateFormat')
        self.date_format.combo.combo_box.set_tooltip_text(
            _('Leave blank to omit dates in export'))

        self.text_and_tags_button = Gtk.RadioButton(
            label=_('Export text and tags'))
        self.text_only_button = Gtk.RadioButton(
            label=_('Export text only'), group=self.text_and_tags_button)
        self.tags_only_button = Gtk.RadioButton(
            label=_('Export tags only'), group=self.text_and_tags_button)
        self.filter_tags_button = Gtk.CheckButton(
            label=_('Filter days by tags'))

        self.pack_start(self.date_format, False, False, 0)
        self.pack_start(self.text_and_tags_button, False, False, 0)
        self.pack_start(self.text_only_button, False, False, 0)
        self.pack_start(self.tags_only_button, False, False, 0)
        self.pack_start(Gtk.HSeparator(), False, False, 0)
        self.pack_start(self.filter_tags_button, False, False, 0)

        self.available_categories = customwidgets.CustomListView([
            (_('Available tags'), str)
        ])
        self.selected_categories = customwidgets.CustomListView([
            (_('Selected tags'), str)
        ])

        left_scroll = Gtk.ScrolledWindow()
        left_scroll.add(self.available_categories)

        right_scroll = Gtk.ScrolledWindow()
        right_scroll.add(self.selected_categories)

        self.select_button = Gtk.Button(_('Select') + ' >>')
        self.deselect_button = Gtk.Button('<< ' + _('Deselect'))

        self.select_button.connect('clicked', self.on_select_category)
        self.deselect_button.connect('clicked', self.on_deselect_category)

        centered_vbox = Gtk.VBox()
        centered_vbox.pack_start(self.select_button, True, False, 0)
        centered_vbox.pack_start(self.deselect_button, True, False, 0)

        vbox = Gtk.VBox()
        vbox.pack_start(centered_vbox, True, False, 0)

        hbox = Gtk.HBox()
        hbox.pack_start(left_scroll, True, True, 0)
        hbox.pack_start(vbox, False, False, 0)
        hbox.pack_start(right_scroll, True, True, 0)
        self.pack_start(hbox, True, True, 0)

        self.error_text = Gtk.Label(label='')
        self.error_text.set_alignment(0.0, 0.5)

        self.pack_end(self.error_text, False, False, 0)

        self.text_and_tags_button.set_active(True)
        self.filter_tags_button.connect('toggled', self.check_selection)