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


Python RadioToolButton.show方法代码示例

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


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

示例1: _radio_button_factory

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import show [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

示例2: __init__

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

        self._add_separator()

        activity_bundle = ActivityBundle(bundle_path)
        file_name = activity_bundle.get_icon()

        if document_path is not None and os.path.exists(document_path):
            document_button = DocumentButton(file_name, document_path, title)
            document_button.connect('toggled', self.__button_toggled_cb, 
                                    document_path)
            self.insert(document_button, -1)
            document_button.show()
            self._add_separator()

        if bundle_path is not None and os.path.exists(bundle_path):
            activity_button = RadioToolButton()
            icon = Icon(file=file_name,
                        icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR,
                        fill_color=style.COLOR_TRANSPARENT.get_svg(),
                        stroke_color=style.COLOR_WHITE.get_svg())
            activity_button.set_icon_widget(icon)
            icon.show()
            if document_path is not None:
                activity_button.props.group = document_button
            activity_button.props.tooltip = _('Activity Bundle Source')
            activity_button.connect('toggled', self.__button_toggled_cb, 
                                    bundle_path)
            self.insert(activity_button, -1)
            activity_button.show()
            self._add_separator()

        text = _('View source: %r') % title
        label = gtk.Label()
        label.set_markup('<b>%s</b>' % text)
        label.set_alignment(0, 0.5)
        self._add_widget(label)

        self._add_separator(True)
        
        stop = ToolButton(icon_name='dialog-cancel')
        stop.set_tooltip(_('Close'))
        stop.connect('clicked', self.__stop_clicked_cb)
        stop.show()
        self.insert(stop, -1)
        stop.show()
开发者ID:lucian1900,项目名称:Webified,代码行数:49,代码来源:viewsource.py

示例3: _add_button

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
    def _add_button(self, icon_name, label, accelerator, zoom_level):
        if self.get_children():
            group = self.get_children()[0]
        else:
            group = None

        button = RadioToolButton(named_icon=icon_name, group=group, accelerator=accelerator)
        button.connect("clicked", self.__level_clicked_cb, zoom_level)
        self.add(button)
        button.show()

        palette = Palette(glib.markup_escape_text(label))
        palette.props.invoker = FrameWidgetInvoker(button)
        palette.set_group_id("frame")
        button.set_palette(palette)

        return button
开发者ID:nemesiscodex,项目名称:jarabe,代码行数:19,代码来源:zoomtoolbar.py

示例4: radio_factory

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import show [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

示例5: get_toolbar

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
 def get_toolbar(self):
     toolbar = gtk.Toolbar()
     
     radio_adv = RadioToolButton()
     radio_adv.set_active(True)
     radio_adv.set_label("Avanzada")
     radio_adv.set_tooltip("Mostrar biblioteca avanzada")
     radio_adv.connect("clicked", self.switch, "advanced")
     toolbar.insert(radio_adv, -1)
     radio_adv.show()
     
     radio_bas = RadioToolButton(group=radio_adv)
     radio_bas.set_label("Simple")
     radio_bas.set_tooltip("Mostrar biblioteca sencilla")
     radio_bas.connect("clicked", self.switch, "basic")
     toolbar.insert(radio_bas, -1)
     
     toolbar.show_all()
     
     return toolbar
开发者ID:pmoleri,项目名称:saludame,代码行数:22,代码来源:content_window.py

示例6: build_toolbar

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
    def build_toolbar(self):        
        # make a toolbox
        toolbox = activity.ActivityToolbox(self)
         
        # modify the Activity tab
        activity_toolbar = toolbox.get_activity_toolbar()
        activity_toolbar.share.props.visible = False
        self.blocklist = [] 
        # make a 'create' toolbar
        create_toolbar = gtk.Toolbar()
        
        # make + add the component buttons
        self.radioList = {}
        for c in tools.allTools:                             
            button = RadioToolButton(named_icon=c.icon)
            button.set_tooltip(_(c.toolTip))
            button.connect('clicked',self.radioClicked)
            create_toolbar.insert(button,-1)    
            button.show()
            self.radioList[button] = c.name

        # add the toolbars to the toolbox
        toolbox.add_toolbar("Create",create_toolbar)
        create_toolbar.show()

        # add a ILF specific toolbar which gives feedback about problems
        #ilf_toolbar = gtk.Toolbar()
        #self.ilf_label = gtk.Label("test")
        #ilf_toolbar.insert_widget(self.ilf_label, "testlabel", None, -1)
        #self.ilf_label.show()
        #toolbox.add_toolbar("ILF", ilf_toolbar)
        #ilf_toolbar.show()
       
        
        toolbox.show()
        self.set_toolbox(toolbox)
        toolbox.set_current_toolbar(1)
        return activity_toolbar
开发者ID:kaserf,项目名称:PhysicsILF,代码行数:40,代码来源:activity.py

示例7: Activity

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
class Activity(sugar.activity.activity.Activity):
    def __init__(self, handle):
        super(Activity, self).__init__(handle)
        self.paused = False

        watch = gtk.gdk.Cursor(gtk.gdk.WATCH)
        self.window.set_cursor(watch)

        self.p = gtk.VPaned()
        self.p.connect("notify::position", self.redraw)
        self.box = gtk.Notebook()
        self.p.pack2(self.box)
        self.p.show()
        self.box.set_show_tabs(False)

        self.splash = gtk.Image()
        pixbuf = gtk.gdk.pixbuf_new_from_file("images/splash_comodo.png")
        screen = self.window.get_screen()
        width, height = screen.get_width(), screen.get_height() - style.GRID_CELL_SIZE
        pixbuf = pixbuf.scale_simple(width, height, gtk.gdk.INTERP_BILINEAR)
        self.splash.set_from_pixbuf(pixbuf)
        self.splash.show()
        eb = gtk.EventBox()
        eb.add(self.splash)
        eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
        eb.show()
        self.box.append_page(eb, gtk.Label("Inicio"))

        self._pygamecanvas = sugargame2.canvas.PygameCanvas(self)
        self._pygamecanvas.set_flags(gtk.EXPAND)
        self._pygamecanvas.set_flags(gtk.FILL)

        self.connect("visibility-notify-event", self.redraw)
        self._pygamecanvas.set_events(gtk.gdk.BUTTON_PRESS_MASK)
        self._pygamecanvas.connect("button-press-event", self._pygamecanvas.grab_focus)
        self.box.append_page(self._pygamecanvas, gtk.Label("Juego"))

        self.box.show()
        self.set_canvas(self.p)

        gobject.timeout_add(300, self.pump)
        gobject.timeout_add(2000, self.init_interpreter)
        #gobject.timeout_add(1000, self.build_editor)
        gobject.timeout_add(1500, self.check_modified)

        self.build_toolbar()
        self.credits = None
        self.editor = None
        #self.reader = None
        self._pygamecanvas.run_pygame(self.run_game)

    def redraw(self, widget=None, b=None, c=None):
        scene = spyral.director.get_scene()
        if scene:
            scene.redraw()

    def alert(self, title=None, text=None, delay=5):
        alert = NotifyAlert(delay)
        alert.props.title = title
        alert.props.msg = text
        self.add_alert(alert)
        alert.connect('response', self._alert_ok)
        alert.show()

    def _alert_ok(self, alert, *args):
        self.remove_alert(alert)

    def check_modified(self):
        if self.box.current_page()==2:
            if not self.save_button.get_sensitive():
                if self.editor.modificado():
                    self.save_button.set_sensitive(True)
                    return False
        return True

    def pump(self):
        # Esto es necesario porque sino pygame acumula demasiados eventos.
        pygame.event.pump()

    def focus_interpreter(self, widget, event):
        self._interpreter.text.grab_focus()
        return True

    def init_interpreter(self):
        # diferido unos segundos para evitar ver errores superfluos al iniciar
        self._interpreter = GTKInterpreterConsole(self.redraw)
        self._interpreter.text.connect('button-press-event', self.focus_interpreter)
        self.p.pack1(self._interpreter)
        return False

    def open_file(self, widget, path):
        if path:
            if not os.path.isdir(path):
                self.editor.open_file(widget, path)

    def save_file(self, widget):
        if self.editor.modificado():
            self.save_button.set_sensitive(False)
            self.editor.save_file()
            filename = self.editor.current_file()
#.........这里部分代码省略.........
开发者ID:i5o,项目名称:comodo-dragon-activity,代码行数:103,代码来源:activity.py

示例8: build_toolbar

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import show [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()

        tool_group = None

        self.game_button = RadioToolButton()
        self.game_button.props.icon_name = 'gamecanvas'
        self.game_button.set_tooltip(_('Juego'))
        self.game_button.accelerator = "<Ctrl>1"
        self.game_button.props.group = tool_group
        self.game_button.connect('clicked', self.show_game)
        toolbar_box.toolbar.insert(self.game_button, -1)
        self.game_button.show()
        tool_group = self.game_button

        button = RadioToolButton()
        button.props.icon_name = 'view-source'
        button.set_tooltip(_('Editor'))
        button.accelerator = "<Ctrl>2"
        button.props.group = tool_group
        button.connect('clicked', self.show_editor)
        toolbar_box.toolbar.insert(button, -1)
        button.show()

        self.save_button = ToolButton('dialog-ok')
        self.save_button.set_tooltip(_('Guardar'))
        self.save_button.accelerator = "<Ctrl>s"
        self.save_button.connect('clicked', self.save_file)
        self.save_button.set_sensitive(False)
        toolbar_box.toolbar.insert(self.save_button, -1)
        self.save_button.show()

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

        button = ToolButton('system-restart')
        button.set_tooltip(_('Reiniciar juego'))
        button.accelerator = "<Alt><Shift>r"
        button.connect('clicked', self.restart_game)
        toolbar_box.toolbar.insert(button, -1)
        button.show()

        self.editor_button = ToolButton('sources')
        self.editor_button.set_tooltip(_('Consola'))
        self.editor_button.accelerator = "<Ctrl>grave"
        self.editor_button.connect('clicked', self.toggle_console)
        toolbar_box.toolbar.insert(self.editor_button, -1)
        self.editor_button.show()

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

        button = helpbutton.HelpButton(self)
        toolbar_box.toolbar.insert(button, -1)
        button.show()

        button = ToolButton()
        button.props.icon_name = 'activity-about'
        button.set_tooltip(_('Acerca de'))
        button.accelerator = "<Ctrl>i"
        button.connect('clicked', self.run_credits)
        toolbar_box.toolbar.insert(button, -1)
        button.show()

        # 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:i5o,项目名称:comodo-dragon-activity,代码行数:85,代码来源:activity.py

示例9: __init__

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import show [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

示例10: Activity

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

        self.build_toolbar()
        self.build_editor()

        self.p = gtk.VPaned()
        self.set_canvas(self.p)
        self.p.pack2(self.h)
        
        self.console = gtk.Notebook()
        self.init_interpreter()
        self.console.append_page(self.interpreter)
        self.p.pack1(self.console)

        self.fugit = Fugit(".")
        self.console.append_page(self.fugit.widget)
        self.show_all()


    def alert(self, title=None, text=None, delay=5):
        alert = NotifyAlert(delay)
        alert.props.title = title
        alert.props.msg = text
        self.add_alert(alert)
        alert.connect('response', self._alert_ok)
        alert.show()

    def _alert_ok(self, alert, *args):
        self.remove_alert(alert)

    def init_interpreter(self):
        frame = self.get_frame()
        self.interpreter = GTKInterpreterConsole(frame)
        self.interpreter.text.connect('button-press-event', self.focus_interpreter)
        return False

    def focus_interpreter(self, widget, event):
        self.interpreter.text.grab_focus()
        return True

    def get_frame(self):
        # esto es necesario para que la consola funcione
        try:
            raise None
        except:
            frame = sys.exc_info()[2].tb_frame
        return frame

    def open_file(self, widget, path):
        if path:
            if not os.path.isdir(path):
                self.editor.open_file(widget, path)

    def save_file(self, widget):
        if self.editor.modificado():
            self.editor.save_file()
            filename = self.editor.current_file()
            self.alert(filename, "Archivo guardado.")

    def build_editor(self):
        self.h = gtk.HPaned()
        self.tree = FileViewer(".") 
        self.tree.connect("file-selected", self.open_file)
        self.tree.show()
        self.h.pack1(self.tree)

        self.editor = SourceView()

        scroller = gtk.ScrolledWindow()
        scroller.set_policy(gtk.POLICY_AUTOMATIC,
                      gtk.POLICY_AUTOMATIC)
        scroller.add(self.editor)
        self.h.pack2(scroller)

        self.h.show_all()

    def build_reader(self):
        self.reader = webkit.WebView()
        curdir = os.getcwd()
        self.reader.load_uri("file://%s/docs/index.html" % curdir)
        self.box.append_page(self.reader, gtk.Label("Lector"))
        self.reader.show()

    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()

        tool_group = None

        self.game_button = RadioToolButton()
        self.game_button.props.icon_name = 'gamecanvas'
        self.game_button.set_tooltip(_('Juego'))
        self.game_button.accelerator = "<Ctrl>1"
#.........这里部分代码省略.........
开发者ID:icarito,项目名称:sugar-git-activity,代码行数:103,代码来源:activity.py

示例11: SensorToolbar

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import show [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

示例12: HomeToolbar

# 需要导入模块: from sugar.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar.graphics.radiotoolbutton.RadioToolButton import show [as 别名]
class HomeToolbar(gtk.Toolbar):
    __gtype_name__ = 'SugarHomeToolbar'

    __gsignals__ = {
        'query-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
                          ([str])),
        'view-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
                         ([object])),
    }

    def __init__(self):
        gtk.Toolbar.__init__(self)

        self._query = None
        self._autosearch_timer = None

        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,
                                              'system-search')
        self.search_entry.add_clear_button()
        self.search_entry.set_width_chars(25)
        self.search_entry.connect('activate', self.__entry_activated_cb)
        self.search_entry.connect('changed', self.__entry_changed_cb)
        tool_item.add(self.search_entry)
        self.search_entry.show()

        self._add_separator(expand=True)

        favorites_button = FavoritesButton()
        favorites_button.connect('toggled', self.__view_button_toggled_cb,
                                 _FAVORITES_VIEW)
        self.insert(favorites_button, -1)
        favorites_button.show()

        self._list_button = RadioToolButton(named_icon='view-list')
        self._list_button.props.group = favorites_button
        self._list_button.props.tooltip = _('List view')
        self._list_button.props.accelerator = _('<Ctrl>2')
        self._list_button.connect('toggled', self.__view_button_toggled_cb,
                            _LIST_VIEW)
        self.insert(self._list_button, -1)
        self._list_button.show()

        self._add_separator()

    def __view_button_toggled_cb(self, button, view):
        if button.props.active:
            self.search_entry.grab_focus()
            self.emit('view-changed', view)

    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.GRID_CELL_SIZE,
                                       style.GRID_CELL_SIZE)
        self.insert(separator, -1)
        separator.show()

    def __entry_activated_cb(self, entry):
        if self._autosearch_timer:
            gobject.source_remove(self._autosearch_timer)
        new_query = entry.props.text
        if self._query != new_query:
            self._query = new_query

            self.emit('query-changed', self._query)

    def __entry_changed_cb(self, entry):
        if not entry.props.text:
            entry.activate()
            return

        if self._autosearch_timer:
            gobject.source_remove(self._autosearch_timer)
        self._autosearch_timer = gobject.timeout_add(_AUTOSEARCH_TIMEOUT,
            self.__autosearch_timer_cb)

    def __autosearch_timer_cb(self):
        self._autosearch_timer = None
        self.search_entry.activate()
        return False
开发者ID:nemesiscodex,项目名称:JukyOS-sugar,代码行数:92,代码来源:homebox.py


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