• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python palette.Palette类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: __init__

    def __init__(self):
        label = GLib.markup_escape_text(_('Wireless modem'))
        Palette.__init__(self, primary_text=label)

        self._current_state = None
        self._failed_connection = False

        self.info_box = Gtk.VBox()

        self._toggle_state_item = PaletteMenuItem('')
        self._toggle_state_item.connect('activate', self.__toggle_state_cb)
        self.info_box.pack_start(self._toggle_state_item, True, True, 0)
        self._toggle_state_item.show()

        self.error_title_label = Gtk.Label(label="")
        self.error_title_label.set_alignment(0, 0.5)
        self.error_title_label.set_line_wrap(True)
        self.info_box.pack_start(self.error_title_label, True, True, 0)
        self.error_description_label = Gtk.Label(label="")
        self.error_description_label.set_alignment(0, 0.5)
        self.error_description_label.set_line_wrap(True)
        self.info_box.pack_start(self.error_description_label, True, True, 0)

        self.connection_info_box = Gtk.HBox()
        icon = Icon(icon_name='data-upload',
                    pixel_size=style.SMALL_ICON_SIZE)
        self.connection_info_box.pack_start(icon, True, True, 0)
        icon.show()

        self._data_label_up = Gtk.Label()
        self._data_label_up.props.xalign = 0.0
        label_alignment = self._add_widget_with_padding(self._data_label_up)
        self.connection_info_box.pack_start(label_alignment, True, True, 0)
        self._data_label_up.show()
        label_alignment.show()

        icon = Icon(icon_name='data-download',
                    pixel_size=style.SMALL_ICON_SIZE)
        self.connection_info_box.pack_start(icon, True, True, 0)
        icon.show()
        self._data_label_down = Gtk.Label()
        self._data_label_down.props.xalign = 0.0
        label_alignment = self._add_widget_with_padding(self._data_label_down)
        self.connection_info_box.pack_start(label_alignment, True, True, 0)
        self._data_label_down.show()
        label_alignment.show()

        self.info_box.pack_start(self.connection_info_box, True, True, 0)

        self.info_box.show()
        self.set_content(self.info_box)

        self.update_state(_GSM_STATE_NOT_READY)
开发者ID:Akirato,项目名称:sugar,代码行数:53,代码来源:network.py


示例17: __init__

    def __init__(self, home_activity):
        Palette.__init__(self)

        self._notify_launch_hid = None

        if home_activity.props.launch_status == shell.Activity.LAUNCHING:
            self._notify_launch_hid = home_activity.connect("notify::launch-status", self.__notify_launch_status_cb)
            self.set_primary_text(GLib.markup_escape_text(_("Starting...")))
        elif home_activity.props.launch_status == shell.Activity.LAUNCH_FAILED:
            self._on_failed_launch()
        else:
            self.setup_palette()
开发者ID:jvonau,项目名称:sugar,代码行数:12,代码来源:palettes.py


示例18: setup_rollover_options

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

        menu_item = Gtk.MenuItem(_('Go to Bookmark'))
        menu_item.connect('activate', self.go_to_bookmark_cb)
        palette.menu.append(menu_item)
        menu_item.show()

        menu_item = Gtk.MenuItem(_('Remove'))
        menu_item.connect('activate', self.item_remove_cb)
        palette.menu.append(menu_item)
        menu_item.show()
开发者ID:samdroid-apps,项目名称:read-activity,代码行数:14,代码来源:linkbutton.py


示例19: __init__

    def __init__(self, url):
        Palette.__init__(self, url)
        self.owns_clipboard = False
        self.url = self._url_check_protocol(url)

        menu_box = Gtk.VBox()
        self.set_content(menu_box)
        menu_box.show()
        self._content.set_border_width(1)
        menu_item = PaletteMenuItem(_('Copy to Clipboard'), 'edit-copy')
        menu_item.connect('activate', self._copy_to_clipboard_cb)
        menu_box.pack_start(menu_item, False, False, 0)
        menu_item.show()
        self.props.invoker = ContentInvoker()
开发者ID:leonardcj,项目名称:speak,代码行数:14,代码来源:chatbox.py


示例20: __init__

    def __init__(self):
        label = GLib.markup_escape_text(ACCOUNT_NAME)
        account_icon = Icon(icon_name=ACCOUNT_ICON,
            xo_color=profile.get_color(),
            icon_size=Gtk.IconSize.MENU)

        Palette.__init__(self, primary_text=label,
                         icon=account_icon)

        self.menu_box = PaletteMenuBox()

        self.menu_item = PaletteMenuItem(_('Update'), 'view-refresh')
        self.menu_box.append_item(self.menu_item)

        self.set_content(self.menu_box)
        self.menu_box.show_all()
开发者ID:i5o,项目名称:sugar-gdrive,代码行数:16,代码来源:account.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python palette.ToolInvoker类代码示例发布时间:2022-05-27
下一篇:
Python objectchooser.ObjectChooser类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap