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


Python RadioToolButton.set_named_icon方法代码示例

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


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

示例1: __init__

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import set_named_icon [as 别名]
    def __init__(self, owner):
        gtk.Toolbar.__init__(self)

        self.owner = owner

        self._insert_separator(True)

        self.desktop = []

        btn = RadioToolButton(group=None)
        btn.set_named_icon('jam-preset1')
        btn.connect('toggled', self.setDesktop, 0)
        btn.set_tooltip(_('Desktop 1'))
        self.insert(btn, -1)
        self.desktop.append(btn)

        for i in range(2, 11):
            btn = RadioToolButton(group=self.desktop[0])
            btn.set_named_icon('jam-preset%d' % i)
            btn.connect('toggled', self.setDesktop, i - 1)
            btn.set_tooltip(_('Desktop %d' % i))
            self.insert(btn, -1)
            self.desktop.append(btn)

        self._insert_separator(True)

        self.show_all()
开发者ID:fdanesse,项目名称:TamTam,代码行数:29,代码来源:Toolbars.py

示例2: _radio_button_factory

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import set_named_icon [as 别名]
 def _radio_button_factory(name='', toolbar=None, cb=None, arg=None,
                           tooltip=None, group=None):
     ''' Add a radio button to a toolbar '''
     button = RadioToolButton(group=group)
     button.set_named_icon(name)
     if cb is not None:
         if arg is None:
             button.connect('clicked', cb)
         else:
             button.connect('clicked', cb, arg)
     if toolbar is not None:
         toolbar.insert(button, -1)
     button.show()
     if tooltip is not None:
         button.set_tooltip(tooltip)
     return button
开发者ID:leonardcj,项目名称:tamtam,代码行数:18,代码来源:SynthLabToolbars.py

示例3: radio_factory

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import set_named_icon [as 别名]
def radio_factory(button_name, toolbar, callback, cb_arg=None, tooltip=None,
                  group=None):
    ''' Add a radio button to a toolbar '''
    button = RadioToolButton(group=group)
    button.set_named_icon(button_name)
    if callback is not None:
        if cb_arg is None:
            button.connect('clicked', callback)
        else:
            button.connect('clicked', callback, cb_arg)
    if hasattr(toolbar, 'insert'):  # Add button to the main toolbar...
        toolbar.insert(button, -1)
    else:  # ...or a secondary toolbar.
        toolbar.props.page.insert(button, -1)
    button.show()
    if tooltip is not None:
        button.set_tooltip(tooltip)
    return button
开发者ID:walterbender,项目名称:bulletinboard,代码行数:20,代码来源:toolbar_utils.py

示例4: __init__

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import set_named_icon [as 别名]
        def __init__(self, handle):
                activity.Activity.__init__(self, handle, True)

                self.max_participants = 1

                # ****** Editor ******

                self.editor = Editor()
                self.editor.connect("pep8-aviable", self.enable_pep8)
                self.editor.connect('language-changed', self.language_changed)
                
                self.editor.set_size_request(800, 790)
                scroll = gtk.ScrolledWindow()
                scroll.set_policy(gtk.POLICY_AUTOMATIC,
                                  gtk.POLICY_AUTOMATIC)
                scroll.add(self.editor)

                vbox = gtk.VBox()
                vpaned = gtk.VPaned()
                vbox.pack_start(vpaned, True, True, 0)
                vpaned.show()
                vpaned.pack1(scroll, resize=True)
                scroll.show_all()

                self.set_canvas(vbox)

                # ****** Toolbars ******

                self.toolbar_box = options.OptionWidget(self, self.editor.get_pango_context())
                self.toolbar_box.connect('open-from-journal', file_choosers.open_from_journal, None, self)
                self.toolbar_box.connect('open-file', self.open_file)
                self.toolbar_box.connect('save-file', self.save_file)
                self.toolbar_box.connect('save-as', self.save_file_as)
                self.toolbar_box.connect('new-file', self.new)
                self.toolbar_box.connect('pep8-check', self.pep8_check)
                self.toolbar_box.connect('insert-datetime', self.editor._insert_date_time)
                self.toolbar_box.connect('copy', self.editor._copy_cb)
                self.toolbar_box.connect('paste', self.editor._paste_cb)
                self.toolbar_box.connect('undo', self.editor._undo_cb)
                self.toolbar_box.connect('redo', self.editor._redo_cb)
                self.toolbar_box.connect('cut', self.editor._cut_cb)
                self.toolbar_box.connect('search-text', self._search_text)
                self.toolbar_box.connect('search-prev', self.editor._search_prev_cb)
                self.toolbar_box.connect('search-next', self.editor._search_next_cb)
                self.toolbar_box.connect('show-line-numbers', self.editor._set_show_line_numbers)
                self.toolbar_box.connect('language-changed', self.change_language)
                self.toolbar_box.connect('style-changed', self.change_style)
                self.toolbar_box.connect('font-changed', self.change_font)
                self.toolbar_box.show_all()
                self.set_toolbar_box(self.toolbar_box)
                
                # Barra de estado de PEP8 / PEP8 status bar
                self.pep8 = PEP8_Check()
                
                self.pep8_bar = gtk.Statusbar()
                self.pep8.connect("show-bar", (lambda w, bar: bar.show_all()), self.pep8_bar)
                self.pep8.connect("hide-bar", (lambda w, bar: bar.hide()), self.pep8_bar)
                self.pep8_bar.label = gtk.Label()
                self.pep8.connect("bar-text", (lambda w, t, l: l.set_text(t)), self.pep8_bar.label)
                self.pep8_bar.add(self.pep8_bar.label)
                vbox.pack_end(self.pep8_bar, False, True, 0)
                
                tray = VTray()
                self.test_notebook = gtk.Notebook()
                self.test_notebook.set_show_tabs(False)
                terminal = consoles.Terminal()
                terminal.show()
                terminal_item = RadioToolButton()
                terminal_item.set_named_icon("console-terminal")
                terminal_item.set_tooltip("Terminal")
                terminal_item.connect("toggled", self.page_changed, 0)
                terminal_item.show()
                self.test_notebook.append_page(terminal, None)
                tray.add_item(terminal_item)
                python_console = consoles.PythonConsole()
                python_console.show()
                python_item = RadioToolButton()
                python_item.set_named_icon("console-python")
                python_item.set_tooltip("Python Console")
                python_item.set_group(terminal_item)
                python_item.connect("toggled", self.page_changed, 1)
                python_item.show()
                self.test_notebook.append_page(python_console)
                tray.add_item(python_item)
                hbox = gtk.HBox()
                hbox.pack_start(tray, False, True, 0)
                hbox.pack_start(self.test_notebook)
                self.test_notebook.show()
                vpaned.pack2(hbox, resize=True)
                vpaned.show_all()
                tray.show()
                hbox.show()
                vbox.show_all()
开发者ID:aguzubiaga,项目名称:sugar-jamedit,代码行数:95,代码来源:activity.py

示例5: SensorToolbar

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import set_named_icon [as 别名]
class SensorToolbar(gtk.Toolbar):
    """ The toolbar for specifiying the sensor: sound, resitance, or
    voltage """

    LOWER = 0.0
    UPPER = 1.0
    STR_DC_R = (
        _(
            "Resistive sensor (connect sensor to pink 'Mic In' on left side \
of XO)"
        )
        + " "
    )
    STR_DC_V = (
        _(
            "Voltage sensor (connect sensor to pink 'Mic In' on left side \
of XO)"
        )
        + " "
    )
    STR_AC = _("Sound") + " "
    STR_RESISTANCE = _("Resistance") + " (" + _("Ohms") + ") "
    STR_VOLTAGE = _("Voltage") + " (" + _("Volts") + ") "
    STR_TIME = _("Time Base") + " "
    STR_FREQUENCY = _("Frequency Base") + " "
    STR_INVERT = " " + _("Invert") + " "
    STR_XAXIS_TEXT = _("X Axis Scale: 1 division = %(division)s %(unit)s")
    # TRANSLATORS: This is milli seconds.
    MS = _("ms")
    # TRANSLATORS: This is Hertz, so 1/second.
    HZ = _("Hz")

    def __init__(self, activity, channels):
        """ By default, start with resistance mode """

        gtk.Toolbar.__init__(self)

        self.activity = activity
        self._channels = channels
        self._lock_radio_buttons = False
        self._radio_button_pushed = False
        self.values = []
        for i in range(self._channels):
            self.values.append("")

        self.string_for_textbox = ""

        self.gain = 1.0
        self.y_mag = 3.0
        self.capture_gain = CAPTURE_GAIN
        self.mic_boost = MIC_BOOST

        self.mode = "sound"

        # Set up Time-domain Button
        self.time = RadioToolButton(group=None)
        self.time.set_named_icon("media-audio")
        self.insert(self.time, -1)
        self.time.set_tooltip(_("Sound"))
        self.time.connect("clicked", self.analog_resistance_voltage_mode_cb, "sound")

        # Set up Resistance Button
        self.resistance = RadioToolButton(group=self.time)
        self.resistance.set_named_icon("resistance")
        if _is_xo(self.activity.hw):
            self.insert(self.resistance, -1)
        self.resistance.show()
        self.resistance.set_tooltip(_("Resistance Sensor"))
        self.resistance.connect("clicked", self.analog_resistance_voltage_mode_cb, "resistance")

        # Set up Voltage Button
        self.voltage = RadioToolButton(group=self.time)
        self.voltage.set_named_icon("voltage")
        if _is_xo(self.activity.hw):
            self.insert(self.voltage, -1)
        self.voltage.set_tooltip(_("Voltage Sensor"))
        self.voltage.connect("clicked", self.analog_resistance_voltage_mode_cb, "voltage")

        separator = gtk.SeparatorToolItem()
        separator.props.draw = True
        self.insert(separator, -1)

        self._log_value = LOG_TIMER_VALUES[1]
        self.log_label = gtk.Label(self._log_to_string(self._log_value))
        toolitem = gtk.ToolItem()
        toolitem.add(self.log_label)
        self.insert(toolitem, -1)

        self._log_button = ToolButton("timer-10")
        self._log_button.set_tooltip(_("Select logging interval"))
        self._log_button.connect("clicked", self._log_selection_cb)
        self.insert(self._log_button, -1)
        self._setup_log_palette()

        # Set up Logging/Stop Logging Button
        self._record = ToolButton("media-record")
        self.insert(self._record, -1)
        self._record.set_tooltip(_("Start logging"))
        self._record.connect("clicked", self.record_control_cb)

#.........这里部分代码省略.........
开发者ID:quozl,项目名称:Measure,代码行数:103,代码来源:sensor_toolbar.py


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