本文整理汇总了Python中sugar3.graphics.combobox.ComboBox.get_model方法的典型用法代码示例。如果您正苦于以下问题:Python ComboBox.get_model方法的具体用法?Python ComboBox.get_model怎么用?Python ComboBox.get_model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.combobox.ComboBox
的用法示例。
在下文中一共展示了ComboBox.get_model方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainToolbox
# 需要导入模块: from sugar3.graphics.combobox import ComboBox [as 别名]
# 或者: from sugar3.graphics.combobox.ComboBox import get_model [as 别名]
#.........这里部分代码省略.........
self._filter_type != FILTER_TYPE_MIME_BY_ACTIVITY)
new_query = self._build_query()
if self._query != new_query:
self._query = new_query
self.emit('query-changed', self._query)
def _search_entry_activated_cb(self, search_entry):
if self._autosearch_timer:
GObject.source_remove(self._autosearch_timer)
self._update_if_needed()
def _search_entry_changed_cb(self, search_entry):
if not search_entry.props.text:
search_entry.activate()
return
if self._autosearch_timer:
GObject.source_remove(self._autosearch_timer)
self._autosearch_timer = GObject.timeout_add(_AUTOSEARCH_TIMEOUT,
self._autosearch_timer_cb)
def _autosearch_timer_cb(self):
logging.debug('_autosearch_timer_cb')
self._autosearch_timer = None
self.search_entry.activate()
return False
def set_mount_point(self, mount_point):
self._mount_point = mount_point
self._update_if_needed()
def set_what_filter(self, what_filter):
combo_model = self._what_search_combo.get_model()
what_filter_index = -1
for i in range(0, len(combo_model) - 1):
if combo_model[i][0] == what_filter:
what_filter_index = i
break
if what_filter_index == -1:
logging.warning('what_filter %r not known', what_filter)
else:
self._what_search_combo.set_active(what_filter_index)
def update_filters(self, mount_point, what_filter, filter_type=None):
self._mount_point = mount_point
self._filter_type = filter_type
self._what_filter = what_filter
self.set_what_filter(what_filter)
self._update_if_needed()
def set_filter_type(self, filter_type):
self._filter_type = filter_type
self._update_if_needed()
def refresh_filters(self):
current_value = self._what_search_combo.props.value
current_value_index = 0
self._what_search_combo.handler_block(self._what_combo_changed_sid)
try:
self._what_search_combo.remove_all()
# TRANS: Item in a combo box that filters by entry type.
self._what_search_combo.append_item(_ACTION_ANYTHING,
_('Anything'))