本文整理汇总了Python中gi.repository.Gtk.EntryCompletion方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.EntryCompletion方法的具体用法?Python Gtk.EntryCompletion怎么用?Python Gtk.EntryCompletion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.EntryCompletion方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gtk_combobox_set_entry_completion
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import EntryCompletion [as 别名]
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)
示例2: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import EntryCompletion [as 别名]
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)
示例3: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import EntryCompletion [as 别名]
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
示例4: fill_comboboxentry
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import EntryCompletion [as 别名]
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)
示例5: completionFromListStore
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import EntryCompletion [as 别名]
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
示例6: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import EntryCompletion [as 别名]
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)
示例7: set_completion
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import EntryCompletion [as 别名]
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)
示例8: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import EntryCompletion [as 别名]
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)
示例9: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import EntryCompletion [as 别名]
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)
示例10: _build_widgets
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import EntryCompletion [as 别名]
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)