Example #1
0
    def __init__(self, text, name, tooltip):
        date_formats = [
            '%A, %x %X',
            _('%A, %x, Day %j'), '%H:%M',
            _('Week %W of Year %Y'), '%y-%m-%d',
            _('Day %j'), '%A', '%B'
        ]

        ComboBoxOption.__init__(self,
                                text,
                                name,
                                date_formats,
                                tooltip=tooltip)

        date_url = 'http://docs.python.org/library/time.html#time.strftime'
        date_format_help_button = UrlButton(_('Help'), date_url)

        self.preview = Gtk.Label()
        self.pack_start(self.preview, False, False, 0)

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

        # Set default format if not present
        format = Option.config.read(name, '%A, %x %X')
        format = str(format)
        self.combo.set_active_text(format)

        self.combo.combo_box.connect('changed', self.on_format_changed)

        # Update the preview
        self.on_format_changed(None)
Example #2
0
    def __init__(self, text, name, tooltip):
        date_formats = [
            "%A, %x %X",
            _("%A, %x, Day %j"),
            "%H:%M",
            _("Week %W of Year %Y"),
            "%y-%m-%d",
            _("Day %j"),
            "%A",
            "%B",
        ]

        ComboBoxOption.__init__(self,
                                text,
                                name,
                                date_formats,
                                tooltip=tooltip)

        date_url = "http://docs.python.org/library/time.html#time.strftime"
        date_format_help_button = UrlButton(_("Help"), date_url)

        self.preview = Gtk.Label()
        self.pack_start(self.preview, False, False, 0)

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

        # Set default format if not present
        format = Option.config.read(name, "%A, %x %X")
        format = str(format)
        self.combo.set_active_text(format)

        self.combo.combo_box.connect("changed", self.on_format_changed)

        # Update the preview
        self.on_format_changed(None)