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


Python Theme.get_windows_cnt方法代码示例

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


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

示例1: IconFactory

# 需要导入模块: from theme import Theme [as 别名]
# 或者: from theme.Theme import get_windows_cnt [as 别名]
class IconFactory():
    """IconFactory finds the icon for a program and prepares the cairo surface."""
    icon_theme = gtk.icon_theme_get_default()
    # Constants
    # Icon types
    SOME_MINIMIZED = 1<<4
    ALL_MINIMIZED = 1<<5
    LAUNCHER = 1<<6
    # Icon effects
    MOUSE_OVER = 1<<7
    MOUSE_BUTTON_DOWN = 1<<8
    NEEDS_ATTENTION = 1<<9
    BLINK  = 1<<10
    # ACTIVE_WINDOW
    ACTIVE = 1<<11
    LAUNCH_EFFECT = 1<<12
    # Double width/height icons for drag and drop situations.
    DRAG_DROPP_START = 1<<13
    DRAG_DROPP_END = 1<<14
    TYPE_DICT = {"some_minimized":SOME_MINIMIZED,
                 "all_minimized":ALL_MINIMIZED,
                 "launcher":LAUNCHER,
                 "mouse_over":MOUSE_OVER,
                 "needs_attention":NEEDS_ATTENTION,
                 "blink":BLINK,
                 "active":ACTIVE,
                 "launching":LAUNCH_EFFECT,
                 "mouse_button_down":MOUSE_BUTTON_DOWN}

    def __init__(self, group, class_group=None,
                 desktop_entry=None, identifier=None):
        self.dockbar_r = weakref.ref(group.dockbar_r())
        self.theme = Theme()
        self.globals = Globals()
        connect(self.globals, "color-changed", self.reset_surfaces)
        self.desktop_entry = desktop_entry
        self.identifier = identifier
        self.class_group = class_group

        # Setting size to something other than zero to
        # avoid crashes if surface_update() is runned
        # before the size is set.
        self.size = 15

        self.icon = None
        self.surfaces = {}

        self.average_color = None

        self.max_win_nr = self.theme.get_windows_cnt()
        self.types_in_theme = 0
        for type in self.theme.get_types():
            if not type in self.TYPE_DICT:
                continue
            self.types_in_theme = self.types_in_theme | self.TYPE_DICT[type]

    def remove(self):
        del self.desktop_entry
        del self.class_group
        del self.icon
        del self.surfaces
        del self.theme

    def set_desktop_entry(self, desktop_entry):
        self.desktop_entry = desktop_entry
        self.surfaces = {}
        del self.icon
        self.icon = None

    def set_class_group(self, class_group):
        if not self.desktop_entry and not self.class_group:
            self.surfaces = {}
            del self.icon
            self.icon = None
        self.class_group = class_group

    def set_size(self, size):
        if size <= 0:
            # To avoid chrashes.
            size = 15
        self.size = size
        self.surfaces = {}
        self.average_color = None

    def get_size(self):
        return self.size

    def get_icon(self, size):
        return self.__find_icon_pixbuf(size)

    def reset_icon(self):
        self.icon = None

    def reset_surfaces(self, arg=None):
        self.surfaces = {}
        self.average_color = None


    def surface_update(self, type = 0):
        # Checks if the requested pixbuf is already
#.........这里部分代码省略.........
开发者ID:M7S,项目名称:dockbarx,代码行数:103,代码来源:iconfactory.py

示例2: IconFactory

# 需要导入模块: from theme import Theme [as 别名]
# 或者: from theme.Theme import get_windows_cnt [as 别名]
class IconFactory():
    """IconFactory takes care of finding the right icon for a program and prepares the cairo surface."""
    icon_theme = gtk.icon_theme_get_default()
    # Constants
    # Icon types
    SOME_MINIMIZED = 1<<4
    ALL_MINIMIZED = 1<<5
    LAUNCHER = 1<<6
    # Icon effects
    MOUSE_OVER = 1<<7
    MOUSE_BUTTON_DOWN = 1<<8
    NEEDS_ATTENTION = 1<<9
    BLINK  = 1<<10
    # ACTIVE_WINDOW
    ACTIVE = 1<<11
    LAUNCH_EFFECT = 1<<12
    # Double width/height icons for drag and drop situations.
    DRAG_DROPP = 1<<13
    TYPE_DICT = {'some_minimized':SOME_MINIMIZED,
                 'all_minimized':ALL_MINIMIZED,
                 'launcher':LAUNCHER,
                 'mouse_over':MOUSE_OVER,
                 'needs_attention':NEEDS_ATTENTION,
                 'blink':BLINK,
                 'active':ACTIVE,
                 'launching':LAUNCH_EFFECT,
                 'mouse_button_down':MOUSE_BUTTON_DOWN}

    def __init__(self, class_group=None,
                 desktop_entry=None, identifier=None):
        self.theme = Theme()
        self.globals = Globals()
        self.globals.connect('color-changed', self.reset_surfaces)
        self.desktop_entry = desktop_entry
        self.identifier = identifier
        self.class_group = class_group

        # Setting size to something other than zero to
        # avoid crashes if surface_update() is runned
        # before the size is set.
        self.size = 15

        self.icon = None
        self.surfaces = {}

        self.average_color = None

        self.max_win_nr = self.theme.get_windows_cnt()
        self.types_in_theme = 0
        for type in self.theme.get_types():
            if not type in self.TYPE_DICT:
                continue
            self.types_in_theme = self.types_in_theme | self.TYPE_DICT[type]

    def remove(self):
        del self.desktop_entry
        del self.class_group
        del self.icon
        del self.surfaces
        del self.theme

    def set_desktop_entry(self, desktop_entry):
        self.desktop_entry = desktop_entry
        self.surfaces = {}
        del self.icon
        self.icon = None

    def set_class_group(self, class_group):
        if not self.desktop_entry and not self.class_group:
            self.surfaces = {}
            del self.icon
            self.icon = None
        self.class_group = class_group

    def set_size(self, size):
        if size <= 0:
            # To avoid chrashes.
            size = 15
        self.size = size
        self.surfaces = {}
        self.average_color = None

    def get_size(self):
        return self.size

    def reset_surfaces(self, arg=None):
        self.surfaces = {}
        self.average_color = None


    def surface_update(self, type = 0):
        # Checks if the requested pixbuf is already
        # drawn and returns it if it is.
        # Othervice the surface is drawn, saved and returned.

        #The first four bits of type is for telling the number of windows
        self.win_nr = min(type & 15, self.max_win_nr)
        # Remove all types that are not used by the theme (saves memory)
        dnd = type & self.DRAG_DROPP
        type = type & self.types_in_theme
#.........这里部分代码省略.........
开发者ID:valentt,项目名称:Fusion-Linux-Extras,代码行数:103,代码来源:iconfactory.py


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