Exemple #1
0
    def setup(self):
        icon = self.frame.client.win.get_icon(self.pos['width'],
                                              self.pos['height'])

        # If for some reason we couldn't get an icon...
        if icon is None or not icon['width'] or not icon['height']:
            for st in self._imgs:
                self._imgs[st] = rendering.box(self.frame.colors[st]['bg'],
                                               self.pos['width'],
                                               self.pos['height'])

            return

        # Blending time... yuck
        im = image.get_image(icon['width'], icon['height'], icon['data'])
        im = im.resize((self.pos['width'], self.pos['height']))

        if 'mask' in icon and icon['mask'] and icon['mask'] != icon['data']:
            immask = image.get_bitmap(icon['width'], icon['height'],
                                      icon['mask'])
            immask = immask.resize((self.pos['width'], self.pos['height']))
        else:
            immask = im.copy()

        for st in self._imgs:
            im = rendering.blend(im, immask, self.frame.colors[st]['bg'],
                                 self.pos['width'], self.pos['height'])

            self._imgs[st] = image.get_data(im)
Exemple #2
0
    def __init__(self, *_):
        _PopupWindow.__init__(self)

        self.width = self.height = c_icn_sz + (2 * c_brdr_sz)

        self.configure(width=self.width, height=self.height)

        icon = self.client.win.get_icon(c_icn_sz, c_icn_sz)

        im = image.get_image(icon['width'], icon['height'], icon['data'])
        im = im.resize((c_icn_sz, c_icn_sz))

        if 'mask' in icon and icon['mask'] and icon['mask'] != icon['data']:
            immask = image.get_bitmap(icon['width'], icon['height'],
                                      icon['mask'])
            immask = immask.resize((c_icn_sz, c_icn_sz))
        else:
            immask = im.copy()

        alpha = 1
        if not self.client.mapped:
            alpha = 0.3
        icon_im = rendering.blend(im, immask, c_bg, c_icn_sz, c_icn_sz, alpha)

        im_inactive = rendering.box(c_bg, self.width, self.height)
        im_inactive.paste(icon_im, box=(c_brdr_sz, c_brdr_sz))

        im_active = rendering.box(c_brdr_clr, self.width, self.height)
        im_active.paste(icon_im, box=(c_brdr_sz, c_brdr_sz))

        self.inactive = image.get_data(im_inactive)
        self.active = image.get_data(im_active)

        self.render_inactive()

        self.map()