本文整理汇总了Python中sugar3.graphics.toolbarbox.ToolbarButton.label方法的典型用法代码示例。如果您正苦于以下问题:Python ToolbarButton.label方法的具体用法?Python ToolbarButton.label怎么用?Python ToolbarButton.label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toolbarbox.ToolbarButton
的用法示例。
在下文中一共展示了ToolbarButton.label方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import label [as 别名]
def __init__(self, handle):
activity.Activity.__init__(self, handle)
self.set_title('FotoToon')
self._max_participants = 1
self.page = None
toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
activity_toolbar = activity_button.page
toolbar_box.toolbar.insert(activity_button, 0)
edit_toolbar_btn = ToolbarButton()
edit_toolbar = Gtk.Toolbar()
edit_toolbar_btn.props.page = edit_toolbar
edit_toolbar_btn.props.icon_name = 'toolbar-edit'
edit_toolbar_btn.label = _('Edit')
toolbar_box.toolbar.insert(edit_toolbar_btn, -1)
view_toolbar_btn = ToolbarButton()
view_toolbar = Gtk.Toolbar()
view_toolbar_btn.props.page = view_toolbar
view_toolbar_btn.props.icon_name = 'toolbar-view'
view_toolbar_btn.label = _('View')
toolbar_box.toolbar.insert(view_toolbar_btn, -1)
slideview_btn = ToggleToolButton('slideshow')
slideview_btn.set_tooltip(_('Slideshow'))
slideview_btn.set_active(False)
slideview_btn.connect('clicked', self._switch_view_mode, False)
view_toolbar.insert(slideview_btn, -1)
slideview_btn.show()
slideview_timings_btn = ToggleToolButton('slideshow-stopwatch')
slideview_timings_btn.set_tooltip(_('Slideshow with Timings'))
slideview_timings_btn.set_active(False)
slideview_timings_btn.connect('clicked', self._switch_view_mode, True)
view_toolbar.insert(slideview_timings_btn, -1)
slideview_timings_btn.show()
time_button = ToolButton('stopwatch')
time_button.set_tooltip(_('Set Image Duration in Slideshow (Seconds)'))
view_toolbar.insert(time_button, -1)
time_button.show()
self._time_spin = Gtk.SpinButton.new_with_range(MIN_TIME, MAX_TIME, 1)
self._time_spin.connect('value-changed', self.__time_spin_changed_cb)
self._time_spin.props.value = DEFAULT_TIME
self._time_spin.props.update_policy = \
Gtk.SpinButtonUpdatePolicy.IF_VALID
palette = time_button.get_palette()
palette.connect('popup', self.__time_button_popup_cb)
time_button.connect(
'clicked', lambda *args:
palette.popup(immediate=True, state=Palette.SECONDARY))
alignment = Gtk.Alignment()
alignment.set_padding(style.DEFAULT_PADDING, style.DEFAULT_PADDING,
style.DEFAULT_PADDING, style.DEFAULT_PADDING)
alignment.add(self._time_spin)
self._time_spin.show()
palette.set_content(alignment)
alignment.show()
fullscreen_btn = ToolButton('view-fullscreen')
fullscreen_btn.set_tooltip(_('Fullscreen'))
fullscreen_btn.props.accelerator = '<Alt>Return'
fullscreen_btn.connect('clicked', lambda w: self.fullscreen())
view_toolbar.insert(fullscreen_btn, -1)
fullscreen_btn.show()
self.set_toolbar_box(toolbar_box)
toolbar = toolbar_box.toolbar
self.page = Page()
self.globes_manager = GlobesManager(toolbar, edit_toolbar, self)
# fonts
self._text_button = ToolbarButton()
self._text_button.props.page = TextToolbar(self.page)
self._text_button.props.icon_name = 'format-text-size'
self._text_button.props.label = _('Text')
self._toolbar_box.toolbar.insert(self._text_button, -1)
reorder_img_btn = ToolButton('thumbs-view')
reorder_img_btn.set_icon_name('thumbs-view')
reorder_img_btn.set_tooltip(_('Change image order'))
reorder_img_btn.connect('clicked', self.__image_order_cb)
edit_toolbar.insert(reorder_img_btn, -1)
reorder_img_btn.show()
bgchange = ToolButton(icon_name='contract-coordinates')
bgchange.set_tooltip(_('Edit background image'))
bgchange.connect('clicked', self.__bgchange_clicked_cb)
edit_toolbar.insert(bgchange, -1)
bgchange.show()
#.........这里部分代码省略.........
示例2: __init__
# 需要导入模块: from sugar3.graphics.toolbarbox import ToolbarButton [as 别名]
# 或者: from sugar3.graphics.toolbarbox.ToolbarButton import label [as 别名]
def __init__(self, handle):
activity.Activity.__init__(self, handle)
self.set_title('FotoToon')
self._max_participants = 1
toolbar_box = ToolbarBox()
activity_button = ActivityToolbarButton(self)
activity_toolbar = activity_button.page
toolbar_box.toolbar.insert(activity_button, 0)
edit_toolbar_btn = ToolbarButton()
edit_toolbar = Gtk.Toolbar()
edit_toolbar_btn.props.page = edit_toolbar
edit_toolbar_btn.props.icon_name = 'toolbar-edit'
edit_toolbar_btn.label = _('Edit')
toolbar_box.toolbar.insert(edit_toolbar_btn, -1)
view_toolbar_btn = ToolbarButton()
view_toolbar = Gtk.Toolbar()
view_toolbar_btn.props.page = view_toolbar
view_toolbar_btn.props.icon_name = 'toolbar-view'
view_toolbar_btn.label = _('View')
toolbar_box.toolbar.insert(view_toolbar_btn, -1)
slideview_btn = ToggleToolButton('slideshow')
slideview_btn.set_tooltip(_('Slideshow'))
slideview_btn.set_active(False)
view_toolbar.insert(slideview_btn, -1)
slideview_btn.show()
fullscreen_btn = ToolButton('view-fullscreen')
fullscreen_btn.set_tooltip(_('Fullscreen'))
fullscreen_btn.props.accelerator = '<Alt>Return'
fullscreen_btn.connect('clicked', lambda w: self.fullscreen())
view_toolbar.insert(fullscreen_btn, -1)
fullscreen_btn.show()
self.set_toolbar_box(toolbar_box)
toolbar = toolbar_box.toolbar
self.page = Page()
self.globes_manager = GlobesManager(toolbar, edit_toolbar, self)
# fonts
text_button = ToolbarButton()
text_button.props.page = TextToolbar(self.page)
text_button.props.icon_name = 'format-text-size'
text_button.props.label = _('Text')
slideview_btn.connect('clicked', self._switch_view_mode, text_button)
toolbar_box.toolbar.insert(text_button, -1)
reorder_img_btn = ToolButton('thumbs-view')
reorder_img_btn.set_icon_name('thumbs-view')
reorder_img_btn.set_tooltip(_('Change image order'))
reorder_img_btn.connect('clicked', self.__image_order_cb)
edit_toolbar.insert(reorder_img_btn, -1)
reorder_img_btn.show()
bgchange = ToolButton(icon_name='contract-coordinates')
bgchange.set_tooltip(_('Edit background image'))
bgchange.connect('clicked', self.__bgchange_clicked_cb)
edit_toolbar.insert(bgchange, -1)
bgchange.show()
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar_box.toolbar.insert(separator, -1)
stop = StopButton(self)
toolbar_box.toolbar.insert(stop, -1)
toolbar_box.show_all()
# add export button
separator_2 = Gtk.SeparatorToolItem()
separator_2.show()
activity_toolbar.insert(separator_2, -1)
self.bt_save_as_image = ToolButton()
self.bt_save_as_image.props.icon_name = 'save-as-image'
self.bt_save_as_image.connect('clicked', self.write_image)
self.bt_save_as_image.set_tooltip(_('Save as Image'))
activity_toolbar.insert(self.bt_save_as_image, -1)
self.bt_save_as_image.show()
save_as_pdf = ToolButton()
save_as_pdf.props.icon_name = 'save-as-pdf'
save_as_pdf.connect('clicked', self._save_as_pdf)
save_as_pdf.set_tooltip(_('Save as a Book (PDF)'))
activity_toolbar.insert(save_as_pdf, -1)
save_as_pdf.show()
activity_button.page.title.connect("focus-in-event", self.on_title)
#.........这里部分代码省略.........