本文整理汇总了Python中sugar3.graphics.combobox.ComboBox.handler_block方法的典型用法代码示例。如果您正苦于以下问题:Python ComboBox.handler_block方法的具体用法?Python ComboBox.handler_block怎么用?Python ComboBox.handler_block使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.combobox.ComboBox
的用法示例。
在下文中一共展示了ComboBox.handler_block方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainToolbox
# 需要导入模块: from sugar3.graphics.combobox import ComboBox [as 别名]
# 或者: from sugar3.graphics.combobox.ComboBox import handler_block [as 别名]
#.........这里部分代码省略.........
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'))
registry = bundleregistry.get_registry()
appended_separator = False
types = mime.get_all_generic_types()
for generic_type in types:
if not appended_separator:
self._what_search_combo.append_separator()
appended_separator = True
self._what_search_combo.append_item(
generic_type.type_id, generic_type.name, generic_type.icon)
if generic_type.type_id == current_value:
current_value_index = \
len(self._what_search_combo.get_model()) - 1
self._what_search_combo.set_active(current_value_index)
self._what_search_combo.append_separator()
for service_name in model.get_unique_values('activity'):
activity_info = registry.get_bundle(service_name)
if activity_info is None:
continue
if service_name == current_value:
combo_model = self._what_search_combo.get_model()
current_value_index = len(combo_model)