当前位置: 首页>>代码示例>>Python>>正文


Python ToolButton.set_accelerator方法代码示例

本文整理汇总了Python中sugar.graphics.toolbutton.ToolButton.set_accelerator方法的典型用法代码示例。如果您正苦于以下问题:Python ToolButton.set_accelerator方法的具体用法?Python ToolButton.set_accelerator怎么用?Python ToolButton.set_accelerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sugar.graphics.toolbutton.ToolButton的用法示例。


在下文中一共展示了ToolButton.set_accelerator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_toolbar

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_accelerator [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()
开发者ID:markamber,项目名称:spacemath,代码行数:32,代码来源:TestActivity.py

示例2: __init__

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_accelerator [as 别名]
    def __init__(self, main_area):
        gtk.Toolbar.__init__(self)

        self._main_area = main_area

        tool = ToolButton('zoom-best-fit')
        tool.set_tooltip(_('Fit to window'))
        tool.set_accelerator(_('<ctrl>9'))
        tool.connect('clicked', self.__zoom_tofit_cb)
        self.insert(tool, -1)

        tool = ToolButton('zoom-original')
        tool.set_tooltip(_('Original size'))
        tool.set_accelerator(_('<ctrl>0'))
        tool.connect('clicked', self.__zoom_original_cb)
        self.insert(tool, -1)

        tool = ToolButton('zoom-out')
        tool.set_tooltip(_('Zoom out'))
        tool.set_accelerator(_('<ctrl>minus'))
        tool.connect('clicked', self.__zoom_out_cb)
        self.insert(tool, -1)

        tool = ToolButton('zoom-in')
        tool.set_tooltip(_('Zoom in'))
        tool.set_accelerator(_('<ctrl>equal'))
        tool.connect('clicked', self.__zoom_in_cb)
        self.insert(tool, -1)

        self.show_all()
开发者ID:Daksh,项目名称:Labyrinth,代码行数:32,代码来源:labyrinthactivity.py

示例3: Explorer

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_accelerator [as 别名]
class Explorer(activity.Activity):
    '''Es la clase que crea la actividad'''
    def __init__(self, handle):
        activity.Activity.__init__(self, handle, True)

        # ToolbarBox:

        toolbarbox = ToolbarBox()
        activitybutton = ActivityButton(self)
        toolbarbox.toolbar.insert(activitybutton, 0)

        separator = gtk.SeparatorToolItem()
        toolbarbox.toolbar.insert(separator, -1)

        explorer_btn = RadioToolButton()
        explorer_btn.set_tooltip('Explorador')
        explorer_btn.props.icon_name = 'activity-explorer'
        toolbarbox.toolbar.insert(explorer_btn, -1)

        self._goup = ToolButton('to-subjects')
        self._goup.connect('clicked', self._go_up_clicked)
        self._goup.set_tooltip('Ver Materias')
        self._goup.set_accelerator("<Shift><M>")
        self._goup.set_sensitive(False)
        toolbarbox.toolbar.insert(self._goup, -1)

        self._select_all = ToolButton('select-all')
        self._select_all.set_tooltip('Seleccionar todo')
        self._select_all.connect("clicked", self._select_all_clicked)
        self._select_all.set_sensitive(False)
        toolbarbox.toolbar.insert(self._select_all, -1)

        self._download = ToolButton('download')
        self._download.set_tooltip('Descargar')
        self._download.set_sensitive(False)
        toolbarbox.toolbar.insert(self._download, -1)

        separator = gtk.SeparatorToolItem()
        toolbarbox.toolbar.insert(separator, -1)

        homework_btn = RadioToolButton()
        homework_btn.set_tooltip('Tareas Domiciliarias')
        homework_btn.props.icon_name = 'homework'
        homework_btn.props.group = explorer_btn

        toolbarbox.toolbar.insert(homework_btn, -1)

        open_btn = ToolButton()
        open_btn.set_tooltip('Seleccionar tarea')
        open_btn.props.icon_name = 'open-from-journal'
        open_btn.set_sensitive(False)
        open_btn.connect("clicked", self._select_hw_from_journal)
        toolbarbox.toolbar.insert(open_btn, -1)

        self._send = ToolButton()
        self._send.set_tooltip('Enviar tarea')
        self._send.connect('clicked', self._send_hw_to_server)
        self._send.props.icon_name = 'document-send'
        self._send.set_sensitive(False)
        toolbarbox.toolbar.insert(self._send, -1)

        homework_btn.connect('clicked', self.homework_btn_cb, open_btn)
        explorer_btn.connect('clicked', self.explorer_btn_cb, open_btn)

        separator = gtk.SeparatorToolItem()
        separator.set_expand(True)
        separator.set_draw(False)
        toolbarbox.toolbar.insert(separator, -1)

        stopbtn = StopButton(self)
        toolbarbox.toolbar.insert(stopbtn, -1)

        self.set_toolbar_box(toolbarbox)
        self._one_alert = None

        # Canvas
        self._canvas = gtk.EventBox()
        self._name = ''
        self._last_name = ''
        self._hw_title = ''
        self._hw_description = ''
        self._hw_path = ''
        self._hw_mimetype = ''

        self.set_canvas(self._canvas)
        self.show_all()
        if not utils.get_group():
            self.choose_group()
        else:
            self._do_canvas()

    def homework_btn_cb(self, button, open_btn):
        '''Se ejecuta cuando se hace click en el boton
        de tareas domiciliarias, se encarga de cambiar de pagina'''
        self._notebook.set_current_page(2)
        self._goup.set_sensitive(False)
        self._select_all.set_sensitive(False)
        self._download.set_sensitive(False)
        open_btn.set_sensitive(True)
        self._send.set_sensitive(False)
#.........这里部分代码省略.........
开发者ID:aulavirtual,项目名称:explorador,代码行数:103,代码来源:activity.py

示例4: build_calibrate_toolbar

# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import set_accelerator [as 别名]
    def build_calibrate_toolbar(self, toolbox):

        calibrate_bar = gtk.Toolbar()

        item1 = gtk.ToolItem()
        label1 = gtk.Label()
        label1.set_text(' ' + _('Calibrate/Follow') + ' ')
        item1.add(label1)
        calibrate_bar.insert(item1, -1)

        stop_calibrate = ToolButton('media-playback-stop')
        stop_calibrate.set_tooltip(_('Stop'))
        stop_calibrate.set_accelerator('<ctrl>space')
        stop_calibrate.connect('clicked', self.stop_execute)
        calibrate_bar.insert(stop_calibrate, -1)

        separator1 = gtk.SeparatorToolItem()
        separator1.props.draw = True
        calibrate_bar.insert(separator1, -1)

        item3 = gtk.ToolItem()
        self.label_color_red = gtk.Label()
        self.label_color_red.set_text(' ' + _('Calibrated color:') + ' ' + _('Red') + ' ')
        item3.add(self.label_color_red)
        calibrate_bar.insert(item3, -1)

        item4 = gtk.ToolItem()
        self.red_spin = gtk.SpinButton()
        self.red_spin.set_range(0, 255)
        self.red_spin.set_increments(1, 10)
        self.red_spin.props.value = self.colorC[0]
        self.red_spin.connect('notify::value', self.red_spin_color)
        item4.add(self.red_spin)
        calibrate_bar.insert(item4, -1)

        item5 = gtk.ToolItem()
        self.label_color_green = gtk.Label()
        self.label_color_green.set_text(' ' + _('Green') + ' ')
        item5.add(self.label_color_green)
        calibrate_bar.insert(item5, -1)

        item6 = gtk.ToolItem()
        self.green_spin = gtk.SpinButton()
        self.green_spin.set_range(0, 255)
        self.green_spin.set_increments(1, 10)
        self.green_spin.props.value = self.colorC[1]
        self.green_spin.connect('notify::value', self.green_spin_color)
        item6.add(self.green_spin)
        calibrate_bar.insert(item6, -1)

        item7 = gtk.ToolItem()
        self.label_color_blue = gtk.Label()
        self.label_color_blue.set_text(' ' + _('Blue') + ' ')
        item7.add(self.label_color_blue)
        calibrate_bar.insert(item7, -1)

        item8 = gtk.ToolItem()
        self.blue_spin = gtk.SpinButton()
        self.blue_spin.set_range(0, 255)
        self.blue_spin.set_increments(1, 10)
        self.blue_spin.props.value = self.colorC[2]
        self.blue_spin.connect('notify::value', self.blue_spin_color)
        item8.add(self.blue_spin)
        calibrate_bar.insert(item8, -1)

        calibrate_bar.show_all()
        calibrate_button = ToolbarButton(label=_('Calibrate'),
                page=calibrate_bar,
                icon_name='preferences-system')
        toolbox.toolbar.insert(calibrate_button, -1)
        calibrate_button.show()
开发者ID:rbuj,项目名称:followme,代码行数:73,代码来源:activity.py


注:本文中的sugar.graphics.toolbutton.ToolButton.set_accelerator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。