Exemple #1
0
    def PluginPreferences(self, parent):
        hb = Gtk.HBox(spacing=3)
        hb.set_border_width(6)
        e = Entry(max_length=2)
        e.set_width_chars(3)
        e.set_max_width_chars(3)
        e.set_text(get_lang())
        e.connect('changed', self.changed)
        hb.pack_start(
            Gtk.Label(label=_("Search at %(website)s") %
                      {"website": "https://"}), False, True, 0)
        hb.pack_start(e, False, True, 0)
        hb.pack_start(Gtk.Label(label=".wikipedia.org"), False, True, 0)
        vb = Gtk.VBox(spacing=6)
        vb.pack_start(hb, False, False, 0)

        def _open_editor(widget):
            def _editor_closed(widget):
                tags = widget.get_strings()
                config.setlist("plugins", "wiki_tags", tags)

            tags = config.getlist("plugins", "wiki_tags", self.DEFAULT_TAGS)
            editor = TagListEditor(_("Edit Tags"),
                                   [] if tags == [''] else tags)
            editor.set_transient_for(get_top_parent(parent))
            editor.connect('destroy', _editor_closed)
            editor.show()

        button = Gtk.Button(_("Edit Tags"))
        button.connect('clicked', _open_editor)
        vb.pack_start(button, False, True, 0)
        vb.show_all()

        return vb
Exemple #2
0
 def PluginPreferences(self, parent):
     hb = Gtk.HBox(spacing=3)
     hb.set_border_width(6)
     e = Entry(max_length=2)
     e.set_width_chars(3)
     e.set_max_width_chars(3)
     e.set_text(get_lang())
     e.connect('changed', self.changed)
     hb.pack_start(
         Gtk.Label(label=_("Search at %(website)s") %
                   {"website": "https://"}), False, True, 0)
     hb.pack_start(e, False, True, 0)
     hb.pack_start(Gtk.Label(label=".wikipedia.org"), False, True, 0)
     hb.show_all()
     return hb
Exemple #3
0
 def test_set_max_width_chars(self):
     with visible(Entry()) as e:
         e.set_max_width_chars(4)
         nat1 = e.get_preferred_width()[1]
         e.set_max_width_chars(40)
         nat2 = e.get_preferred_width()[1]
         self.assertTrue(nat1 < nat2)
Exemple #4
0
 def PluginPreferences(self, parent):
     hb = Gtk.HBox(spacing=3)
     hb.set_border_width(6)
     e = Entry(max_length=2)
     e.set_width_chars(3)
     e.set_max_width_chars(3)
     e.set_text(get_lang())
     e.connect('changed', self.changed)
     hb.pack_start(
         Gtk.Label(label=_("Search at %(website)s") % {
             "website": "https://"}),
         False, True, 0)
     hb.pack_start(e, False, True, 0)
     hb.pack_start(Gtk.Label(label=".wikipedia.org"), False, True, 0)
     hb.show_all()
     return hb