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


Python Theme.get_from_set方法代码示例

本文整理汇总了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)
开发者ID:M7S,项目名称:dockbarx,代码行数:70,代码来源:iconfactory.py


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