本文整理汇总了Python中sugar3.graphics.radiotoolbutton.RadioToolButton.disconnect方法的典型用法代码示例。如果您正苦于以下问题:Python RadioToolButton.disconnect方法的具体用法?Python RadioToolButton.disconnect怎么用?Python RadioToolButton.disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.radiotoolbutton.RadioToolButton
的用法示例。
在下文中一共展示了RadioToolButton.disconnect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ViewToolbar
# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import disconnect [as 别名]
#.........这里部分代码省略.........
self.insert(self._list_button, -1)
self._add_separator()
def _add_favorites_button(self, i):
logging.debug('adding FavoritesButton %d' % (i))
self._favorites_buttons.append(FavoritesButton(i))
self._favorites_buttons[i].connect('toggled',
self.__view_button_toggled_cb,
self._favorites_views_indicies[i])
if i > 0:
self._favorites_buttons[i].props.group = self._favorites_buttons[0]
self._button_box.add(self._favorites_buttons[i])
self._favorites_buttons[i].show()
def show_view_buttons(self):
for i in range(desktop.get_number_of_views()):
self._favorites_buttons[i].show()
self._list_button.show()
def hide_view_buttons(self):
for i in range(desktop.get_number_of_views()):
self._favorites_buttons[i].hide()
self._list_button.hide()
def clear_query(self):
self.search_entry.props.text = ''
def set_placeholder_text_for_view(self, view_name):
text = _('Search in %s') % view_name
self.search_entry.set_placeholder_text(text)
def _add_separator(self, expand=False):
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
if expand:
separator.set_expand(True)
else:
separator.set_size_request(style.GRID_CELL_SIZE,
style.GRID_CELL_SIZE)
self.insert(separator, -1)
separator.show()
def _entry_activated_cb(self, entry):
if self._autosearch_timer:
GObject.source_remove(self._autosearch_timer)
new_query = entry.props.text
if self._query != new_query:
self._query = new_query
self.emit('query-changed', self._query)
def _entry_changed_cb(self, entry):
if not entry.props.text:
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 __view_button_toggled_cb(self, button, view):
if button.props.active:
self.emit('view-changed', view)
def __desktop_view_icons_changed_cb(self, model):
number_of_views = desktop.get_number_of_views()
if len(self._favorites_views_indicies) < number_of_views:
for i in range(number_of_views -
len(self._favorites_views_indicies)):
n = len(self._favorites_views_indicies)
self._favorites_views_indicies.append(n)
self._add_favorites_button(n)
self._favorites_buttons[n].show()
elif number_of_views < len(self._favorites_views_indicies):
for i in range(len(self._favorites_views_indicies) -
number_of_views):
n = len(self._favorites_views_indicies) - 1
logging.debug('removing FavoritesButton %d' % (n))
button = self._favorites_buttons[n]
self._favorites_buttons.remove(button)
button.destroy()
self._favorites_views_indicies.remove(
self._favorites_views_indicies[n])
self._button_box.show()
self._list_view_index = number_of_views
self._list_button.props.accelerator = \
_('<Ctrl>%d' % (len(self._favorites_views_indicies) + 1))
self._list_button.disconnect(self._list_view_toggle_id)
self._list_view_toggle_id = self._list_button.connect(
'toggled', self.__view_button_toggled_cb, self._list_view_index)
self._list_button.show()