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


Python palette.Palette类代码示例

本文整理汇总了Python中sugar3.graphics.palette.Palette的典型用法代码示例。如果您正苦于以下问题:Python Palette类的具体用法?Python Palette怎么用?Python Palette使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __init__

    def __init__(self, buddy):
        self._buddy = buddy

        nick, colors = buddy
        buddy_icon = Icon(icon_name="computer-xo", icon_size=style.STANDARD_ICON_SIZE, xo_color=XoColor(colors))

        Palette.__init__(self, primary_text=GLib.markup_escape_text(nick), icon=buddy_icon)
开发者ID:surajgillespie,项目名称:sugar,代码行数:7,代码来源:palettes.py

示例2: __init__

    def __init__(self, primary_text):
        Palette.__init__(self, primary_text)
        self._level = 0
        self._time = 0
        self._status = _STATUS_NOT_PRESENT
        self._warning_capacity = _settings_get('warning-capacity')

        self._progress_widget = PaletteMenuBox()
        self.set_content(self._progress_widget)
        self._progress_widget.show()

        inner_box = Gtk.VBox()
        inner_box.set_spacing(style.DEFAULT_PADDING)
        self._progress_widget.append_item(inner_box, vertical_padding=0)
        inner_box.show()

        self._progress_bar = Gtk.ProgressBar()
        self._progress_bar.set_size_request(
            style.zoom(style.GRID_CELL_SIZE * 4), -1)
        inner_box.pack_start(self._progress_bar, True, True, 0)
        self._progress_bar.show()

        self._status_label = Gtk.Label()
        inner_box.pack_start(self._status_label, True, True, 0)
        self._status_label.show()
开发者ID:PoetticJustice,项目名称:sugar,代码行数:25,代码来源:battery.py

示例3: __init__

    def __init__(self, invite):
        Palette.__init__(self, '')

        self._invite = invite

        self.menu_box = PaletteMenuBox()
        self.set_content(self.menu_box)
        self.menu_box.show()

        menu_item = PaletteMenuItem(_('Join'), icon_name='dialog-ok')
        menu_item.connect('activate', self.__join_activate_cb)
        self.menu_box.append_item(menu_item)
        menu_item.show()

        menu_item = PaletteMenuItem(_('Decline'), icon_name='dialog-cancel')
        menu_item.connect('activate', self.__decline_activate_cb)
        self.menu_box.append_item(menu_item)
        menu_item.show()

        bundle_id = invite.get_bundle_id()

        registry = bundleregistry.get_registry()
        self._bundle = registry.get_bundle(bundle_id)
        if self._bundle:
            activity_name = self._bundle.get_name()
        else:
            activity_name = bundle_id
        self.set_primary_text(activity_name)

        title = self._invite.get_activity_title()
        if title is not None:
            self.set_secondary_text(title)
开发者ID:sugarlabs,项目名称:sugar,代码行数:32,代码来源:activitiestray.py

示例4: setup_rollover_options

    def setup_rollover_options(self, info):
        palette = Palette(info, text_maxlen=50)
        self.set_palette(palette)

        box = PaletteMenuBox()
        palette.set_content(box)
        box.show()

        menu_item = PaletteMenuItem(_('Remove'), 'list-remove')
        menu_item.connect('activate', self.item_remove_cb)
        box.append_item(menu_item)
        menu_item.show()

        separator = PaletteMenuItemSeparator()
        box.append_item(separator)
        separator.show()

        textview = Gtk.TextView()
        textview.props.height_request = style.GRID_CELL_SIZE * 2
        textview.props.width_request = style.GRID_CELL_SIZE * 3
        textview.props.hexpand = True
        textview.props.vexpand = True
        box.append_item(textview)
        textview.show()

        buffer = textview.get_buffer()
        if self.notes is None:
            buffer.set_text(_('Take notes on this page'))
        else:
            buffer.set_text(self.notes)
        buffer.connect('changed', self.__buffer_changed_cb)
开发者ID:sugarlabs,项目名称:browse-activity,代码行数:31,代码来源:linkbutton.py

示例5: __init__

    def __init__(self):
        Palette.__init__(self, primary_text=_('Wired Network'))

        self._speed_label = Gtk.Label()
        self._speed_label.props.xalign = 0.0
        self._speed_label.show()

        self._ip_address_label = Gtk.Label()

        self._info = Gtk.VBox()

        def _padded(child, xalign=0, yalign=0.5):
            padder = Gtk.Alignment.new(xalign=xalign, yalign=yalign,
                                       xscale=1, yscale=0.33)
            padder.set_padding(style.DEFAULT_SPACING,
                               style.DEFAULT_SPACING,
                               style.DEFAULT_SPACING,
                               style.DEFAULT_SPACING)
            padder.add(child)
            return padder

        self._info.pack_start(_padded(self._speed_label), True, True, 0)
        self._info.pack_start(_padded(self._ip_address_label), True, True, 0)
        self._info.show_all()

        self.set_content(self._info)
        self.props.secondary_text = _('Connected')
开发者ID:AbrahmAB,项目名称:sugar,代码行数:27,代码来源:network.py

示例6: __init__

    def __init__(self, cb_object):
        Palette.__init__(self, text_maxlen=100)

        self._cb_object = cb_object

        self.set_group_id('frame')

        cb_service = clipboard.get_instance()
        cb_service.connect('object-state-changed',
                           self._object_state_changed_cb)

        self._remove_item = MenuItem(pgettext('Clipboard', 'Remove'),
                                     'list-remove')
        self._remove_item.connect('activate', self._remove_item_activate_cb)
        self.menu.append(self._remove_item)
        self._remove_item.show()

        self._open_item = MenuItem(_('Open'), 'zoom-activity')
        self._open_item.connect('activate', self._open_item_activate_cb)
        self.menu.append(self._open_item)
        self._open_item.show()

        self._journal_item = MenuItem(_('Keep'))
        client = GConf.Client.get_default()
        color = XoColor(client.get_string('/desktop/sugar/user/color'))
        icon = Icon(icon_name='document-save', icon_size=Gtk.IconSize.MENU,
                    xo_color=color)
        self._journal_item.set_image(icon)

        self._journal_item.connect('activate', self._journal_item_activate_cb)
        self.menu.append(self._journal_item)
        self._journal_item.show()

        self._update()
开发者ID:tchx84,项目名称:social-sugar,代码行数:34,代码来源:clipboardmenu.py

示例7: __init__

    def __init__(self, cb_object):
        Palette.__init__(self, text_maxlen=100)

        self._cb_object = cb_object

        self.set_group_id('frame')

        cb_service = clipboard.get_instance()
        cb_service.connect('object-state-changed',
                           self._object_state_changed_cb)

        self._remove_item = MenuItem(pgettext('Clipboard', 'Remove'),
                                     'list-remove')
        self._remove_item.connect('activate', self._remove_item_activate_cb)
        self.menu.append(self._remove_item)
        self._remove_item.show()

        self._open_item = MenuItem(_('Open'), 'zoom-activity')
        self._open_item.connect('activate', self._open_item_activate_cb)
        self.menu.append(self._open_item)
        self._open_item.show()

        self._journal_item = MenuItem(_('Keep'))
        color = profile.get_color()
        icon = Icon(icon_name='document-save',
                    pixel_size=style.SMALL_ICON_SIZE,
                    xo_color=color)
        self._journal_item.set_image(icon)

        self._journal_item.connect('activate', self._journal_item_activate_cb)
        self.menu.append(self._journal_item)
        self._journal_item.show()

        self._update()
开发者ID:curiousguy13,项目名称:sugar,代码行数:34,代码来源:clipboardmenu.py

示例8: __init__

    def __init__(self, **kwargs):
        self._color = Gdk.Color(0, 0, 0)
        self._previous_color = self._color.copy()
        self._scales = None

        Palette.__init__(self, **kwargs)

        self.connect('popup', self.__popup_cb)
        self.connect('popdown', self.__popdown_cb)

        self._picker_hbox = Gtk.HBox()
        self.set_content(self._picker_hbox)

        self._swatch_tray = Gtk.Table()

        self._picker_hbox.pack_start(self._swatch_tray, True, True, 0)
        self._picker_hbox.pack_start(Gtk.VSeparator(), True, True,
                                     padding=style.DEFAULT_SPACING)

        self._chooser_table = Gtk.Table(3, 2)
        self._chooser_table.set_col_spacing(0, style.DEFAULT_PADDING)

        self._scales = []
        self._scales.append(
            self._create_color_scale(_('Red'), self._RED, 0))
        self._scales.append(
            self._create_color_scale(_('Green'), self._GREEN, 1))
        self._scales.append(
            self._create_color_scale(_('Blue'), self._BLUE, 2))

        self._picker_hbox.add(self._chooser_table)

        self._picker_hbox.show_all()

        self._build_swatches()
开发者ID:ceibal-tatu,项目名称:sugar-toolkit-gtk3,代码行数:35,代码来源:colorbutton.py

示例9: __init__

    def __init__(self, primary_text, output_text, input_text, output_model,
                 input_model):
        Palette.__init__(self, label=primary_text)

        self._capture_manager = AudioManagerWidget(input_text,
                                                   'media-audio-input',
                                                   input_model)
        self._capture_manager.show()

        separator = PaletteMenuItemSeparator()
        separator.show()

        self._speaker_manager = AudioManagerWidget(output_text,
                                                   'speaker-100',
                                                   output_model)
        self._speaker_manager.show()

        self._box = PaletteMenuBox()
        self._box.append_item(self._capture_manager, 0, 0)
        self._box.append_item(separator, 0, 0)
        self._box.append_item(self._speaker_manager, 0, 0)
        self._box.show()

        self.set_content(self._box)

        self.connect('popup', self.__popup_cb)
开发者ID:AbrahmAB,项目名称:sugar-prototype,代码行数:26,代码来源:audio.py

示例10: create_palette

    def create_palette(self):
        primary_text = GLib.markup_escape_text(self._model.bundle.get_name())
        secondary_text = GLib.markup_escape_text(self._model.get_name())
        palette_icon = Icon(file=self._model.bundle.get_icon(),
                            xo_color=self._model.get_color())
        palette_icon.props.icon_size = Gtk.IconSize.LARGE_TOOLBAR
        palette = Palette(None,
                          primary_text=primary_text,
                          secondary_text=secondary_text,
                          icon=palette_icon)

        private = self._model.props.private
        joined = get_owner_instance() in self._model.props.buddies

        menu_box = PaletteMenuBox()

        if joined:
            item = PaletteMenuItem(_('Resume'))
            icon = Icon(icon_size=Gtk.IconSize.MENU, icon_name='activity-start')
            item.set_image(icon)
            item.connect('activate', self.__palette_item_clicked_cb)
            menu_box.append_item(item)
        elif not private:
            item = PaletteMenuItem(_('Join'))
            icon = Icon(icon_size=Gtk.IconSize.MENU, icon_name='activity-start')
            item.set_image(icon)
            item.connect('activate', self.__palette_item_clicked_cb)
            menu_box.append_item(item)

        palette.set_content(menu_box)
        menu_box.show_all()

        self.connect_to_palette_pop_events(palette)
        return palette
开发者ID:ajaygarg84,项目名称:sugar,代码行数:34,代码来源:meshbox.py

示例11: __init__

    def __init__(self, primary_text, view):
        Palette.__init__(self, label=primary_text)
        self._recognizer = view._recognizer
        self._view = view

        self._ok_icon = Icon(icon_name='dialog-ok',
                             icon_size=Gtk.IconSize.MENU)
        self._cancel_icon = Icon(icon_name='dialog-cancel',
                                 icon_size=Gtk.IconSize.MENU)

        label = Gtk.Label()
        label.set_label(_('Mute'))
        align = Gtk.Alignment(xalign=0.0, yalign=0.5, xscale=0.0, yscale=0.0)
        align.add(label)
        button = Gtk.Button()
        button.set_image(self._cancel_icon)
        button.connect('clicked', self.__button_clicked_cb)
        self._asr_label = label
        self._asr_button = button

        hbox = Gtk.HBox()
        hbox.pack_start(align, expand=True, fill=True,
                        padding=style.DEFAULT_PADDING)
        hbox.pack_start(button, expand=False, fill=False,
                        padding=style.DEFAULT_PADDING)
        vbox = Gtk.VBox()

        vbox.pack_start(hbox, True, True, style.DEFAULT_PADDING)
        self.set_content(vbox)
        vbox.show_all()
开发者ID:rparrapy,项目名称:listen-trailicon,代码行数:30,代码来源:listen.py

示例12: __init__

    def __init__(self, invite):
        Palette.__init__(self, '')

        self._invite = invite

        menu_item = MenuItem(_('Join'), icon_name='dialog-ok')
        menu_item.connect('activate', self.__join_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()

        menu_item = MenuItem(_('Decline'), icon_name='dialog-cancel')
        menu_item.connect('activate', self.__decline_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()

        bundle_id = invite.get_bundle_id()

        registry = bundleregistry.get_registry()
        self._bundle = registry.get_bundle(bundle_id)
        if self._bundle:
            name = self._bundle.get_name()
        else:
            name = bundle_id

        self.set_primary_text(name)
开发者ID:AxEofBone7,项目名称:sugar,代码行数:25,代码来源:activitiestray.py

示例13: __init__

    def __init__(self, invite):
        Palette.__init__(self, "")

        self._invite = invite

        menu_item = MenuItem(_("Join"), icon_name="dialog-ok")
        menu_item.connect("activate", self.__join_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()

        menu_item = MenuItem(_("Decline"), icon_name="dialog-cancel")
        menu_item.connect("activate", self.__decline_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()

        bundle_id = invite.get_bundle_id()

        registry = bundleregistry.get_registry()
        self._bundle = registry.get_bundle(bundle_id)
        if self._bundle:
            name = self._bundle.get_name()
        else:
            name = bundle_id

        self.set_primary_text(GLib.markup_escape_text(name))
开发者ID:native93,项目名称:bulletinframe,代码行数:25,代码来源:activitiestray.py

示例14: __init__

    def __init__(self, title, url, owner_document):
        Palette.__init__(self)

        self._title = title
        self._url = url
        self._owner_document = owner_document

        self.props.primary_text = title
        self.props.secondary_text = url

        menu_item = MenuItem(_('Keep image'))
        icon = Icon(icon_name='document-save', xo_color=profile.get_color(),
                    icon_size=Gtk.IconSize.MENU)
        menu_item.set_image(icon)
        menu_item.connect('activate', self.__download_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()

        menu_item = MenuItem(_('Copy image'))
        icon = Icon(icon_name='edit-copy', xo_color=profile.get_color(),
                    icon_size=Gtk.IconSize.MENU)
        menu_item.set_image(icon)
        menu_item.connect('activate', self.__copy_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()
开发者ID:georgejhunt,项目名称:HaitiDictionary.activity,代码行数:25,代码来源:palettes.py

示例15: __init__

    def __init__(self, buddy):
        self._buddy = buddy

        nick, colors = buddy
        buddy_icon = Icon(icon_name='computer-xo',
                          pixel_size=style.STANDARD_ICON_SIZE,
                          xo_color=XoColor(colors))

        Palette.__init__(self, primary_text=nick, icon=buddy_icon)
开发者ID:sugarlabs,项目名称:sugar,代码行数:9,代码来源:palettes.py


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