本文整理汇总了Python中sugar3.graphics.toggletoolbutton.ToggleToolButton.set_accelerator方法的典型用法代码示例。如果您正苦于以下问题:Python ToggleToolButton.set_accelerator方法的具体用法?Python ToggleToolButton.set_accelerator怎么用?Python ToggleToolButton.set_accelerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toggletoolbutton.ToggleToolButton
的用法示例。
在下文中一共展示了ToggleToolButton.set_accelerator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ViewToolbar
# 需要导入模块: from sugar3.graphics.toggletoolbutton import ToggleToolButton [as 别名]
# 或者: from sugar3.graphics.toggletoolbutton.ToggleToolButton import set_accelerator [as 别名]
class ViewToolbar(Gtk.Toolbar):
__gtype_name__ = 'ViewToolbar'
__gsignals__ = {
'go-fullscreen': (GObject.SignalFlags.RUN_FIRST,
None,
([])),
'toggle-playlist': (GObject.SignalFlags.RUN_FIRST,
None,
([]))
}
def __init__(self):
Gtk.Toolbar.__init__(self)
self._show_playlist = ToggleToolButton('view-list')
self._show_playlist.set_active(True) # due to Activity.show_all()
self._show_playlist.set_tooltip(_('Playlist'))
self._show_playlist.set_accelerator('<ctrl>l')
self._show_playlist.connect('toggled', self._playlist_toggled_cb)
self.insert(self._show_playlist, -1)
self._show_playlist.show()
self._fullscreen = ToolButton('view-fullscreen')
self._fullscreen.set_tooltip(_('Fullscreen'))
self._fullscreen.set_accelerator('<ctrl>f')
self._fullscreen.connect('clicked', self._fullscreen_cb)
self.insert(self._fullscreen, -1)
self._fullscreen.show()
def _fullscreen_cb(self, button):
self.emit('go-fullscreen')
def _playlist_toggled_cb(self, button):
self.emit('toggle-playlist')
示例2: PrimaryToolbar
# 需要导入模块: from sugar3.graphics.toggletoolbutton import ToggleToolButton [as 别名]
# 或者: from sugar3.graphics.toggletoolbutton.ToggleToolButton import set_accelerator [as 别名]
#.........这里部分代码省略.........
toolbar.insert(self._back, -1)
self._back.show()
palette = self._back.get_palette()
self._back_box_menu = Gtk.VBox()
self._back_box_menu.show()
palette.set_content(self._back_box_menu)
# FIXME, this is a hack, should be done in the theme:
palette._content.set_border_width(1)
self._forward = ToolButton('go-next-paired',
accelerator='<ctrl>Right')
self._forward.set_tooltip(_('Forward'))
self._forward.props.sensitive = False
self._forward.connect('clicked', self._go_forward_cb)
toolbar.insert(self._forward, -1)
self._forward.show()
palette = self._forward.get_palette()
self._forward_box_menu = Gtk.VBox()
self._forward_box_menu.show()
palette.set_content(self._forward_box_menu)
# FIXME, this is a hack, should be done in the theme:
palette._content.set_border_width(1)
self._download_icon = ProgressToolButton(
icon_name='emblem-downloads',
tooltip=_('No Downloads Running'))
toolbar.insert(self._download_icon, -1)
self._download_icon.show()
downloadmanager.connect_download_started(self.__download_started_cb)
self._link_add = ToggleToolButton('emblem-favorite')
self._link_add.set_accelerator('<ctrl>d')
self._link_add.set_tooltip(_('Bookmark'))
self._link_add_toggled_hid = \
self._link_add.connect('toggled', self.__link_add_toggled_cb)
toolbar.insert(self._link_add, -1)
self._link_add.show()
self._toolbar_separator = Gtk.SeparatorToolItem()
self._toolbar_separator.props.draw = False
self._toolbar_separator.set_expand(True)
self._stop_button = StopButton(self._activity)
toolbar.insert(self._stop_button, -1)
self._progress_listener = None
self._browser = None
self._loading_changed_hid = None
self._progress_changed_hid = None
self._session_history_changed_hid = None
self._uri_changed_hid = None
self._load_changed_hid = None
self._security_status_changed_hid = None
if tabbed_view.get_n_pages():
self._connect_to_browser(tabbed_view.props.current_browser)
tabbed_view.connect_after('switch-page', self.__switch_page_cb)
tabbed_view.connect_after('page-added', self.__page_added_cb)
Gdk.Screen.get_default().connect('size-changed',
self.__screen_size_changed_cb)