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

Python menuitem.MenuItem类代码示例

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

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



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

示例1: __init__

    def __init__(self, file_name, document_path, title, bundle=False):
        RadioToolButton.__init__(self)

        self._document_path = document_path
        self._title = title
        self._jobject = None

        self.props.tooltip = _('Instance Source')

        client = GConf.Client.get_default()
        self._color = client.get_string('/desktop/sugar/user/color')
        icon = Icon(file=file_name,
                    icon_size=Gtk.IconSize.LARGE_TOOLBAR,
                    xo_color=XoColor(self._color))
        self.set_icon_widget(icon)
        icon.show()

        if bundle:
            menu_item = MenuItem(_('Duplicate'))
            icon = Icon(icon_name='edit-duplicate',
                        icon_size=Gtk.IconSize.MENU,
                        xo_color=XoColor(self._color))
            menu_item.connect('activate', self.__copy_to_home_cb)
        else:
            menu_item = MenuItem(_('Keep'))
            icon = Icon(icon_name='document-save',
                        icon_size=Gtk.IconSize.MENU,
                        xo_color=XoColor(self._color))
            menu_item.connect('activate', self.__keep_in_journal_cb)

        menu_item.set_image(icon)

        self.props.palette.menu.append(menu_item)
        menu_item.show()
开发者ID:axitkhurana,项目名称:sugar,代码行数:34,代码来源:viewsource.py


示例2: __init__

    def __init__(self, file_name, document_path, title, bundle=False):
        RadioToolButton.__init__(self)

        self._document_path = document_path
        self._title = title
        self._jobject = None

        self.props.tooltip = _('Instance Source')

        settings = Gio.Settings('org.sugarlabs.user')
        self._color = settings.get_string('color')
        icon = Icon(file=file_name,
                    pixel_size=style.STANDARD_ICON_SIZE,
                    xo_color=XoColor(self._color))
        self.set_icon_widget(icon)
        icon.show()

        if bundle:
            menu_item = MenuItem(_('Duplicate'))
            icon = Icon(icon_name='edit-duplicate',
                        pixel_size=style.SMALL_ICON_SIZE,
                        xo_color=XoColor(self._color))
            menu_item.connect('activate', self.__copy_to_home_cb)
        else:
            menu_item = MenuItem(_('Keep'))
            icon = Icon(icon_name='document-save',
                        pixel_size=style.SMALL_ICON_SIZE,
                        xo_color=XoColor(self._color))
            menu_item.connect('activate', self.__keep_in_journal_cb)

        menu_item.set_image(icon)

        self.props.palette.menu.append(menu_item)
        menu_item.show()
开发者ID:AxEofBone7,项目名称:sugar,代码行数:34,代码来源:viewsource.py


示例3: 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

        if joined:
            item = MenuItem(_('Resume'), 'activity-start')
            item.connect('activate', self.__palette_item_clicked_cb)
            item.show()
            palette.menu.append(item)
        elif not private:
            item = MenuItem(_('Join'), 'activity-start')
            item.connect('activate', self.__palette_item_clicked_cb)
            item.show()
            palette.menu.append(item)

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


示例4: __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


示例5: __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


示例6: __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


示例7: __init__

    def __init__(self, _parent):
        SugarEditToolbar.__init__(self)

        self._parent = _parent

        self.undo.connect('clicked', self.__undo_cb)
        self.redo.connect('clicked', self.__redo_cb)
        self.copy.connect('clicked', self.__copy_cb)
        self.paste.connect('clicked', self.__paste_cb)

        menu_item = MenuItem(_('Cut'))
        menu_item.connect('activate', self.__cut_cb)
        menu_item.show()
        self.copy.get_palette().menu.append(menu_item)

        self.insert(Gtk.SeparatorToolItem(), -1)

        self.erase_button = ToolButton('edit-delete')
        self.erase_button.set_tooltip(_('Erase selected thought(s)'))
        self.erase_button.connect('clicked', self.__delete_cb)
        self.insert(self.erase_button, -1)

        self.show_all()
        self.clipboard = Gtk.Clipboard()

        self.copy.set_sensitive(False)
        self.paste.set_sensitive(False)
        self.erase_button.set_sensitive(False)
开发者ID:sugarlabs,项目名称:laybrinth-activity,代码行数:28,代码来源:labyrinthactivity.py


示例8: refresh_activity_list

    def refresh_activity_list(self):
        self.menu = Gtk.Menu()

        def process_dir(activity_path):
            for dir_name in sorted(os.listdir(activity_path)):
                bundles_installed = []
                if dir_name.endswith('.activity'):
                    bundle_dir = os.path.join(activity_path, dir_name)
                    bundle = ActivityBundle(bundle_dir)
                    bundles_installed.append(bundle)

                    item = MenuItem(file_name=bundle.get_icon(),
                                    xo_color=xocolor.XoColor())
                    item.set_label(bundle.get_name())
                    item.set_reserve_indicator(True)
                    item.set_submenu(self.make_submenu(bundle))
                    self.menu.append(item)

        process_dir('/usr/share/sugar/activities/')
        process_dir(activities_path) # ~/Activities

        separator = Gtk.SeparatorMenuItem()
        self.menu.append(separator)

        about = MenuItem()
        about.set_label("About")
        about.connect("activate", self.show_about_dialog)
        self.menu.append(about)

        quit = MenuItem()
        quit.set_label("Quit")
        quit.connect("activate", Gtk.main_quit)
        self.menu.append(quit)

        self.menu.show_all()
开发者ID:sugarlabs,项目名称:sugar-launcher-applet,代码行数:35,代码来源:launcher.py


示例9: __init__

    def __init__(self, file_name, document_path, title, bundle=False):
        RadioToolButton.__init__(self)

        self._document_path = document_path
        self._title = title
        self._jobject = None

        self.props.tooltip = _("Instance Source")

        settings = Gio.Settings("org.sugarlabs.user")
        self._color = settings.get_string("color")
        icon = Icon(file=file_name, icon_size=Gtk.IconSize.LARGE_TOOLBAR, xo_color=XoColor(self._color))
        self.set_icon_widget(icon)
        icon.show()

        if bundle:
            menu_item = MenuItem(_("Duplicate"))
            icon = Icon(icon_name="edit-duplicate", icon_size=Gtk.IconSize.MENU, xo_color=XoColor(self._color))
            menu_item.connect("activate", self.__copy_to_home_cb)
        else:
            menu_item = MenuItem(_("Keep"))
            icon = Icon(icon_name="document-save", icon_size=Gtk.IconSize.MENU, xo_color=XoColor(self._color))
            menu_item.connect("activate", self.__keep_in_journal_cb)

        menu_item.set_image(icon)

        self.props.palette.menu.append(menu_item)
        menu_item.show()
开发者ID:svineet,项目名称:sugar,代码行数:28,代码来源:viewsource.py


示例10: __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


示例11: _setup_notes_palette

    def _setup_notes_palette(self):
        self._notes_palette = self._notes_button.get_palette()

        for note in NOTES:
            menu_item = MenuItem(icon_name='',
                                 text_label=note)
            menu_item.connect('activate', self._note_selected_cb, note)
            self._notes_palette.menu.append(menu_item)
            menu_item.show()
开发者ID:sugarlabs,项目名称:Measure,代码行数:9,代码来源:tuning_toolbar.py


示例12: __init__

    def __init__(self, account, get_uid_list, is_active):
        MenuItem.__init__(self, ACCOUNT_NAME)

        self._account = account
        self.set_image(Icon(icon_name=ACCOUNT_ICON,
                            icon_size=Gtk.IconSize.MENU))
        self.show()
        self._get_uid_list = get_uid_list
        self.connect('activate', self.__share_menu_cb)
开发者ID:i5o,项目名称:dropbox-webservice,代码行数:9,代码来源:account.py


示例13: __init__

    def __init__(self, account, get_uid_list, is_active):
        MenuItem.__init__(self, ACCOUNT_DESCRIPTION)

        self._account = account
        self.set_image(Icon(icon_name=ACCOUNT_ICON,
                            icon_size=Gtk.IconSize.MENU))
        self.show()
        self._get_uid_list = get_uid_list
        self.connect('activate', self.upload_file)
开发者ID:i5o,项目名称:sugar-gdrive,代码行数:9,代码来源:account.py


示例14: _setup_octaves_palette

    def _setup_octaves_palette(self):
        self._octaves_palette = self._octaves_button.get_palette()

        for octave in range(9):
            menu_item = MenuItem(icon_name='',
                                 text_label=str(octave))
            menu_item.connect('activate', self._octave_selected_cb, octave)
            self._octaves_palette.menu.append(menu_item)
            menu_item.show()
开发者ID:sugarlabs,项目名称:Measure,代码行数:9,代码来源:tuning_toolbar.py


示例15: _add_erase_option

    def _add_erase_option(self, registry, activity_info):
        menu_item = MenuItem(_('Erase'), 'list-remove')
        menu_item.connect('activate', self.__erase_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()

        if not os.access(activity_info.get_path(), os.W_OK) or \
           registry.is_activity_protected(self._bundle_id):
            menu_item.props.sensitive = False
开发者ID:ceibal-tatu,项目名称:sugar,代码行数:9,代码来源:activitieslist.py


示例16: __init__

    def __init__(self, activity, abi):
        ToolButton.__init__(self, 'document-save')
        self.props.tooltip = _('Export')
        self.props.label = _('Export')

        for i in self._EXPORT_FORMATS:
            menu_item = MenuItem(i['title'])
            menu_item.connect('activate', self.__activate_cb, activity, abi, i)
            self.props.palette.menu.append(menu_item)
            menu_item.show()
开发者ID:sugarlabs,项目名称:devtutor-activity,代码行数:10,代码来源:widgets.py


示例17: create_palette

    def create_palette(self, text, help_cb):
        p = Palette(text)

        if help_cb is not None:
            item = MenuItem(_('Help'), 'action-help')
            item.connect('activate', help_cb)
            item.show()
            p.menu.append(item)

        self.set_palette(p)
开发者ID:quozl,项目名称:sugarlabs-calculate,代码行数:10,代码来源:toolbars.py


示例18: _setup_robot_palette

    def _setup_robot_palette(self):
        self._robot_palette = self._robot_time_button.get_palette()

        for seconds in ROBOT_TIMER_VALUES:
            text = ROBOT_TIMER_LABELS[seconds]
            menu_item = MenuItem(icon_name='timer-%d' % (seconds),
                                 text_label=text)
            menu_item.connect('activate', self._robot_selected_cb, seconds)
            self._robot_palette.menu.append(menu_item)
            menu_item.show()
开发者ID:walterbender,项目名称:primedimensions,代码行数:10,代码来源:Dimensions.py


示例19: _setup_instrument_palette

    def _setup_instrument_palette(self):
        self.instrument_palette = self._instrument_button.get_palette()

        self.instrument = []
        for k in INSTRUMENT_DICT.keys():
            self.instrument.append(k)
            menu_item = MenuItem(icon_name='',
                                 text_label=k)
            menu_item.connect('activate', self.instrument_selected_cb, k)
            self.instrument_palette.menu.append(menu_item)
            menu_item.show()
开发者ID:sugarlabs,项目名称:Measure,代码行数:11,代码来源:tuning_toolbar.py


示例20: __init__

    def __init__(self, webaccount, is_active):
        MenuItem.__init__(self, ACCOUNT_NAME)

        self._account = webaccount
        self._is_active = is_active

        self.set_image(Icon(icon_name=ACCOUNT_ICON,
                            icon_size=Gtk.IconSize.MENU))
        self.show()

        self.set_sensitive(False)
开发者ID:cristian99garcia,项目名称:teachershare,代码行数:11,代码来源:account.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python objectchooser.ObjectChooser类代码示例发布时间:2022-05-27
下一篇:
Python icon.Icon类代码示例发布时间: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