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


Python Icon.show方法代码示例

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


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

示例1: __init__

# 需要导入模块: from sugar3.graphics.icon import Icon [as 别名]
# 或者: from sugar3.graphics.icon.Icon import show [as 别名]
    def __init__(self, icon_name):
        
        Gtk.Button.__init__(self)
        
        self.modify_bg(
            Gtk.StateType.NORMAL,
            style.COLOR_TOOLBAR_GREY.get_gdk_color())
            
        self.modify_bg(
            Gtk.StateType.ACTIVE,
            style.COLOR_BUTTON_GREY.get_gdk_color())
            
        self.set_relief(Gtk.ReliefStyle.NONE)
        
        self.set_size_request(
            style.GRID_CELL_SIZE,
            style.GRID_CELL_SIZE)

        icon = Icon(
            icon_name = icon_name,
            icon_size = Gtk.IconSize.SMALL_TOOLBAR)
            
        self.set_image(icon)
        
        icon.show()
        
        self.show_all()
        
        #self.connect('clicked', self._clicked_cb)
        
开发者ID:i5o,项目名称:record-gtk3,代码行数:31,代码来源:Widgets.py

示例2: __init__

# 需要导入模块: from sugar3.graphics.icon import Icon [as 别名]
# 或者: from sugar3.graphics.icon.Icon import show [as 别名]
    def __init__(self):
        ToolButton.__init__(self)

        self._property = 'timestamp'
        self._order = Gtk.SortType.ASCENDING

        self.props.tooltip = _('Sort view')
        self.props.icon_name = 'view-lastedit'

        self.props.hide_tooltip_on_click = False
        self.palette_invoker.props.toggle_palette = True

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

        sort_options = [
            ('timestamp', 'view-lastedit', _('Sort by date modified')),
            ('creation_time', 'view-created', _('Sort by date created')),
            ('filesize', 'view-size', _('Sort by size')),
        ]

        for property_, icon, label in sort_options:
            button = PaletteMenuItem(label)
            button_icon = Icon(pixel_size=style.SMALL_ICON_SIZE,
                               icon_name=icon)
            button.set_image(button_icon)
            button_icon.show()
            button.connect('activate',
                           self.__sort_type_changed_cb,
                           property_,
                           icon)
            button.show()
            menu_box.append_item(button)
开发者ID:AbrahmAB,项目名称:sugar,代码行数:36,代码来源:journaltoolbox.py

示例3: __init__

# 需要导入模块: from sugar3.graphics.icon import Icon [as 别名]
# 或者: from sugar3.graphics.icon.Icon import show [as 别名]
    def __init__(self, text_label=None, icon_name=None, text_maxlen=60,
                 xo_color=None, file_name=None):
        GObject.GObject.__init__(self)
        self._accelerator = None

        label = Gtk.AccelLabel(label=text_label)
        label.set_alignment(0.0, 0.5)
        label.set_accel_widget(self)
        if text_maxlen > 0:
            label.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
            label.set_max_width_chars(text_maxlen)
        self.add(label)
        label.show()

        if icon_name is not None:
            icon = Icon(icon_name=icon_name,
                        icon_size=Gtk.IconSize.SMALL_TOOLBAR)
            if xo_color is not None:
                icon.props.xo_color = xo_color
            self.set_image(icon)
            icon.show()

        elif file_name is not None:
            icon = Icon(file=file_name, icon_size=Gtk.IconSize.SMALL_TOOLBAR)
            if xo_color is not None:
                icon.props.xo_color = xo_color
            self.set_image(icon)
            icon.show()

        self.connect('can-activate-accel', self.__can_activate_accel_cb)
        self.connect('hierarchy-changed', self.__hierarchy_changed_cb)
开发者ID:ceibal-tatu,项目名称:sugar-toolkit-gtk3,代码行数:33,代码来源:menuitem.py

示例4: __init__

# 需要导入模块: from sugar3.graphics.icon import Icon [as 别名]
# 或者: from sugar3.graphics.icon.Icon import show [as 别名]
    def __init__(self, text_label=None, icon_name=None,
                 text_maxlen=style.MENU_WIDTH_CHARS, xo_color=None,
                 file_name=None):
        GObject.GObject.__init__(self)
        self._accelerator = None

        label = Gtk.AccelLabel(label=text_label)
        label.set_alignment(0.0, 0.5)
        label.set_accel_widget(self)
        if text_maxlen > 0:
            label.set_ellipsize(style.ELLIPSIZE_MODE_DEFAULT)
            label.set_max_width_chars(text_maxlen)
        self.add(label)
        label.show()

        if icon_name is not None:
            icon = Icon(icon_name=icon_name,
                        pixel_size=style.SMALL_ICON_SIZE)
            if xo_color is not None:
                icon.props.xo_color = xo_color
            self.set_image(icon)
            icon.show()

        elif file_name is not None:
            icon = Icon(file=file_name, pixel_size=style.SMALL_ICON_SIZE)
            if xo_color is not None:
                icon.props.xo_color = xo_color
            self.set_image(icon)
            icon.show()

        self.connect('can-activate-accel', self.__can_activate_accel_cb)
        self.connect('hierarchy-changed', self.__hierarchy_changed_cb)
开发者ID:AbrahmAB,项目名称:sugar-toolkit-gtk3-proto,代码行数:34,代码来源:menuitem.py

示例5: _object_chooser

# 需要导入模块: from sugar3.graphics.icon import Icon [as 别名]
# 或者: from sugar3.graphics.icon.Icon import show [as 别名]
    def _object_chooser(self, mime_type, type_name):
        chooser = ObjectChooser()
        matches_mime_type = False

        response = chooser.run()
        if response == Gtk.ResponseType.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.ResponseType.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:sugarlabs,项目名称:AnalyzeJournal,代码行数:33,代码来源:activity.py

示例6: add_radio_buttons

# 需要导入模块: from sugar3.graphics.icon import Icon [as 别名]
# 或者: from sugar3.graphics.icon.Icon import show [as 别名]
    def add_radio_buttons(self, button_icons, colors=None):
        # Psuedo-radio buttons
        alignment = Gtk.Alignment.new(0.5, 0.5, 0, 0)
        grid = Gtk.Grid()
        grid.set_row_spacing(style.DEFAULT_SPACING)
        grid.set_column_spacing(style.DEFAULT_SPACING)
        grid.set_border_width(style.DEFAULT_SPACING * 2)
        buttons = []
        for i, button_icon in enumerate(button_icons):
            if colors is not None:
                icon = Icon(pixel_size=style.STANDARD_ICON_SIZE,
                            icon_name=button_icon,
                            stroke_color=colors.get_stroke_color(),
                            fill_color=colors.get_fill_color())
            else:
                icon = Icon(pixel_size=style.STANDARD_ICON_SIZE,
                            icon_name=button_icon)

            buttons.append(Gtk.Button())
            buttons[i].set_image(icon)
            icon.show()
            grid.attach(buttons[i], i, 0, 1, 1)
            buttons[i].show()

        alignment.add(grid)
        grid.show()
        self._attach(alignment)
        alignment.show()

        return buttons
开发者ID:walterbender,项目名称:OneSupport,代码行数:32,代码来源:graphics.py

示例7: add_icon

# 需要导入模块: from sugar3.graphics.icon import Icon [as 别名]
# 或者: from sugar3.graphics.icon.Icon import show [as 别名]
 def add_icon(self, icon_name, stroke=style.COLOR_BUTTON_GREY.get_svg(),
              fill=style.COLOR_TRANSPARENT.get_svg(),
              icon_size=style.XLARGE_ICON_SIZE):
     icon = Icon(pixel_size=icon_size, icon_name=icon_name,
                 stroke_color=stroke, fill_color=fill)
     self._attach(icon)
     icon.show()
开发者ID:walterbender,项目名称:OneSupport,代码行数:9,代码来源:graphics.py

示例8: _verify_settings

# 需要导入模块: from sugar3.graphics.icon import Icon [as 别名]
# 或者: from sugar3.graphics.icon.Icon import show [as 别名]
    def _verify_settings(self):
        self._proxy_alert.props.title = _('Please Wait!')
        self._proxy_alert.props.msg = _('Proxy settings are being verified.')
        self._proxy_alert.show()
        flag_all_true = True
        g_proxy_schema = self._proxy_settings['org.sugarlabs.system.proxy']
        g_mode = Gio.Settings.get_string(g_proxy_schema, 'mode')
        self.show_restart_alert = False

        if g_mode == 'auto':
            flag_all_true = os.path.isfile(Gio.Settings.get_string(
                g_proxy_schema, 'autoconfig-url'))
        elif g_mode == 'manual':
            flag_all_true = self._ping_servers()
        if flag_all_true:
            self.show_restart_alert = True
            self._proxy_alert.hide()
            self._apply_proxy_settings()
        else:
            self._proxy_alert.props.title = _('Error!')
            self._proxy_alert.props.msg = _('The following setting(s) seems '
                                            'to be incorrect and may break '
                                            'your internet connection')

            icon = Icon(icon_name='dialog-cancel')
            self._proxy_alert.add_button(Gtk.ResponseType.APPLY,
                                         _('Break my internet'), icon)
            icon.show()
            icon = Icon(icon_name='dialog-ok')
            self._proxy_alert.add_button(Gtk.ResponseType.CANCEL,
                                         _('Reset'), icon)
            icon.show()
开发者ID:junzy,项目名称:sugar,代码行数:34,代码来源:view.py

示例9: __init__

# 需要导入模块: from sugar3.graphics.icon import Icon [as 别名]
# 或者: from sugar3.graphics.icon.Icon import show [as 别名]
    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,代码行数:30,代码来源:viewsource.py

示例10: __init__

# 需要导入模块: from sugar3.graphics.icon import Icon [as 别名]
# 或者: from sugar3.graphics.icon.Icon import show [as 别名]
    def __init__(self, browser):
        GObject.GObject.__init__(self)

        browser.connect('notify::title', self.__title_changed_cb)
        browser.connect('notify::load-status', self.__load_status_changed_cb)

        self._title = _('Untitled')
        self._label = Gtk.Label(label=self._title)
        self._label.set_ellipsize(Pango.EllipsizeMode.END)
        self._label.set_alignment(0, 0.5)
        self.pack_start(self._label, True, True, 0)
        self._label.show()

        close_tab_icon = Icon(icon_name='browse-close-tab')
        button = Gtk.Button()
        button.props.relief = Gtk.ReliefStyle.NONE
        button.props.focus_on_click = False
        icon_box = Gtk.HBox()
        icon_box.pack_start(close_tab_icon, True, False, 0)
        button.add(icon_box)
        button.connect('clicked', self.__button_clicked_cb)
        button.set_name('browse-tab-close')
        self.pack_start(button, False, True, 0)
        close_tab_icon.show()
        icon_box.show()
        button.show()
        self._close_button = button
开发者ID:georgejhunt,项目名称:HaitiDictionary.activity,代码行数:29,代码来源:browser.py

示例11: _value_changed

# 需要导入模块: from sugar3.graphics.icon import Icon [as 别名]
# 或者: from sugar3.graphics.icon.Icon import show [as 别名]
    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.ResponseType.OK, _('Ok'), ok_icon)
            ok_icon.show()

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

            activity.add_alert(alert)

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

示例12: _show_journal_alert

# 需要导入模块: from sugar3.graphics.icon import Icon [as 别名]
# 或者: from sugar3.graphics.icon.Icon import show [as 别名]
    def _show_journal_alert(self, title, msg):
        _stop_alert = Alert()
        _stop_alert.props.title = title
        _stop_alert.props.msg = msg

        if _HAS_BUNDLE_LAUNCHER:
                bundle = get_bundle(object_id=self._object_id)

        if bundle is not None:
            icon = Icon(file=bundle.get_icon())
            label = _('Open with %s') % bundle.get_name()
            _stop_alert.add_button(Gtk.ResponseType.ACCEPT, label, icon)
        else:
            icon = Icon(icon_name='zoom-activity')
            label = _('Show in Journal')
            _stop_alert.add_button(Gtk.ResponseType.APPLY, label, icon)
        icon.show()

        ok_icon = Icon(icon_name='dialog-ok')
        _stop_alert.add_button(Gtk.ResponseType.OK, _('Ok'), ok_icon)
        ok_icon.show()
        # Remove other alerts
        for alert in self._alerts:
            self.remove_alert(alert)

        self.add_alert(_stop_alert)
        _stop_alert.connect('response', self.__stop_response_cb)
        _stop_alert.show()
开发者ID:leonardcj,项目名称:get-books-activity,代码行数:30,代码来源:GetIABooksActivity.py

示例13: __init__

# 需要导入模块: from sugar3.graphics.icon import Icon [as 别名]
# 或者: from sugar3.graphics.icon.Icon import show [as 别名]
    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,代码行数:36,代码来源:viewsource.py

示例14: __init__

# 需要导入模块: from sugar3.graphics.icon import Icon [as 别名]
# 或者: from sugar3.graphics.icon.Icon import show [as 别名]
    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,代码行数:36,代码来源:viewsource.py

示例15: __init__

# 需要导入模块: from sugar3.graphics.icon import Icon [as 别名]
# 或者: from sugar3.graphics.icon.Icon import show [as 别名]
    def __init__(self, text_label=None, icon_name=None, text_maxlen=60,
                 xo_color=None, file_name=None, image=None):
        super(MenuItem, self).__init__()
        self._accelerator = None
        self.props.submenu = None

        label = Gtk.AccelLabel(text_label)
        label.set_alignment(0.0, 0.5)
        label.set_accel_widget(self)
        if text_maxlen > 0:
            label.set_ellipsize(Pango.EllipsizeMode.MIDDLE)
            label.set_max_width_chars(text_maxlen)
        self.add(label)
        label.show()

        if image is not None:
            self.set_image(image)
            image.show()

        elif icon_name is not None:
            icon = Icon(icon_name=icon_name,
                        icon_size=Gtk.IconSize.SMALL_TOOLBAR)
            if xo_color is not None:
                icon.props.xo_color = xo_color
            self.set_image(icon)
            icon.show()

        elif file_name is not None:
            icon = Icon(file=file_name, icon_size=Gtk.IconSize.SMALL_TOOLBAR)
            if xo_color is not None:
                icon.props.xo_color = xo_color
            self.set_image(icon)
            icon.show()
开发者ID:sugarlabs,项目名称:laybrinth-activity,代码行数:35,代码来源:labyrinthactivity.py


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