本文整理汇总了Python中sugar3.graphics.radiotoolbutton.RadioToolButton.set_accelerator方法的典型用法代码示例。如果您正苦于以下问题:Python RadioToolButton.set_accelerator方法的具体用法?Python RadioToolButton.set_accelerator怎么用?Python RadioToolButton.set_accelerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.radiotoolbutton.RadioToolButton
的用法示例。
在下文中一共展示了RadioToolButton.set_accelerator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import set_accelerator [as 别名]
def __init__(self, parent):
Gtk.Toolbar.__init__(self)
self._parent = parent
text_mode_btn = RadioToolButton(icon_name='text-mode')
text_mode_btn.set_tooltip(_('Text mode'))
text_mode_btn.set_accelerator(_('<ctrl>t'))
text_mode_btn.connect('clicked', self._parent.mode_cb,
MMapArea.MODE_TEXT)
self.insert(text_mode_btn, -1)
image_mode_btn = RadioToolButton(icon_name='image-mode', group=text_mode_btn)
image_mode_btn.set_tooltip(_('Image add mode'))
image_mode_btn.set_accelerator(_('<ctrl>i'))
image_mode_btn.connect('clicked', self._parent.mode_cb,
MMapArea.MODE_IMAGE)
self.insert(image_mode_btn, -1)
draw_mode_btn = RadioToolButton(icon_name='draw-mode', group=text_mode_btn)
draw_mode_btn.set_tooltip(_('Drawing mode'))
draw_mode_btn.set_accelerator(_('<ctrl>d'))
draw_mode_btn.connect('clicked', self._parent.mode_cb,
MMapArea.MODE_DRAW)
self.insert(draw_mode_btn, -1)
label_mode_btn = RadioToolButton(icon_name='label-mode', group=text_mode_btn)
label_mode_btn.set_tooltip(_('Label mode'))
label_mode_btn.set_accelerator(_('<ctrl>a'))
label_mode_btn.connect('clicked', self._parent.mode_cb,
MMapArea.MODE_LABEL)
self.insert(label_mode_btn, -1)
self.show_all()
示例2: _insert_create_tools
# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import set_accelerator [as 别名]
def _insert_create_tools(self, create_toolbar):
# Make + add the component buttons
self.radioList = {}
for i, c in enumerate(tools.allTools):
if i == 0:
button = RadioToolButton(group=None)
firstbutton = button
else:
button = RadioToolButton(group=firstbutton)
button.set_icon_name(c.icon)
button.set_tooltip(c.toolTip)
button.set_accelerator(c.toolAccelerator)
button.connect("clicked", self.radioClicked)
palette = self._build_palette(c)
if palette is not None:
palette.show()
button.get_palette().set_content(palette)
self._insert_item(create_toolbar, button, -1)
button.show()
self.radioList[button] = c.name
if hasattr(c, "constructor"):
self._constructors[c.name] = self.game.toolList[c.name].constructor
示例3: ActionButtons
# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import set_accelerator [as 别名]
class ActionButtons():
''' This class manages the action buttons that move among toolsbars '''
def __init__(self, parent):
self._main_toolbar = parent.get_toolbar_box().toolbar
self._main_area = parent._main_area
self._erase_button = parent.edit_toolbar.erase_button
self._sw = parent._sw
if HASTOOLBARBOX:
target_toolbar = self._main_toolbar
else:
target_toolbar = self.parent.edit_toolbar
self._mods = RadioToolButton(icon_name='select-mode')
self._mods.set_tooltip(_('Select thoughts'))
self._mods.set_accelerator(_('<ctrl>e'))
self._mods.connect('clicked', parent.mode_cb, MMapArea.MODE_NULL)
target_toolbar.insert(self._mods, -1)
self._link_button = RadioToolButton(icon_name='link', group=self._mods)
self._link_button.set_tooltip(_('Link/unlink two selected thoughts'))
self._link_button.set_accelerator(_('<ctrl>l'))
self._link_button.connect('clicked', self.__link_cb)
target_toolbar.insert(self._link_button, -1)
self.move_button = RadioToolButton(icon_name='move', group=self._mods)
self.move_button.set_tooltip(_('Move selected thoughs'))
self.move_button.set_accelerator(_('<ctrl>m'))
self.move_button.connect('clicked', self.__move_cb)
target_toolbar.insert(self.move_button, -1)
self.drag_button = RadioToolButton(icon_name='drag', group=self._mods)
self.drag_button.set_tooltip(_('Scroll the screen'))
self.drag_button.connect('clicked', self.__drag_cb)
target_toolbar.insert(self.drag_button, -1)
if HASTOOLBARBOX:
self._separator_2 = Gtk.SeparatorToolItem()
self._separator_2.props.draw = False
#self._separator_2.set_size_request(0, -1)
self._separator_2.set_expand(True)
self._separator_2.show()
target_toolbar.insert(self._separator_2, -1)
self._stop_button = StopButton(parent)
target_toolbar.insert(self._stop_button, -1)
def stop_dragging(self):
if self._main_area.is_dragging():
self._main_area.drag_menu_cb(self._sw, False)
def _stop_moving(self):
self._main_area.move_mode = False
def __link_cb(self, widget):
self._stop_moving()
self.stop_dragging()
self._main_area.link_menu_cb()
def __move_cb(self, widget):
self.stop_dragging()
if self._main_area.move_mode:
self._main_area.stop_moving()
else:
self._main_area.start_moving(self.move_button)
self._erase_button.set_sensitive(False)
def __drag_cb(self, widget):
# If we were moving, stop
self._stop_moving()
if not self._main_area.is_dragging():
self._main_area.drag_menu_cb(self._sw, True)
else:
self.stop_dragging()
self._erase_button.set_sensitive(False)
def reconfigure(self):
''' If screen width has changed, we may need to reconfigure
the toolbars '''
if not HASTOOLBARBOX:
return
if hasattr(self, '_separator_2'):
if Gdk.Screen.width() / 13 > style.GRID_CELL_SIZE:
if self._separator_2.get_parent() is None:
self._main_toolbar.remove(self._stop_button)
self._main_toolbar.insert(self._separator_2, -1)
self._main_toolbar.insert(self._stop_button, -1)
else:
self._main_toolbar.remove(self._separator_2)