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

Python icon.Icon类代码示例

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

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



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

示例1: __init__

    def __init__(self, mount):
        Palette.__init__(self, label=mount.get_name())
        self._mount = mount

        path = mount.get_root().get_path()
        self.props.secondary_text = glib.markup_escape_text(path)

        vbox = gtk.VBox()
        self.set_content(vbox)
        vbox.show()

        self._progress_bar = gtk.ProgressBar()
        vbox.add(self._progress_bar)
        self._progress_bar.show()

        self._free_space_label = gtk.Label()
        self._free_space_label.set_alignment(0.5, 0.5)
        vbox.add(self._free_space_label)
        self._free_space_label.show()

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

        menu_item = MenuItem(pgettext('Volume', 'Remove'))

        icon = Icon(icon_name='media-eject', icon_size=gtk.ICON_SIZE_MENU)
        menu_item.set_image(icon)
        icon.show()

        menu_item.connect('activate', self.__unmount_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()
开发者ID:nemesiscodex,项目名称:JukyOS-sugar,代码行数:31,代码来源:palettes.py


示例2: _value_changed

    def _value_changed(self, cell, path, new_text, model, activity):
        _logger.info("Change '%s' to '%s'" % (model[path][1], new_text))
        is_number = True
        number = new_text.replace(",", ".")
        try:
            float(number)
        except ValueError:
            is_number = False

        if is_number:
            decimals = utils.get_decimals(str(float(number)))
            new_text = locale.format('%.' + decimals + 'f', float(number))
            model[path][1] = str(new_text)

            self.emit("value-changed", str(path), number)

        elif not is_number:
            alert = Alert()

            alert.props.title = _('Invalid Value')
            alert.props.msg = \
                           _('The value must be a number (integer or decimal)')

            ok_icon = Icon(icon_name='dialog-ok')
            alert.add_button(gtk.RESPONSE_OK, _('Ok'), ok_icon)
            ok_icon.show()

            alert.connect('response', lambda a, r: activity.remove_alert(a))

            activity.add_alert(alert)

            alert.show()
开发者ID:leonardcj,项目名称:AnalyzeJournal,代码行数:32,代码来源:activity.py


示例3: setup_palette

    def setup_palette(self):
        title = self._home_activity.get_title()
        self.set_primary_text(glib.markup_escape_text(title))

        vbox = gtk.VBox()
        self.set_content(vbox)
        vbox.show()

        self._progress_bar = gtk.ProgressBar()
        vbox.add(self._progress_bar)
        self._progress_bar.show()

        self._free_space_label = gtk.Label()
        self._free_space_label.set_alignment(0.5, 0.5)
        vbox.add(self._free_space_label)
        self._free_space_label.show()

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

        menu_item = MenuItem(_('Show contents'))

        icon = Icon(file=self._home_activity.get_icon_path(),
                icon_size=gtk.ICON_SIZE_MENU,
                xo_color=self._home_activity.get_icon_color())
        menu_item.set_image(icon)
        icon.show()

        menu_item.connect('activate', self.__open_activate_cb)
        self.menu.append(menu_item)
        menu_item.show()
开发者ID:nemesiscodex,项目名称:JukyOS-sugar,代码行数:30,代码来源:palettes.py


示例4: __init__

    def __init__(self, file_name, document_path, title):
        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.ICON_SIZE_LARGE_TOOLBAR,
                    xo_color=XoColor(self._color))
        self.set_icon_widget(icon)
        icon.show()

        menu_item = MenuItem(_('Keep'))
        icon = Icon(icon_name='document-save', icon_size=gtk.ICON_SIZE_MENU, 
                    xo_color=XoColor(self._color))
        menu_item.set_image(icon)

        menu_item.connect('activate', self.__keep_in_journal_cb)
        self.props.palette.menu.append(menu_item)
        menu_item.show()
开发者ID:lucian1900,项目名称:Webified,代码行数:25,代码来源:viewsource.py


示例5: _object_chooser

    def _object_chooser(self, mime_type, type_name):
        chooser = ObjectChooser()
        matches_mime_type = False

        response = chooser.run()
        if response == gtk.RESPONSE_ACCEPT:
            jobject = chooser.get_selected_object()
            metadata = jobject.metadata
            file_path = jobject.file_path

            if metadata['mime_type'] == mime_type:
                matches_mime_type = True

            else:
                alert = Alert()

                alert.props.title = _('Invalid object')
                alert.props.msg = \
                       _('The selected object must be a %s file' % (type_name))

                ok_icon = Icon(icon_name='dialog-ok')
                alert.add_button(gtk.RESPONSE_OK, _('Ok'), ok_icon)
                ok_icon.show()

                alert.connect('response', lambda a, r: self.remove_alert(a))

                self.add_alert(alert)

                alert.show()

        return matches_mime_type, file_path, metadata['title']
开发者ID:leonardcj,项目名称:AnalyzeJournal,代码行数:31,代码来源:activity.py


示例6: __init__

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

        self.set_border_width(style.LINE_WIDTH)
        offset = style.GRID_CELL_SIZE
        width = gtk.gdk.screen_width() - offset * 2
        height = gtk.gdk.screen_height() - offset * 2
        self.set_size_request(width, height)
        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
        self.set_decorated(False)
        self.set_resizable(False)
        self.set_modal(True)

        self._main_view = gtk.EventBox()
        self._vbox = gtk.VBox()
        self._vbox.set_spacing(style.DEFAULT_SPACING)
        self._vbox.set_border_width(style.GRID_CELL_SIZE * 2)
        self._main_view.modify_bg(gtk.STATE_NORMAL,
                                  style.COLOR_BLACK.get_gdk_color())
        self._main_view.add(self._vbox)
        self._vbox.show()

        client = gconf.client_get_default()
        color = XoColor(client.get_string('/desktop/sugar/user/color'))

        icon = Icon(icon_name='activity-journal',
                    pixel_size=style.XLARGE_ICON_SIZE,
                    xo_color=color)
        self._vbox.pack_start(icon, False)
        icon.show()

        self._title = gtk.Label()
        self._title.modify_fg(gtk.STATE_NORMAL,
                              style.COLOR_WHITE.get_gdk_color())
        self._title.set_markup('<b>%s</b>' % _('Your Journal is full'))
        self._vbox.pack_start(self._title, False)
        self._title.show()

        self._message = gtk.Label(_('Please delete some old Journal'
                                    ' entries to make space for new ones.'))
        self._message.modify_fg(gtk.STATE_NORMAL,
                              style.COLOR_WHITE.get_gdk_color())
        self._vbox.pack_start(self._message, False)
        self._message.show()

        alignment = gtk.Alignment(xalign=0.5, yalign=0.5)
        self._vbox.pack_start(alignment, expand=False)
        alignment.show()

        self._show_journal = gtk.Button()
        self._show_journal.set_label(_('Show Journal'))
        alignment.add(self._show_journal)
        self._show_journal.show()
        self._show_journal.connect('clicked', self.__show_journal_cb)

        self.add(self._main_view)
        self._main_view.show()

        self.connect('realize', self.__realize_cb)
开发者ID:nemesiscodex,项目名称:JukyOS-sugar,代码行数:59,代码来源:modalalert.py


示例7: InlineAlert

class InlineAlert(gtk.HBox):
    """UI interface for Inline alerts

    Inline alerts are different from the other alerts beause they are
    no dialogs, they only inform about a current event.

    Properties:
        'msg': the message of the alert,
        'icon': the icon that appears at the far left
    See __gproperties__
    """

    __gtype_name__ = 'SugarInlineAlert'

    __gproperties__ = {
        'msg': (str, None, None, None, gobject.PARAM_READWRITE),
        'icon': (object, None, None, gobject.PARAM_WRITABLE),
    }

    def __init__(self, **kwargs):

        self._msg = None
        self._msg_color = None
        self._icon = Icon(icon_name='emblem-warning',
                          fill_color=style.COLOR_SELECTION_GREY.get_svg(),
                          stroke_color=style.COLOR_WHITE.get_svg())

        self._msg_label = gtk.Label()
        self._msg_label.set_max_width_chars(50)
        self._msg_label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
        self._msg_label.set_alignment(0, 0.5)
        self._msg_label.modify_fg(gtk.STATE_NORMAL,
                                  style.COLOR_SELECTION_GREY.get_gdk_color())

        gobject.GObject.__init__(self, **kwargs)

        self.set_spacing(style.DEFAULT_SPACING)
        self.modify_bg(gtk.STATE_NORMAL,
                       style.COLOR_WHITE.get_gdk_color())

        self.pack_start(self._icon, False)
        self.pack_start(self._msg_label, False)
        self._msg_label.show()
        self._icon.show()

    def do_set_property(self, pspec, value):
        if pspec.name == 'msg':
            if self._msg != value:
                self._msg = value
                self._msg_label.set_markup(self._msg)
        elif pspec.name == 'icon':
            if self._icon != value:
                self._icon = value

    def do_get_property(self, pspec):
        if pspec.name == 'msg':
            return self._msg
开发者ID:nemesiscodex,项目名称:JukyOS-sugar,代码行数:57,代码来源:inlinealert.py


示例8: refresh

 def refresh(self,widget=None):
     default, uri = self.load_license()
     icon_name = self.uri_to_icon(uri)
     logging.debug("Refreshing ToolButton Icon")
     icon = Icon(icon_name,icon_size=self._icon_size,xo_color=XoColor("#ffffff,#ffffff"))
     icon.show()
     self.set_icon_widget(icon)
     self.set_tooltip(self._format_tooltip(uri))
     self.make_menu(self.get_palette(),XoColor("#ffffff,#ffffff"),self._color_selected,icon)
开发者ID:cc-archive,项目名称:liblicense-sugar,代码行数:9,代码来源:sugar.py


示例9: add_action

    def add_action(self, label, icon_name=None):
        button = gtk.Button(label)

        if icon_name:
            icon = Icon(icon_name)
            button.set_image(icon)
            icon.show()

        self.pack_start(button)
        button.show()
开发者ID:i5o,项目名称:sugar-toolkit,代码行数:10,代码来源:palette.py


示例10: __init__

    def __init__(self, **kwargs):
        self._pulser = Pulser(self)
        self._base_color = None
        self._pulse_color = None
        self._paused = False
        self._pulsing = False

        Icon.__init__(self, **kwargs)

        self._palette = None
        self.connect('destroy', self.__destroy_cb)
开发者ID:nemesiscodex,项目名称:JukyOS-sugar,代码行数:11,代码来源:pulsingicon.py


示例11: __init__

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

        self._activity = activity
        self._updating_share = False
        self._focus_out_hid = None

        activity.connect('shared', self.__activity_shared_cb)
        activity.connect('joined', self.__activity_shared_cb)
        activity.connect('notify::max_participants',
                         self.__max_participants_changed_cb)

        if activity.metadata:
            self.title = gtk.Entry()
            self.title.set_size_request(int(gtk.gdk.screen_width() / 3), -1)
            self.title.set_text(activity.metadata['title'])
            self._focus_out_hid = self.title.connect('focus-out-event',
                                                     self.__title_changed_cb)
            self._add_widget(self.title)

            activity.metadata.connect('updated', self.__jobject_updated_cb)

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        self.insert(separator, -1)
        separator.show()

        self.share = ToolComboBox(label_text=_('Share with:'))
        self.share.combo.connect('changed', self.__share_changed_cb)
        self.share.combo.append_item(SCOPE_PRIVATE, _('Private'), 'zoom-home')
        self.share.combo.append_item(SCOPE_NEIGHBORHOOD, _('My Neighborhood'),
                                     'zoom-neighborhood')
        self.insert(self.share, -1)
        self.share.show()

        self._update_share()

        self.keep = ToolButton(tooltip=_('Keep'))
        client = gconf.client_get_default()
        color = XoColor(client.get_string('/desktop/sugar/user/color'))
        keep_icon = Icon(icon_name='document-save', xo_color=color)
        self.keep.set_icon_widget(keep_icon)
        keep_icon.show()
        self.keep.props.accelerator = '<Ctrl>S'
        self.keep.connect('clicked', self.__keep_clicked_cb)
        self.insert(self.keep, -1)
        self.keep.show()

        self.stop = ToolButton('activity-stop', tooltip=_('Stop'))
        self.stop.props.accelerator = '<Ctrl>Q'
        self.stop.connect('clicked', self.__stop_clicked_cb)
        self.insert(self.stop, -1)
        self.stop.show()
开发者ID:dannyiland,项目名称:OLPC-Mesh-Messenger,代码行数:54,代码来源:activity.py


示例12: _add_playback_button

 def _add_playback_button(self, nick, colors, audio_file):
     ''' Add a toolbar button for this audio recording '''
     if nick not in self._playback_buttons:
         self._playback_buttons[nick] = button_factory(
             'xo-chat',  self.record_toolbar,
             self._playback_recording_cb, cb_arg=nick,
             tooltip=_('Audio recording by %s') % (nick))
         xocolor = XoColor('%s,%s' % (colors[0], colors[1]))
         icon = Icon(icon_name='xo-chat', xo_color=xocolor)
         icon.show()
         self._playback_buttons[nick].set_icon_widget(icon)
         self._playback_buttons[nick].show()
     self._audio_recordings[nick] = audio_file
开发者ID:walterbender,项目名称:bulletinboard,代码行数:13,代码来源:BBoardActivity.py


示例13: EventIcon

class EventIcon(gtk.EventBox):
    __gtype_name__ = 'SugarEventIcon'

    def __init__(self, **kwargs):
        gtk.EventBox.__init__(self)

        self.icon = Icon(pixel_size=style.XLARGE_ICON_SIZE, **kwargs)

        self.set_visible_window(False)
        self.set_app_paintable(True)
        self.set_events(gtk.gdk.BUTTON_PRESS_MASK)

        self.add(self.icon)
        self.icon.show()
开发者ID:nemesiscodex,项目名称:JukyOS-sugar,代码行数:14,代码来源:view.py


示例14: __init__

    def __init__(self, activity, **kwargs):
        ToolButton.__init__(self, **kwargs)
        logging.warning('KeepButton has been deprecated since Sugar 0.94'
                        ' and should not be used in newly written code.')
        self.props.tooltip = _('Keep')
        self.props.accelerator = '<Ctrl>S'

        client = gconf.client_get_default()
        color = XoColor(client.get_string('/desktop/sugar/user/color'))
        keep_icon = Icon(icon_name='document-save', xo_color=color)
        keep_icon.show()

        self.set_icon_widget(keep_icon)
        self.connect('clicked', self.__keep_button_clicked_cb, activity)
开发者ID:Daksh,项目名称:sugar-toolkit,代码行数:14,代码来源:widgets.py


示例15: __init__

    def __init__(self, timeout=5, **kwargs):
        Alert.__init__(self, **kwargs)

        self._timeout = timeout

        icon = Icon(icon_name='dialog-cancel')
        self.add_button(gtk.RESPONSE_CANCEL, _('Cancel'), icon)
        icon.show()

        self._timeout_text = _TimeoutIcon()
        self._timeout_text.set_text(self._timeout)
        self.add_button(gtk.RESPONSE_OK, _('Continue'), self._timeout_text)
        self._timeout_text.show()

        gobject.timeout_add_seconds(1, self.__timeout)
开发者ID:sugarlabs,项目名称:sugar-toolkit,代码行数:15,代码来源:alert.py


示例16: __init__

    def __init__(self, file_transfer):
        ToolButton.__init__(self)

        self.file_transfer = file_transfer
        file_transfer.connect('notify::state', self.__notify_state_cb)

        icon = Icon()
        self.props.icon_widget = icon
        icon.show()

        self.notif_icon = NotificationIcon()
        self.notif_icon.connect('button-release-event',
                                 self.__button_release_event_cb)

        self.connect('clicked', self.__button_clicked_cb)
开发者ID:nemesiscodex,项目名称:JukyOS-sugar,代码行数:15,代码来源:activitiestray.py


示例17: UnfullscreenButton

class UnfullscreenButton(gtk.Window):

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

        self.set_decorated(False)
        self.set_resizable(False)
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)

        self.set_border_width(0)

        self.props.accept_focus = False

        #Setup estimate of width, height
        w, h = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
        self._width = w
        self._height = h

        self.connect('size-request', self._size_request_cb)

        screen = self.get_screen()
        screen.connect('size-changed', self._screen_size_changed_cb)

        self._button = gtk.Button()
        self._button.set_relief(gtk.RELIEF_NONE)

        self._icon = Icon(icon_name='view-return',
                            icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR)
        self._icon.show()
        self._button.add(self._icon)

        self._button.show()
        self.add(self._button)

    def connect_button_press(self, cb):
        self._button.connect('button-press-event', cb)

    def _reposition(self):
        x = gtk.gdk.screen_width() - self._width
        self.move(x, 0)

    def _size_request_cb(self, widget, req):
        self._width = req.width
        self._height = req.height
        self._reposition()

    def _screen_size_changed_cb(self, screen):
        self._reposition()
开发者ID:dannyiland,项目名称:OLPC-Mesh-Messenger,代码行数:48,代码来源:window.py


示例18: make_menu

 def make_menu(self,palette,color,color_selected,current_icon):
     for uri, icon_name in self._licenses:
         tmp = gtk.HBox()
         tmp.show()
         if current_icon==icon_name:
             xo_color = color_selected
         else:
             xo_color = color
         icon = Icon(icon_name,icon_size=self._icon_size,xo_color=xo_color)
         icon.show()
         tmp.pack_start(icon,False,False)
         item = gtk.MenuItem()
         item.add(tmp)
         item.connect('activate', self._license_cb,uri)
         palette.menu.append(item)
         item.show()
开发者ID:cc-archive,项目名称:liblicense-sugar,代码行数:16,代码来源:sugar.py


示例19: __init__

    def __init__(self, icon_name, scroll_direction):
        gobject.GObject.__init__(self)

        self._viewport = None

        self._scroll_direction = scroll_direction

        self.set_relief(gtk.RELIEF_NONE)
        self.set_size_request(style.GRID_CELL_SIZE, style.GRID_CELL_SIZE)

        icon = Icon(icon_name = icon_name,
                    icon_size=gtk.ICON_SIZE_SMALL_TOOLBAR)
        self.set_image(icon)
        icon.show()

        self.connect('clicked', self._clicked_cb)
开发者ID:ceibal-tatu,项目名称:record-gnome,代码行数:16,代码来源:tray.py


示例20: __init__

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

        self.set_decorated(False)
        self.set_resizable(False)
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)

        self.set_border_width(0)

        self.props.accept_focus = False

        #Setup estimate of width, height
        w, h = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
        self._width = w
        self._height = h

        self.connect('size-request', self._size_request_cb)

        screen = self.get_screen()
        screen.connect('size-changed', self._screen_size_changed_cb)

        self._button = gtk.Button()
        self._button.set_relief(gtk.RELIEF_NONE)

        self._icon = Icon(icon_name='view-return',
                            icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR)
        self._icon.show()
        self._button.add(self._icon)

        self._button.show()
        self.add(self._button)
开发者ID:dannyiland,项目名称:OLPC-Mesh-Messenger,代码行数:31,代码来源:window.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python menuitem.MenuItem类代码示例发布时间:2022-05-27
下一篇:
Python datastore.write函数代码示例发布时间: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