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


Python PulsingIcon.set_base_color方法代码示例

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


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

示例1: LaunchWindow

# 需要导入模块: from jarabe.view.pulsingicon import PulsingIcon [as 别名]
# 或者: from jarabe.view.pulsingicon.PulsingIcon import set_base_color [as 别名]
class LaunchWindow(gtk.Window):

    def __init__(self, activity_id, icon_path, icon_color):
        gobject.GObject.__init__(self)

        self.props.type_hint = gtk.gdk.WINDOW_TYPE_HINT_NORMAL
        self.props.decorated = False
        self.modify_bg(gtk.STATE_NORMAL, style.COLOR_WHITE.get_gdk_color())

        canvas = gtk.VBox()
        canvas.show()
        self.add(canvas)

        bar_size = gtk.gdk.screen_height() / 5 * 2

        header = gtk.VBox()
        header.set_size_request(-1, bar_size)
        header.show()
        canvas.pack_start(header, expand=False)

        self._activity_id = activity_id

        self._activity_icon = PulsingIcon(file=icon_path,
                                          pixel_size=style.XLARGE_ICON_SIZE)
        self._activity_icon.set_base_color(icon_color)
        self._activity_icon.set_zooming(style.SMALL_ICON_SIZE,
                                        style.XLARGE_ICON_SIZE, 10)
        self._activity_icon.set_pulsing(True)
        self._activity_icon.show()
        canvas.pack_start(self._activity_icon)

        footer = gtk.VBox(spacing=style.DEFAULT_SPACING)
        footer.set_size_request(-1, bar_size)
        footer.show()
        canvas.pack_end(footer, expand=False)

        self.error_text = gtk.Label()
        self.error_text.props.use_markup = True
        footer.pack_start(self.error_text, expand=False)

        button_box = gtk.Alignment(xalign=0.5)
        button_box.show()
        footer.pack_start(button_box, expand=False)
        self.cancel_button = gtk.Button(stock=gtk.STOCK_STOP)
        button_box.add(self.cancel_button)

        self.connect('realize', self.__realize_cb)

        screen = gtk.gdk.screen_get_default()
        screen.connect('size-changed', self.__size_changed_cb)

        self._home = shell.get_model()
        self._home.connect('active-activity-changed',
                           self.__active_activity_changed_cb)

        self.connect('destroy', self.__destroy_cb)

        self._update_size()

    def show(self):
        self.present()

    def _update_size(self):
        self.resize(gtk.gdk.screen_width(), gtk.gdk.screen_height())

    def __realize_cb(self, widget):
        wm.set_activity_id(widget.window, str(self._activity_id))
        widget.window.property_change('_SUGAR_WINDOW_TYPE', 'STRING', 8,
                                      gtk.gdk.PROP_MODE_REPLACE, 'launcher')

    def __size_changed_cb(self, screen):
        self._update_size()

    def __active_activity_changed_cb(self, model, activity):
        if activity.get_activity_id() == self._activity_id:
            self._activity_icon.props.paused = False
        else:
            self._activity_icon.props.paused = True

    def __destroy_cb(self, box):
        self._activity_icon.props.pulsing = False
        self._home.disconnect_by_func(self.__active_activity_changed_cb)
开发者ID:nemesiscodex,项目名称:JukyOS-sugar,代码行数:84,代码来源:launcher.py

示例2: LaunchWindow

# 需要导入模块: from jarabe.view.pulsingicon import PulsingIcon [as 别名]
# 或者: from jarabe.view.pulsingicon.PulsingIcon import set_base_color [as 别名]
class LaunchWindow(Gtk.Window):

    def __init__(self, activity_id, icon_path, icon_color):
        Gtk.Window.__init__(self)
        self.set_has_resize_grip(False)

        self.props.type_hint = Gdk.WindowTypeHint.SPLASHSCREEN
        self.modify_bg(Gtk.StateType.NORMAL, style.COLOR_WHITE.get_gdk_color())

        canvas = Gtk.VBox()
        canvas.show()
        self.add(canvas)

        bar_size = Gdk.Screen.height() / 5 * 2

        header = Gtk.VBox()
        header.set_size_request(-1, bar_size)
        header.show()
        canvas.pack_start(header, False, True, 0)

        self._activity_id = activity_id

        self._activity_icon = PulsingIcon(file=icon_path,
                                          pixel_size=style.XLARGE_ICON_SIZE)
        self._activity_icon.set_base_color(icon_color)
        self._activity_icon.set_zooming(style.SMALL_ICON_SIZE,
                                        style.XLARGE_ICON_SIZE, 10)
        self._activity_icon.set_pulsing(True)
        self._activity_icon.show()
        canvas.pack_start(self._activity_icon, True, True, 0)

        footer = Gtk.VBox(spacing=style.DEFAULT_SPACING)
        footer.set_size_request(-1, bar_size)
        footer.show()
        canvas.pack_end(footer, False, True, 0)

        self.error_text = Gtk.Label()
        self.error_text.props.use_markup = True
        footer.pack_start(self.error_text, False, True, 0)

        button_box = Gtk.Alignment.new(0.5, 0, 0, 0)
        button_box.show()
        footer.pack_start(button_box, False, True, 0)
        self.cancel_button = Gtk.Button(stock=Gtk.STOCK_STOP)
        button_box.add(self.cancel_button)

        self.connect('realize', self.__realize_cb)

        screen = Gdk.Screen.get_default()
        screen.connect('size-changed', self.__size_changed_cb)

        self._home = shell.get_model()
        self._home.connect('active-activity-changed',
                           self.__active_activity_changed_cb)

        self.connect('destroy', self.__destroy_cb)

        self._update_size()

    def show(self):
        self.present()

    def _update_size(self):
        self.resize(Gdk.Screen.width(), Gdk.Screen.height())

    def __realize_cb(self, widget):
        SugarExt.wm_set_activity_id(widget.get_window().get_xid(),
                                    str(self._activity_id))

    def __size_changed_cb(self, screen):
        self._update_size()

    def __active_activity_changed_cb(self, model, activity):
        if activity.get_activity_id() == self._activity_id:
            self._activity_icon.props.paused = False
        else:
            self._activity_icon.props.paused = True

    def __destroy_cb(self, box):
        self._activity_icon.props.pulsing = False
        self._home.disconnect_by_func(self.__active_activity_changed_cb)
开发者ID:ajaygarg84,项目名称:sugar,代码行数:83,代码来源:launcher.py


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