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


Python ToggleToolButton.set_palette方法代码示例

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


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

示例1: RecordToolbar

# 需要导入模块: from sugar3.graphics.toggletoolbutton import ToggleToolButton [as 别名]
# 或者: from sugar3.graphics.toggletoolbutton.ToggleToolButton import set_palette [as 别名]
class RecordToolbar(Gtk.Toolbar):
    def __init__(self, jam):
        GObject.GObject.__init__(self)

        def _insertSeparator(x=1):
            for i in range(x):
                self.separator = Gtk.SeparatorToolItem()
                self.separator.set_draw(True)
                self.insert(self.separator, -1)
                self.separator.show()

        #self.toolbox = toolbox
        self.jam = jam

        if Config.FEATURES_MIC:
            self.micRec1Button = ToolButton('rec1')
            self.micRec1Button.connect('clicked', self.jam.micRec, 'mic1')
            self.insert(self.micRec1Button, -1)
            self.micRec1Button.show()
            self.micRec1Button.set_tooltip(_('Record microphone into slot 1'))

            self.micRec2Button = ToolButton('rec2')
            self.micRec2Button.connect('clicked', self.jam.micRec, 'mic2')
            self.insert(self.micRec2Button, -1)
            self.micRec2Button.show()
            self.micRec2Button.set_tooltip(_('Record microphone into slot 2'))

            self.micRec3Button = ToolButton('rec3')
            self.micRec3Button.connect('clicked', self.jam.micRec, 'mic3')
            self.insert(self.micRec3Button, -1)
            self.micRec3Button.show()
            self.micRec3Button.set_tooltip(_('Record microphone into slot 3'))

            self.micRec4Button = ToolButton('rec4')
            self.micRec4Button.connect('clicked', self.jam.micRec, 'mic4')
            self.insert(self.micRec4Button, -1)
            self.micRec4Button.show()
            self.micRec4Button.set_tooltip(('Record microphone into slot 4'))

        _insertSeparator()

        if Config.FEATURES_NEWSOUNDS:
            self._loopSettingsPalette = LoopSettingsPalette(
                _('Add new Sound'), self.jam)
            self.loopSetButton = ToggleToolButton('loop')
            self.loopSetButton.set_palette(self._loopSettingsPalette)
            self.insert(self.loopSetButton, -1)
            self.loopSetButton.show()

        self.show_all()
开发者ID:leonardcj,项目名称:tamtam,代码行数:52,代码来源:Toolbars.py

示例2: CardEditor

# 需要导入模块: from sugar3.graphics.toggletoolbutton import ToggleToolButton [as 别名]
# 或者: from sugar3.graphics.toggletoolbutton.ToggleToolButton import set_palette [as 别名]
class CardEditor(Gtk.EventBox):

    __gsignals__ = {
        'has-text': (GObject.SignalFlags.RUN_FIRST, None,
                     [GObject.TYPE_PYOBJECT]),
        'has-picture': (GObject.SignalFlags.RUN_FIRST, None,
                        [GObject.TYPE_PYOBJECT]),
        'has-sound': (GObject.SignalFlags.RUN_FIRST, None,
                      [GObject.TYPE_PYOBJECT]),
        'change-font': (GObject.SignalFlags.RUN_FIRST, None,
                        [GObject.TYPE_PYOBJECT]),
    }

    def __init__(self, game, editor_index):
        Gtk.EventBox.__init__(self)
        self._game = game
        self.snd = None
        self.editor_index = editor_index
        self.temp_folder = None

        box = Gtk.Grid()
        box.set_column_spacing(style.DEFAULT_SPACING)
        box.set_row_spacing(style.DEFAULT_SPACING)
        box.props.margin = style.DEFAULT_SPACING

        self.card = Card(
            -1, {'front_text': {'card_text': '',
                                'text_color': style.Color('#ffffff')}},
            None, PAIR_SIZE, '#c0c0c0')
        self.card.flip()
        card_align = Gtk.Alignment.new(.5, .5, 0, 0)
        card_align.add(self.card)
        box.attach(card_align, 0, 0, 1, 1)

        self.textentry = Gtk.Entry()
        self.textentry.connect('changed', self.update_text)
        self.textentry.set_valign(Gtk.Align.START)
        box.attach(self.textentry, 0, 1, 1, 1)

        toolbar = Gtk.VBox()
        toolbar.set_valign(Gtk.Align.CENTER)

        browsepicture = ToolButton(icon_name='import_picture',
                                   tooltip=_('Insert picture'))
        toolbar.add(browsepicture)

        browsesound = ToolButton(icon_name='import_sound',
                                 tooltip=_('Insert sound'))
        toolbar.add(browsesound)

        browsepicture.connect('clicked', self._load_image)
        browsesound.connect('clicked', self._load_audio)

        self.usespeak = ToggleToolButton(icon_name='speak')
        self.usespeak.set_palette(SpeakPalette(self))
        toolbar.add(self.usespeak)
        self.usespeak.connect('toggled', self._usespeak_cb)

        self.fontbutton = FontButton()
        toolbar.add(self.fontbutton)
        self.id_font_changed = self.fontbutton.connect(
            'changed', self.__font_changed_cb)
        box.attach(toolbar, 1, 0, 1, 2)

        self.add(box)

    def __font_changed_cb(self, widget):
        font = widget.get_font_name()
        if font:
            self.card.change_font(font)
            self.emit('change-font', font)

    def set_font_name(self, font_name):
        self.fontbutton.handler_block(self.id_font_changed)
        self.fontbutton.set_font_name(font_name)
        self.fontbutton.handler_unblock(self.id_font_changed)

    def update_text(self, entry):
        self.card.change_text(entry.get_text())
        if len(entry.get_text()) == 0:
            self.emit('has-text', False)
        else:
            self.emit('has-text', True)

    def get_text(self):
        return self.textentry.get_text()

    def set_text(self, newtext):
        if newtext is None:
            newtext = ''
        self.textentry.set_text(newtext)

    def get_speak(self):
        if self.usespeak is None:
            return None
        if self.usespeak.props.active:
            return self.usespeak.palette.face.status.voice.language

    def set_speak(self, value):
        if self.usespeak is None:
#.........这里部分代码省略.........
开发者ID:godiard,项目名称:memorize-activity,代码行数:103,代码来源:createcardpanel.py

示例3: recordToolbar

# 需要导入模块: from sugar3.graphics.toggletoolbutton import ToggleToolButton [as 别名]
# 或者: from sugar3.graphics.toggletoolbutton.ToggleToolButton import set_palette [as 别名]
class recordToolbar(Gtk.Toolbar):
    def __init__(self, miniTamTam):
        Gtk.Toolbar.__init__(self)

        def _insertSeparator(x=1):
            for i in range(x):
                self.separator = Gtk.SeparatorToolItem()
                self.separator.set_draw(True)
                self.insert(self.separator, -1)
                self.separator.show()

        self.miniTamTam = miniTamTam

        self.micRec1Button = ToolButton("rec1")
        self.micRec1Button.connect("clicked", self.miniTamTam.micRec, "mic1")
        self.insert(self.micRec1Button, -1)
        self.micRec1Button.show()
        self.micRec1Button.set_tooltip(_("Record microphone into slot 1"))

        self.micRec2Button = ToolButton("rec2")
        self.micRec2Button.connect("clicked", self.miniTamTam.micRec, "mic2")
        self.insert(self.micRec2Button, -1)
        self.micRec2Button.show()
        self.micRec2Button.set_tooltip(_("Record microphone into slot 2"))

        self.micRec3Button = ToolButton("rec3")
        self.micRec3Button.connect("clicked", self.miniTamTam.micRec, "mic3")
        self.insert(self.micRec3Button, -1)
        self.micRec3Button.show()
        self.micRec3Button.set_tooltip(_("Record microphone into slot 3"))

        self.micRec4Button = ToolButton("rec4")
        self.micRec4Button.connect("clicked", self.miniTamTam.micRec, "mic4")
        self.insert(self.micRec4Button, -1)
        self.micRec4Button.show()
        self.micRec4Button.set_tooltip(("Record microphone into slot 4"))

        _insertSeparator()

        self.keyboardRecButton = ToggleToolButton("keyrec")
        self.keyboardRecButton.connect("clicked", self.miniTamTam.sequencer.handleRecordButton)
        self.insert(self.keyboardRecButton, -1)
        self.keyboardRecButton.show()
        self.keyboardRecButton.set_tooltip(_("Click to record a loop"))

        self.keyboardRecOverButton = ToggleToolButton("overrec")
        self.keyboardRecOverButton.connect("clicked", self.miniTamTam.sequencer.handleOverButton)
        self.insert(self.keyboardRecOverButton, -1)
        self.keyboardRecOverButton.show()
        self.keyboardRecOverButton.set_tooltip(_("Click to add a loop"))
        # self.keyboardRecOverButton.set_sensitive(False)

        self.keyboardRecMinusButton = ToolButton("minusrec")
        self.keyboardRecMinusButton.connect("clicked", self.miniTamTam.sequencer.clearSequencer)
        self.insert(self.keyboardRecMinusButton, -1)
        self.keyboardRecMinusButton.show()
        self.keyboardRecMinusButton.set_tooltip(_("Click to clear all loops"))

        _insertSeparator()

        self._loopSettingsPalette = LoopSettingsPalette(_("Add new Sound"), self.miniTamTam)
        self.loopSetButton = ToggleToolButton("loop")
        self.loopSetButton.set_palette(self._loopSettingsPalette)
        self.insert(self.loopSetButton, -1)
        self.loopSetButton.show()
开发者ID:shridharmishra4,项目名称:tamtam,代码行数:67,代码来源:miniToolbars.py


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