本文整理汇总了Python中sugar3.graphics.toolbutton.ToolButton.connect方法的典型用法代码示例。如果您正苦于以下问题:Python ToolButton.connect方法的具体用法?Python ToolButton.connect怎么用?Python ToolButton.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.toolbutton.ToolButton
的用法示例。
在下文中一共展示了ToolButton.connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_toolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import connect [as 别名]
def build_toolbar(self):
# Create the toolbar box
toolbar_box = ToolbarBox()
self.set_toolbar_box(toolbar_box)
toolbar_box.show()
# Create the activity button
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, -1)
activity_button.show()
# Create the pause/play button
stop_play = ToolButton('media-playback-stop')
stop_play.set_tooltip(_("Stop"))
stop_play.set_accelerator(_('<ctrl>space'))
stop_play.connect('clicked', self.stop_play_cb)
stop_play.show()
toolbar_box.toolbar.insert(stop_play, -1)
# Create a blank separator and a Stop button
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar_box.toolbar.insert(separator, -1)
separator.show()
stop_button = StopButton(self)
toolbar_box.toolbar.insert(stop_button, -1)
stop_button.show()
示例2: add_button
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import connect [as 别名]
def add_button(icon_name, tooltip, func):
def callback(source):
func()
button = ToolButton(icon_name)
toolbar.add(button)
button.connect('clicked', callback)
button.set_tooltip(tooltip)
示例3: build_toolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import connect [as 别名]
def build_toolbar(self):
toolbar_box = ToolbarBox()
self.set_toolbar_box(toolbar_box)
toolbar_box.show()
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, -1)
activity_button.show()
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(False)
toolbar_box.toolbar.insert(separator, -1)
separator.show()
button = ToolButton('speaker-muted-100')
button.set_tooltip(_('Sound'))
button.connect('clicked', self.sound_control)
toolbar_box.toolbar.insert(button, -1)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar_box.toolbar.insert(separator, -1)
separator.show()
stop_button = StopButton(self)
toolbar_box.toolbar.insert(stop_button, -1)
stop_button.show()
self.show_all()
示例4: build_toolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import connect [as 别名]
def build_toolbar(self):
toolbox = ToolbarBox()
toolbar = toolbox.toolbar
label = Gtk.Label(_('Open an example bundle'))
label.modify_fg(Gtk.StateType.NORMAL,
Gdk.color_parse('white'))
item = Gtk.ToolItem()
item.add(label)
close = ToolButton('entry-cancel')
close.connect('clicked', self._destroy)
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar.insert(item, -1)
toolbar.insert(separator, -1)
toolbar.insert(close, -1)
toolbox.set_size_request(-1, 35)
return toolbox
示例5: makeToolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import connect [as 别名]
def makeToolbar(self, activity):
self.activity = activity
toolbar = ToolbarBox()
activity_button = ActivityToolbarButton(activity)
toolbar.toolbar.insert(activity_button, -1)
activity_button.show()
editmode = ToolButton('edit-description')
editmode.set_tooltip(_("Enter Edit Mode"))
editmode.set_accelerator(_('<ctrl>e'))
editmode.connect('clicked', self.gotoCoding)
toolbar.toolbar.insert(editmode, -1)
editmode.show()
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar.toolbar.insert(separator, -1)
separator.show()
stop_button = StopButton(activity)
toolbar.toolbar.insert(stop_button, -1)
stop_button.show()
return toolbar
示例6: __init__
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import connect [as 别名]
def __init__(self, comicbox):
BaseWindow.__init__(self)
self.toolbar = BasicToolbar('contract-coordinates')
self.toolbar.stop.connect('clicked', self.__stop_clicked_cb)
self.toolbar.confirm.connect('clicked', self.__ok_clicked_cb)
reset_size = ToolButton(icon_name='box-size')
reset_size.set_tooltip(_('Reset to box size'))
self.toolbar.insert(reset_size, 3)
reset_size.show()
reset_size.connect('clicked', self.__reset_size_cb)
self.comicbox = comicbox
self.canvas = CanvasEditor(
self.comicbox, self.comicbox.width,
self.comicbox.height, self)
label = Gtk.Label('')
title = _('Drag to move or resize using the marked corners')
label.set_markup('<span size="x-large">%s</span>' % title)
self.vbox = Gtk.VBox()
self.vbox.pack_start(self.toolbar, False, False, 0)
self.vbox.pack_start(label, False, False, style.DEFAULT_SPACING)
self.vbox.pack_start(self.canvas, True, True, 0)
self.add(self.vbox)
self.modify_bg(Gtk.StateType.NORMAL,
style.COLOR_WHITE.get_gdk_color())
示例7: ViewToolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import connect [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')
示例8: build_toolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import connect [as 别名]
def build_toolbar(self):
toolbar_box = ToolbarBox()
self.set_toolbar_box(toolbar_box)
toolbar_box.show()
activity_button = ActivityToolbarButton(self)
toolbar_box.toolbar.insert(activity_button, -1)
activity_button.show()
# Pause/Play button:
stop_play = ToolButton('media-playback-stop')
stop_play.set_tooltip(_("Stop"))
stop_play.set_accelerator(_('<ctrl>space'))
stop_play.connect('clicked', self._stop_play_cb)
stop_play.show()
toolbar_box.toolbar.insert(stop_play, -1)
# Blank space (separator) and Stop button at the end:
separator = Gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
toolbar_box.toolbar.insert(separator, -1)
separator.show()
stop_button = StopButton(self)
toolbar_box.toolbar.insert(stop_button, -1)
stop_button.show()
示例9: __init__
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import connect [as 别名]
def __init__(self, child, label, path, tabs):
GObject.GObject.__init__(self)
self.child = child
self.label_text = label
self._path = path # Hide the path in the label
self.tabs = tabs
self.label_box = Gtk.EventBox()
self._label = Gtk.Label(label=self.label_text)
self._label.set_alignment(0, 0.5)
self._label.show()
self.label_box.add(self._label)
self.label_box.connect('button-press-event', self._label_clicked)
self.label_box.show_all()
self.pack_start(self.label_box, True, True, 5)
self.label_entry = Gtk.Entry()
self.label_entry.connect('activate', self._label_entry_cb)
self.label_entry.connect('focus-out-event', self._label_entry_cb)
self.pack_start(self.label_entry, True, True, 0)
button = ToolButton('close-tab')
button.connect('clicked', self.__button_clicked_cb)
self.pack_start(button, False, True, 0)
button.show()
self._close_button = button
tab_object.append(self)
示例10: __init__
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import connect [as 别名]
def __init__(self, calc):
Gtk.Toolbar.__init__(self)
copy_tool = ToolButton('edit-copy')
copy_tool.set_tooltip(_('Copy'))
copy_tool.set_accelerator(_('<ctrl>c'))
copy_tool.connect('clicked', lambda x: calc.text_copy())
self.insert(copy_tool, -1)
menu_item = MenuItem(_('Cut'))
try:
menu_item.set_accelerator(_('<ctrl>x'))
except AttributeError:
pass
menu_item.connect('activate', lambda x: calc.text_cut())
menu_item.show()
copy_tool.get_palette().menu.append(menu_item)
self.insert(IconToolButton('edit-paste', _('Paste'),
lambda x: calc.text_paste(),
alt_html='Paste'), -1)
self.show_all()
示例11: __init__
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import connect [as 别名]
def __init__(self, **kwargs):
Gtk.ToolItem.__init__(self)
help_button = ToolButton('toolbar-help')
help_button.set_tooltip(_('Ayuda / ÑepYsyrõ'))
self.add(help_button)
self._palette = help_button.get_palette()
sw = Gtk.ScrolledWindow()
sw.set_size_request(int(Gdk.Screen.width() / 2.8), 100)
sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
self._max_text_width = int(Gdk.Screen.width() / 3) - 600
self._vbox = Gtk.Box()
self._vbox.set_orientation(Gtk.Orientation.VERTICAL)
self._vbox.set_homogeneous(False)
self._vbox.set_border_width(10)
hbox = Gtk.Box()
hbox.pack_start(self._vbox, False, True, 0)
sw.add_with_viewport(hbox)
self._palette.set_content(sw)
sw.show_all()
help_button.connect('clicked', self.__help_button_clicked_cb)
示例12: WebToolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import connect [as 别名]
class WebToolbar(Gtk.Toolbar):
def __init__(self,browser):
self.logger = logging.getLogger("gvr.Widgets.WebToolbar")
Gtk.Toolbar.__init__(self)
self._browser = browser
self._back = ToolButton('go-previous')
self._back.set_tooltip(_('Go back one page'))
self._back.connect('clicked', self._go_back_cb)
self.insert(self._back, -1)
self._back.show()
self._forw = ToolButton('go-next')
self._forw.set_tooltip(_('Go one page forward'))
self._forw.connect('clicked', self._go_forward_cb)
self.insert(self._forw, -1)
self._forw.show()
def _go_forward_cb(self, button):
if self._browser.can_go_forward():
self._browser.go_forward()
def _go_back_cb(self, button):
if self._browser.can_go_back():
self._browser.go_back()
示例13: make_toolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import connect [as 别名]
def make_toolbar(self):
def make_separator(expand=False):
separator = Gtk.SeparatorToolItem()
if expand:
separator.set_expand(True)
separator.props.draw = False
return separator
toolbar_box = ToolbarBox()
self.set_toolbar_box(toolbar_box)
toolbar = toolbar_box.toolbar
activity_button = ActivityToolbarButton(self)
toolbar.insert(activity_button, -1)
toolbar.insert(make_separator(), -1)
button_add = ToolButton(Gtk.STOCK_ADD)
button_add.set_tooltip(_("Add a channel"))
button_add.connect("clicked", self._add_channel)
toolbar.insert(button_add, -1)
toolbar.insert(make_separator(True), -1)
stop_button = ToolButton("activity-stop")
stop_button.connect("clicked", self._exit)
stop_button.props.accelerator = "<Ctrl>Q"
toolbar.insert(stop_button, -1)
示例14: MainToolbar
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import connect [as 别名]
class MainToolbar(Gtk.Toolbar):
""" Main toolbar of the control panel
"""
__gtype_name__ = 'MainToolbar'
__gsignals__ = {
'stop-clicked': (GObject.SignalFlags.RUN_FIRST,
None,
([])),
'search-changed': (GObject.SignalFlags.RUN_FIRST,
None,
([str])),
}
def __init__(self):
Gtk.Toolbar.__init__(self)
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._search_entry.add_clear_button()
self._search_entry.set_width_chars(25)
text = _('Search in %s') % _('Settings')
self._search_entry.set_placeholder_text(text)
self._search_entry.connect('changed', self.__search_entry_changed_cb)
tool_item.add(self._search_entry)
self._search_entry.show()
self._add_separator(True)
self.stop = ToolButton(icon_name='dialog-cancel')
self.stop.set_tooltip(_('Done'))
self.stop.connect('clicked', self.__stop_clicked_cb)
self.stop.show()
self.insert(self.stop, -1)
self.stop.show()
def get_entry(self):
return self._search_entry
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.DEFAULT_SPACING, -1)
self.insert(separator, -1)
separator.show()
def __search_entry_changed_cb(self, search_entry):
self.emit('search-changed', search_entry.props.text)
def __stop_clicked_cb(self, button):
self.emit('stop-clicked')
示例15: __init__
# 需要导入模块: from sugar3.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar3.graphics.toolbutton.ToolButton import connect [as 别名]
def __init__(self, **kwargs):
GObject.GObject.__init__(self)
help_button = ToolButton('toolbar-help')
help_button.set_tooltip(_('Help'))
self.add(help_button)
self._palette = help_button.get_palette()
sw = Gtk.ScrolledWindow()
sw.set_size_request(int(Gdk.Screen.width() / 2.8),
Gdk.Screen.height() - style.GRID_CELL_SIZE * 3)
sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
self._max_text_width = int(Gdk.Screen.width() / 3) - 600
self._vbox = Gtk.Box()
self._vbox.set_orientation(Gtk.Orientation.VERTICAL)
self._vbox.set_homogeneous(False)
sw.add_with_viewport(self._vbox)
self._palette.set_content(sw)
sw.show_all()
help_button.connect('clicked', self.__help_button_clicked_cb)