Python gi.repository.Gtk.EntryCompletion() Examples
The following are 10
code examples of gi.repository.Gtk.EntryCompletion().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gi.repository.Gtk
, or try the search function
.
Example #1
Source File: gui_utilities.py From king-phisher with BSD 3-Clause "New" or "Revised" License | 6 votes |
def gtk_combobox_set_entry_completion(combobox): """ Add completion for a :py:class:`Gtk.ComboBox` widget which contains an entry. They combobox's ``entry-text-column`` property it used to determine which column in its model contains the strings to suggest for completion. .. versionadded:: 1.14.0 :param combobox: The combobox to add completion for. :type: :py:class:`Gtk.ComboBox` """ utilities.assert_arg_type(combobox, Gtk.ComboBox) completion = Gtk.EntryCompletion() completion.set_model(combobox.get_model()) completion.set_text_column(combobox.get_entry_text_column()) entry = combobox.get_child() entry.set_completion(completion)
Example #2
Source File: login.py From king-phisher with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, *args, **kwargs): super(LoginDialog, self).__init__(*args, **kwargs) self.popup_menu = managers.MenuManager() self.popup_menu.append('About', lambda x: about.AboutDialog(self.application).interact()) self.popup_menu.append('Import Configuration', self.signal_menuitem_activate_import_config) # setup server completion model = Gtk.ListStore(str) for entry in self.config['server.history']: model.append((entry,)) completion = Gtk.EntryCompletion() completion.set_model(model) completion.set_text_column(0) self.gobjects['entry_server'].set_completion(completion)
Example #3
Source File: mail.py From king-phisher with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, *args, **kwargs): self.label = Gtk.Label(label='Configuration') """The :py:class:`Gtk.Label` representing this tabs name.""" super(MailSenderConfigurationTab, self).__init__(*args, **kwargs) self.application.connect('campaign-changed', self.signal_kpc_campaign_changed) self.application.connect('campaign-set', self.signal_kpc_campaign_set) self.application.connect('exit', self.signal_kpc_exit) self.application.connect('server-connected', self._url_completion_load) self.message_type = managers.RadioButtonGroupManager(self, 'message_type') self.message_type.set_active(self.config['mailer.message_type']) self.target_field = managers.RadioButtonGroupManager(self, 'target_field') self.target_field.set_active(self.config['mailer.target_field']) self.target_type = managers.RadioButtonGroupManager(self, 'target_type') self.target_type.set_active(self.config['mailer.target_type']) self.message_uid_charset = managers.ToggleButtonGroupManager(self, 'checkbutton', 'message_uid_charset') self.message_uid_charset.set_active(self.config['mailer.message_uid.charset']) self._update_target_count() self.url_completion = Gtk.EntryCompletion() self._url_list_store = Gtk.ListStore(str) self.url_completion.set_model(self._url_list_store) self.url_completion.set_text_column(0) self.url_completion.set_match_func(self._url_custom_match_function) self.gobjects['entry_webserver_url'].set_completion(self.url_completion) self.gobjects['entry_webserver_url'].connect('key-press-event', self._webserver_url_key_press_event) self.refresh_frequency = parse_timespan(str(self.config.get('gui.refresh_frequency', '5m'))) self._url_completion_last_load_time = None self._url_thread = None
Example #4
Source File: PlaceCompletion.py From addons-source with GNU General Public License v2.0 | 5 votes |
def fill_comboboxentry(self, cmbe, namelistopt, default) : ''' default is the key in the combobox, or a text with what should be in the text field ''' store = Gtk.ListStore(str,str) index = 0 indexactive = None for data in namelistopt: if data: store.append(row=[data[0], data[2]]) if data[0] == default : indexactive=index index += 1 cmbe.set_model(store) cmbe.set_entry_text_column(1) #completion = Gtk.EntryCompletion() #completion.set_model(store) #completion.set_minimum_key_length(1) #completion.set_text_column(0) #cmbe.get_child().set_completion(completion) if indexactive != None : cmbe.set_active(indexactive) else : if default : cmbe.get_child().set_text(default)
Example #5
Source File: combobox_enhanced.py From gtg with GNU General Public License v3.0 | 5 votes |
def completionFromListStore(list_store): completion = Gtk.EntryCompletion() completion.set_minimum_key_length(0) completion.set_text_column(0) completion.set_inline_completion(True) completion.set_model(list_store) return completion
Example #6
Source File: entry_widgets.py From hazzy with GNU General Public License v2.0 | 5 votes |
def __init__(self): super(MDIEntry, self).__init__() self.buffer = self.get_buffer() self.style_context = self.get_style_context() self.show_vkb = prefs.get('MDI_ENTRY', 'SHOW_VIRTUAL_KEYBOARD', 'YES', bool) self.set_placeholder_text('MDI') self.model = Gtk.ListStore(str) self.completion = Gtk.EntryCompletion() self.completion.set_model(self.model) self.completion.set_text_column(0) # Completion popup steals focus from the VKB, and visa-versa, so # until a solution is found don't enable both at the same time. if not self.show_vkb: self.set_completion(self.completion) self.scrolled_to_bottom = False self.load_from_history_file() self.connect('activate', self.on_entry_activated) self.connect('focus-in-event', self.on_entry_gets_focus) self.connect('focus-out-event', self.on_entry_loses_focus)
Example #7
Source File: right_textview.py From bokken with GNU General Public License v2.0 | 5 votes |
def set_completion(self): # Seek entry EntryCompletion self.completion = Gtk.EntryCompletion() self.liststore = Gtk.ListStore(str) # Add function names to the list for function in self.uicore.allfuncs: self.liststore.append([function]) self.completion.set_model(self.liststore) self.seek.set_completion(self.completion) self.completion.set_text_column(0)
Example #8
Source File: widgets.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
def __init__(self, notebook, path=None, subpaths_only=False, existing_only=False): '''Constructor @param notebook: the L{Notebook} object for resolving paths and completing existing pages, but allowed to be C{None} e.g. for testing @param path: a L{Path} object used for resolving relative links @param subpaths_only: if C{True} the input will always be considered a child 'C{path}' @param existing_only: if C{True} only allow to select existing pages @note: 'C{subpaths_only}' and 'C{existing_only}' can also be set using the like named attributes ''' self.notebook = notebook self.notebookpath = path self.subpaths_only = subpaths_only self.existing_only = existing_only if self._allow_select_root: placeholder_text = _('<Top>') # T: default text for empty page section selection else: placeholder_text = None InputEntry.__init__(self, allow_empty=self._allow_select_root, placeholder_text=placeholder_text) assert path is None or isinstance(path, Path) completion = Gtk.EntryCompletion() completion.set_model(Gtk.ListStore(str, str)) # visible name, match name completion.set_text_column(0) self.set_completion(completion) self.connect_after('changed', self.__class__.update_completion)
Example #9
Source File: customwidgets.py From rednotebook with GNU General Public License v2.0 | 5 votes |
def __init__(self, combo_box): self.combo_box = combo_box self.liststore = Gtk.ListStore(GObject.TYPE_STRING) self.entries = set() self.combo_box.set_model(self.liststore) self.combo_box.set_entry_text_column(0) self.entry = self.combo_box.get_child() # Autocompletion entry_completion = Gtk.EntryCompletion() entry_completion.set_model(self.liststore) entry_completion.set_minimum_key_length(1) entry_completion.set_text_column(0) self.entry.set_completion(entry_completion)
Example #10
Source File: add.py From Authenticator with GNU General Public License v2.0 | 4 votes |
def _build_widgets(self): container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) container.set_border_width(36) self.provider_combo.set_entry_text_column(0) self.provider_combo.connect("changed", self._on_provider_changed) # Set up auto completion provider_entry = self.provider_combo.get_child() provider_entry.set_placeholder_text(_("Provider")) completion = Gtk.EntryCompletion() completion.set_model(self._providers_store) completion.set_text_column(0) provider_entry.set_completion(completion) if self._account: provider_entry.set_text(self._account.provider) self.username_entry.set_placeholder_text(_("Account name")) self.username_entry.connect("changed", self._validate) if self._account: self.username_entry.set_text(self._account.username) if not self.is_edit: self.token_entry.set_placeholder_text(_("Secret token")) self.token_entry.set_visibility(False) self.token_entry.connect("changed", self._validate) # To set the empty logo if self._account: pixbuf = load_pixbuf_from_provider(self._account.provider, 96) else: pixbuf = load_pixbuf_from_provider(None, 96) self.logo_img.set_from_pixbuf(pixbuf) container.pack_start(self.logo_img, False, False, 6) if not self.is_edit: container.pack_end(self.token_entry, False, False, 6) container.pack_end(self.username_entry, False, False, 6) container.pack_end(self.provider_combo, False, False, 6) self.pack_start(container, False, False, 6)