本文整理匯總了Python中theme.Theme.get_types方法的典型用法代碼示例。如果您正苦於以下問題:Python Theme.get_types方法的具體用法?Python Theme.get_types怎麽用?Python Theme.get_types使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類theme.Theme
的用法示例。
在下文中一共展示了Theme.get_types方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: IconFactory
# 需要導入模塊: from theme import Theme [as 別名]
# 或者: from theme.Theme import get_types [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
#.........這裏部分代碼省略.........
示例2: IconFactory
# 需要導入模塊: from theme import Theme [as 別名]
# 或者: from theme.Theme import get_types [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
#.........這裏部分代碼省略.........