cellrenderers.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:x-mario-center 作者: fossasia 项目源码 文件源码
def _render_icon(self, cr, app, cell_area, xpad, ypad, is_rtl):
        # calc offsets so icon is nicely centered
        self.icon = self.model.get_icon(app)
        self.icon_x_offset = xpad + cell_area.x
        self.icon_y_offset = ypad + cell_area.y
        xo = (self.pixbuf_width - self.icon.get_width()) / 2

        if not is_rtl:
            x = cell_area.x + xo + xpad
        else:
            x = cell_area.x + cell_area.width + xo - self.pixbuf_width - xpad
        y = cell_area.y + ypad

        # draw appicon pixbuf
        Gdk.cairo_set_source_pixbuf(cr, self.icon, x, y)
        cr.paint()

        # draw overlay if application is installed
        if self.model.is_installed(app):
            if not is_rtl:
                x += (self.pixbuf_width - self.OVERLAY_SIZE + self.OVERLAY_XO)
            else:
                x -= self.OVERLAY_XO
            y += (self.pixbuf_width - self.OVERLAY_SIZE + self.OVERLAY_YO)
            Gdk.cairo_set_source_pixbuf(cr, self._installed, x, y)
            cr.paint()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号