本文整理匯總了Python中theme.Theme.get_from_set方法的典型用法代碼示例。如果您正苦於以下問題:Python Theme.get_from_set方法的具體用法?Python Theme.get_from_set怎麽用?Python Theme.get_from_set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類theme.Theme
的用法示例。
在下文中一共展示了Theme.get_from_set方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: IconFactory
# 需要導入模塊: from theme import Theme [as 別名]
# 或者: from theme.Theme import get_from_set [as 別名]
#.........這裏部分代碼省略.........
elif fg in self.temp:
foreground = self.temp[fg]
if angle and angle != "0":
foreground = self.__command_rotate(foreground,
angle, True)
elif self.theme.has_surface(fg):
foreground = self.theme.get_surface(fg)
if angle and angle != "0":
foreground = self.__command_rotate(foreground,
angle, True)
w = surface.get_width()
h = surface.get_height()
foreground = self.__resize_surface(foreground, w, h)
else:
logger.warning("theme error: pixmap %s not found" % fg)
return surface
if bg == "self":
background = surface
elif bg in self.temp:
w = self.temp[bg].get_width()
h = self.temp[bg].get_height()
background = cairo.ImageSurface(cairo.FORMAT_ARGB32, w, h)
ctx = cairo.Context(background)
ctx.set_source_surface(self.temp[bg])
ctx.paint()
elif self.theme.has_surface(bg):
w = surface.get_width()
h = surface.get_height()
background = self.__resize_surface(self.theme.get_surface(bg), w, h)
else:
logger.warning("theme error: pixmap %s not found" % bg)
return surface
xoffset = self.__get_from_set(xoffset)
yoffset = self.__get_from_set(yoffset)
opacity = self.__get_alpha(opacity)
xoffset = self.__process_size(xoffset)
yoffset = self.__process_size(yoffset)
ctx = cairo.Context(background)
ctx.set_source_surface(foreground, xoffset, yoffset)
ctx.paint_with_alpha(opacity)
return background
def __command_shrink(self, surface, percent="0", pixels="0"):
w0 = surface.get_width()
h0 = surface.get_height()
new = cairo.ImageSurface(cairo.FORMAT_ARGB32, w0, h0)
ctx = cairo.Context(new)
pixels = self.__get_from_set(pixels)
percent = self.__get_from_set(percent)
w = int(((100-int(percent)) * w0)/100)-int(pixels)
h = int(((100-int(percent)) * h0)/100)-int(pixels)
shrinked = self.__resize_surface(surface, w, h)
x = round((w0 - w) / 2.0)
y = round((h0 - h) / 2.0)
ctx.set_source_surface(shrinked, x, y)
ctx.paint()
del shrinked
return new
def __command_rotate(self, surface, angle="0", resize="False"):
w0 = surface.get_width()
h0 = surface.get_height()
# Check if the angle should be taken from a set.
angle = self.__get_from_set(angle)