本文整理汇总了Python中sugar.graphics.toolbutton.ToolButton类的典型用法代码示例。如果您正苦于以下问题:Python ToolButton类的具体用法?Python ToolButton怎么用?Python ToolButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ToolButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ActivityToolbarXO2XO
class ActivityToolbarXO2XO(gtk.Toolbar):
def __init__(self, activity, orientation_left=False):
gtk.Toolbar.__init__(self)
self._activity = activity
if orientation_left == False:
separator = gtk.SeparatorToolItem()
separator.props.draw = False
separator.set_expand(True)
self.insert(separator,-1)
separator.show()
self._object_insert = ToolButton('object-insert')
self.insert(self._object_insert, -1)
self._object_insert.show()
self.stop = StopButton(activity)
self.insert(self.stop, -1)
self.stop.show()
self._object_insert.connect('clicked', self.insertImage, activity)
def insertImage(self, widget, activity):
self._activity = activity
chooser = ObjectChooser('Choose image', self._activity,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
try:
result = chooser.run()
if result == gtk.RESPONSE_ACCEPT:
jobject = chooser.get_selected_object()
if jobject and jobject.file_path:
self._activity.toUploadChosen(jobject.file_path)
finally:
chooser.destroy()
del chooser
示例2: __init__
def __init__(self, web_view):
gobject.GObject.__init__(self)
self._web_view = web_view
self._back = ToolButton("go-previous-paired")
self._back.set_tooltip(_("Back"))
self._back.props.sensitive = False
self._back.connect("clicked", self._go_back_cb)
self.insert(self._back, -1)
self._back.show()
self._forward = ToolButton("go-next-paired")
self._forward.set_tooltip(_("Forward"))
self._forward.props.sensitive = False
self._forward.connect("clicked", self._go_forward_cb)
self.insert(self._forward, -1)
self._forward.show()
self._home = ToolButton("go-home")
self._home.set_tooltip(_("Home"))
self._home.connect("clicked", self._go_home_cb)
self.insert(self._home, -1)
self._home.show()
progress_listener = self._web_view.progress
progress_listener.connect("location-changed", self._location_changed_cb)
progress_listener.connect("loading-stop", self._loading_stop_cb)
示例3: ReadToolbar
class ReadToolbar(gtk.Toolbar):
'''
TODO:
* the toolbutton's sensitivity depends on context
'''
canvas = ReadCanvas
def __init__(self, activity):
gtk.Toolbar.__init__(self)
self._activity = activity
self._sendreceive_button = ToolButton('send-and-receive', tooltip=_('Send/receive email'))
self._sendreceive_button.connect('clicked', self._sendreceive_cb)
self.insert(self._sendreceive_button, -1)
self.show_all()
'''
self._reply_button = ToolButton('reply', tooltip=_('Write a reply'))
self._reply_button.connect('clicked', self._reply_msg_cb)
self.insert(self._reply_button, -1)
self._forward_button = ToolButton('forward', tooltip=_('Forward this message'))
self._forward_button.connect('clicked', self._forward_msg_cb)
self.insert(self._forward_button, -1)
'''
def _sendreceive_cb(self, *args):
sweetmail.mailactivity.run_bgsrt_once(self._activity)
def _reply_msg_cb(self, *args):
pass
def _forward_msg_cb(self, *args):
pass
示例4: TitleBox
class TitleBox(VolumesToolbar):
__gtype_name__ = 'TitleBox'
def __init__(self):
VolumesToolbar.__init__(self)
label = gtk.Label()
label.set_markup('<b>%s</b>' % _('Choose an object'))
label.set_alignment(0, 0.5)
self._add_widget(label, expand=True)
self.close_button = ToolButton(icon_name='dialog-cancel')
self.close_button.set_tooltip(_('Close'))
self.insert(self.close_button, -1)
self.close_button.show()
def _add_widget(self, widget, expand=False):
tool_item = gtk.ToolItem()
tool_item.set_expand(expand)
tool_item.add(widget)
widget.show()
self.insert(tool_item, -1)
tool_item.show()
示例5: __init__
def __init__(self):
gtk.Toolbar.__init__(self)
self._zoom_out = ToolButton('zoom-out')
self._zoom_out.set_tooltip(_('Zoom out'))
self._zoom_out.connect('clicked', self._zoom_out_cb)
self.insert(self._zoom_out, -1)
self._zoom_out.props.sensitive = False
self._zoom_out.show()
self._zoom_in = ToolButton('zoom-in')
self._zoom_in.set_tooltip(_('Zoom in'))
self._zoom_in.connect('clicked', self._zoom_in_cb)
self.insert(self._zoom_in, -1)
self._zoom_in.props.sensitive = True
self._zoom_in.show()
spacer = gtk.SeparatorToolItem()
spacer.props.draw = False
self.insert(spacer, -1)
spacer.show()
self._fullscreen = ToolButton('view-fullscreen')
self._fullscreen.set_tooltip(_('Fullscreen'))
self._fullscreen.connect('clicked', self._fullscreen_cb)
self.insert(self._fullscreen, -1)
self._fullscreen.show()
示例6: _add_speed_slider
def _add_speed_slider(self, toolbar):
self._speed_stepper_down = ToolButton("speed-down")
self._speed_stepper_down.set_tooltip(_("Slow down"))
self._speed_stepper_down.connect("clicked", self._speed_stepper_down_cb)
self._speed_stepper_down.show()
self._adjustment = gtk.Adjustment(200, self.LOWER, self.UPPER, 25, 100, 0)
self._adjustment.connect("value_changed", self._speed_change_cb)
self._speed_range = gtk.HScale(self._adjustment)
self._speed_range.set_inverted(True)
self._speed_range.set_draw_value(False)
self._speed_range.set_update_policy(gtk.UPDATE_CONTINUOUS)
self._speed_range.set_size_request(120, 15)
self._speed_range.show()
self._speed_stepper_up = ToolButton("speed-up")
self._speed_stepper_up.set_tooltip(_("Speed up"))
self._speed_stepper_up.connect("clicked", self._speed_stepper_up_cb)
self._speed_stepper_up.show()
self._speed_range_tool = gtk.ToolItem()
self._speed_range_tool.add(self._speed_range)
self._speed_range_tool.show()
toolbar.insert(self._speed_stepper_down, -1)
toolbar.insert(self._speed_range_tool, -1)
toolbar.insert(self._speed_stepper_up, -1)
return
示例7: __init__
def __init__(self):
gtk.Toolbar.__init__(self)
self._add_separator()
self._icon = Icon()
self._add_widget(self._icon)
self._add_separator()
self._title = gtk.Label()
self._add_widget(self._title)
self._add_separator(True)
self.cancel_button = ToolButton('dialog-cancel')
self.cancel_button.set_tooltip(_('Cancel'))
self.cancel_button.connect('clicked', self.__cancel_button_clicked_cb)
self.insert(self.cancel_button, -1)
self.cancel_button.show()
self.accept_button = ToolButton('dialog-ok')
self.accept_button.set_tooltip(_('Ok'))
self.accept_button.connect('clicked', self.__accept_button_clicked_cb)
self.insert(self.accept_button, -1)
self.accept_button.show()
示例8: add_frequency_slider
def add_frequency_slider(self, toolbox):
""" Either on the Sound toolbar or the Main toolbar """
self._freq_stepper_up = ToolButton("freq-high")
self._freq_stepper_up.set_tooltip(_("Zoom out"))
self._freq_stepper_up.connect("clicked", self._freq_stepper_up_cb)
self._freq_stepper_up.show()
self.activity.adjustmentf = gtk.Adjustment(0.5, self.LOWER, self.UPPER, 0.01, 0.1, 0)
self.activity.adjustmentf.connect("value_changed", self.cb_page_sizef)
self._freq_range = gtk.HScale(self.activity.adjustmentf)
self._freq_range.set_inverted(True)
self._freq_range.set_draw_value(False)
self._freq_range.set_update_policy(gtk.UPDATE_CONTINUOUS)
self._freq_range.set_size_request(120, 15)
self._freq_range.show()
self._freq_stepper_down = ToolButton("freq-low")
self._freq_stepper_down.set_tooltip(_("Zoom in"))
self._freq_stepper_down.connect("clicked", self._freq_stepper_down_cb)
self._freq_stepper_down.show()
self._freq_range_tool = gtk.ToolItem()
self._freq_range_tool.add(self._freq_range)
self._freq_range_tool.show()
toolbox.add(self._freq_stepper_up)
toolbox.add(self._freq_range_tool)
toolbox.add(self._freq_stepper_down)
return
示例9: __init__
def __init__(self, activity):
gtk.Toolbar.__init__(self)
self.activity = activity
self._lock = True
# New Button
new_icon = join(dirname(__file__), 'images', 'game-new.svg')
new_image = gtk.Image()
new_image.set_from_file(new_icon)
self._new_button = ToolButton()
self._new_button.set_icon_widget(new_image)
self._new_button.set_tooltip(_('New game'))
self._new_button.connect('clicked', self._new_game_bt)
self._add_widget(self._new_button)
# Load Button
load_icon = join(dirname(__file__), 'images', 'game-load.svg')
load_image = gtk.Image()
load_image.set_from_file(load_icon)
self._load_button = ToolButton()
self._load_button.set_icon_widget(load_image)
self._load_button.set_tooltip(_('Load game'))
self._load_button.connect('clicked', self._load_game)
self._add_widget(self._load_button)
# Save Button
save_icon = join(dirname(__file__), 'images', 'game-save.svg')
save_image = gtk.Image()
save_image.set_from_file(save_icon)
self._save_button = ToolButton()
self._save_button.set_icon_widget(save_image)
self._save_button.set_tooltip(_('Save game'))
self._save_button.connect('clicked', self._save_game_bt)
self._save_button.set_sensitive(False)
self._add_widget(self._save_button)
# Separator
separator2 = gtk.SeparatorToolItem()
separator2.set_draw(True)
self.insert(separator2, -1)
self._add_widget(gtk.Label(_('Game name') + ': '))
self.game_name_entry = gtk.Entry()
self._add_widget(self.game_name_entry)
self._equal_pairs = gtk.CheckButton(_('Equal pairs'))
self._add_widget(self._equal_pairs)
self._equal_pairs.connect('toggled', self._emit_equal_pairs)
self._grouped_icon1 = join(dirname(__file__), 'images', 'equal_pairs1.svg')
self._grouped_icon2 = join(dirname(__file__), 'images', 'equal_pairs2.svg')
self._grouped_image1 = gtk.Image()
self._grouped_image2 = gtk.Image()
self._grouped_image1.set_from_file(self._grouped_icon1)
self._grouped_image2.set_from_file(self._grouped_icon2)
self._grouped = ToggleToolButton()
self._grouped.set_icon_widget(self._grouped_image1)
self._grouped.set_tooltip(_('Click for grouped game'))
self._grouped.connect('toggled', self._grouped_cb)
self._add_widget(self._grouped)
示例10: WriteToolbar
class WriteToolbar(gtk.Toolbar):
canvas = WriteCanvas
def __init__(self, activity):
gtk.Toolbar.__init__(self)
self._activity = activity
self._send_button = ToolButton('send-email', tooltip=_('Send email'))
self._send_button.connect('clicked', self.__send_email_cb)
self.insert(self._send_button, -1)
self._attach_button = ToolButton('add-attachment', tooltip=_('Add attachment'))
self._attach_button.connect('clicked', self.__add_attachment_cb)
self.insert(self._attach_button, -1)
self.show_all()
def __send_email_cb(self, *args):
msg = self._activity.canvas.make_msg()
if utility.check_online():
func = self._activity.config.transport_account.send
args = ([msg], OutboundTracker(self._activity))
thread.start_new_thread(func, args)
else:
self._keep_as_outbound(msg)
self._activity.toolbox.current_toolbar = 1 # egh
def __add_attachment_cb(self, *args):
pass
示例11: __init__
def __init__(self, handle):
gtk.Toolbar.__init__(self)
self.handle = handle
#Tytuł pola tekstowego
self.add_widget(gtk.Label("Id testu: "))
#Pole tekstowe
self.test_entry = gtk.Entry()
self.test_entry.set_size_request(200,25)
self.test_entry.set_text('709rqd')
self.add_widget(self.test_entry)
#Separator
separator = gtk.SeparatorToolItem()
separator.set_draw(True)
separator.set_size_request(50,25)
self.add_widget(separator)
#Tytuł pola tekstowego
self.add_widget(gtk.Label("Hasło: "))
#Pole tekstowe
self.pass_entry = gtk.Entry()
self.pass_entry.set_size_request(300,25)
# self.pass_entry.set_text('123123')
self.add_widget(self.pass_entry)
#Przycisk pobierania
download_button = ToolButton("download")
download_button.set_tooltip("Pobierz test")
download_button.connect("clicked", handle.get_test_bt)
self.add_widget(download_button)
示例12: destroy
def destroy(self):
del self._toolbar.bookmarklets[self._name]
if len(self._toolbar.bookmarklets) == 0:
self._toolbar.destroy()
ToolButton.destroy(self)
示例13: __init__
def __init__(self, act):
gtk.Toolbar.__init__(self)
self._activity = act
self._back = ToolButton('go-previous-paired')
self._back.set_tooltip(_('Back'))
self._back.props.sensitive = False
self._back.connect('clicked', self.__go_back_cb)
self.insert(self._back, -1)
self._back.show()
self._entry = gtk.Entry()
self._entry.set_text(self._activity.DEFAULT_FEED_URI)
self._entry.connect('activate', self.__entry_activate_cb)
entry_item = gtk.ToolItem()
entry_item.set_expand(True)
entry_item.add(self._entry)
self.insert(entry_item, -1)
self._entry.show()
self._refresh = ToolButton('view-refresh')
self._refresh.set_tooltip(_('Refresh'))
self._refresh.connect('clicked', self.__refresh_cb)
self.insert(self._refresh, -1)
self._refresh.show()
self._send = ToolButton('activity-journal')
self._send.set_tooltip(_('Send'))
self._send.connect('clicked', self.__send_cb)
self.insert(self._send, -1)
self._send.show()
示例14: __init__
def __init__(self, handle):
activity.Activity.__init__(self, handle)
self.toolbox = activity.ActivityToolbox(self)
activity_toolbar = self.toolbox.get_activity_toolbar()
activity_toolbar.share.props.visible = False
activity_toolbar.keep.props.visible = False
go_up = ToolButton("gtk-go-up")
go_up.props.tooltip = _("Go Up")
go_up.show()
activity_toolbar.insert(go_up, 2)
refresh = ToolButton("gtk-refresh")
refresh.props.tooltip = _("Refresh")
refresh.show()
activity_toolbar.insert(refresh, 2)
self.set_toolbox(self.toolbox)
self.toolbox.show()
widget = filemanager.Widget()
go_up.connect("clicked", self.go_up_callback, widget)
refresh.connect("clicked", self.refresh_callback, widget)
widget.show()
current_directory = gio.File(path=os.environ["HOME"])
widget.set_current_directory(current_directory.get_uri())
widget.connect("file-menu", self.file_menu)
widget.connect('current-directory-menu', self.current_directory_menu)
self.set_canvas(widget)
self.show()
示例15: __init__
def __init__(self):
gtk.Toolbar.__init__(self)
self.undo = ToolButton('edit-undo')
self.undo.set_tooltip(_('Undo'))
self.insert(self.undo, -1)
self.undo.show()
self.redo = ToolButton('edit-redo')
self.redo.set_tooltip(_('Redo'))
self.insert(self.redo, -1)
self.redo.show()
self.separator = gtk.SeparatorToolItem()
self.separator.set_draw(True)
self.insert(self.separator, -1)
self.separator.show()
self.copy = ToolButton('edit-copy')
self.copy.set_tooltip(_('Copy'))
self.insert(self.copy, -1)
self.copy.show()
self.paste = ToolButton('edit-paste')
self.paste.set_tooltip(_('Paste'))
self.insert(self.paste, -1)
self.paste.show()