本文整理汇总了Python中sugar3.graphics.radiotoolbutton.RadioToolButton.hide方法的典型用法代码示例。如果您正苦于以下问题:Python RadioToolButton.hide方法的具体用法?Python RadioToolButton.hide怎么用?Python RadioToolButton.hide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.radiotoolbutton.RadioToolButton
的用法示例。
在下文中一共展示了RadioToolButton.hide方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ViewToolbar
# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import hide [as 别名]
class ViewToolbar(Gtk.Toolbar):
__gtype_name__ = 'SugarViewToolbar'
__gsignals__ = {
'query-changed': (GObject.SignalFlags.RUN_FIRST, None,
([str])),
'view-changed': (GObject.SignalFlags.RUN_FIRST, None,
([object])),
}
def __init__(self):
Gtk.Toolbar.__init__(self)
self._query = None
self._autosearch_timer = None
self._add_separator()
tool_item = Gtk.ToolItem()
self.insert(tool_item, -1)
tool_item.show()
self.search_entry = iconentry.IconEntry()
self.search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY,
'entry-search')
self.set_placeholder_text_for_view(_('Home'))
self.search_entry.add_clear_button()
self.search_entry.set_width_chars(25)
self.search_entry.connect('activate', self._entry_activated_cb)
self.search_entry.connect('changed', self._entry_changed_cb)
tool_item.add(self.search_entry)
self.search_entry.show()
self._add_separator(expand=True)
self._favorites_button = FavoritesButton()
self._favorites_button.connect('toggled',
self.__view_button_toggled_cb,
_FAVORITES_VIEW)
self.insert(self._favorites_button, -1)
self._list_button = RadioToolButton(icon_name='view-list')
self._list_button.props.group = self._favorites_button
self._list_button.props.tooltip = _('List view')
self._list_button.props.accelerator = _('<Ctrl>2')
self._list_button.connect('toggled', self.__view_button_toggled_cb,
_LIST_VIEW)
self.insert(self._list_button, -1)
self._add_separator()
def show_view_buttons(self):
self._favorites_button.show()
self._list_button.show()
def hide_view_buttons(self):
self._favorites_button.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
#.........这里部分代码省略.........
示例2: ViewToolbar
# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import hide [as 别名]
class ViewToolbar(Gtk.Toolbar):
__gtype_name__ = 'SugarViewToolbar'
__gsignals__ = {
'query-changed': (GObject.SignalFlags.RUN_FIRST, None,
([str])),
'view-changed': (GObject.SignalFlags.RUN_FIRST, None,
([object])),
}
def __init__(self):
Gtk.Toolbar.__init__(self)
self._favorites_views_indicies = []
for i in range(desktop.get_number_of_views()):
self._favorites_views_indicies.append(i)
self._list_view_index = self._favorites_views_indicies[-1] + 1
self._desktop_model = desktop.get_model()
self._desktop_model.connect('desktop-view-icons-changed',
self.__desktop_view_icons_changed_cb)
self._query = None
self._autosearch_timer = None
self._add_separator()
tool_item = Gtk.ToolItem()
self.insert(tool_item, -1)
tool_item.show()
self.search_entry = iconentry.IconEntry()
self.search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY,
'entry-search')
self.set_placeholder_text_for_view(_('Home'))
self.search_entry.add_clear_button()
self.search_entry.set_width_chars(25)
self.search_entry.connect('activate', self._entry_activated_cb)
self.search_entry.connect('changed', self._entry_changed_cb)
tool_item.add(self.search_entry)
self.search_entry.show()
self._add_separator(expand=True)
self._button_box = Gtk.HBox()
self._favorites_buttons = []
for i in range(desktop.get_number_of_views()):
self._add_favorites_button(i)
toolitem = Gtk.ToolItem()
toolitem.add(self._button_box)
self.insert(toolitem, -1)
self._button_box.show()
toolitem.show()
self._list_button = RadioToolButton(icon_name='view-list')
self._list_button.props.group = self._favorites_buttons[0]
self._list_button.props.tooltip = _('List view')
self._list_button.props.accelerator = \
_('<Ctrl>%d' % (len(self._favorites_views_indicies) + 1))
self._list_view_toggle_id = self._list_button.connect(
'toggled', self.__view_button_toggled_cb, self._list_view_index)
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,
#.........这里部分代码省略.........