示例#1
0
    def __setup_logo_image(self):
        icon_name = self.icon_setting.get_value(user='******')
        log.info('Get icon_name from user: gdm, icon name: %s' % icon_name)

        path = os.path.expanduser('~gdm/.icons/%s/apps/64/%s' % (
                                    self.icon_theme_setting.get_value(user='******'),
                                    self.icon_setting.get_value(user='******')))
        EXIST = False
        FORMAT = ''
        if proxy.is_exists(path + '.png'):
            path = path + '.png'
            EXIST = True
            FORMAT = '.png'
        elif proxy.is_exists(path + '.svg'):
            path = path + '.svg'
            EXIST = True
            FORMAT = '.svg'

        if EXIST:
            log.info("The icon path is: %s" % path)
            path = proxy.get_as_tempfile(path, os.getuid())
            log.debug('Custom log is exits, the tempfile is %s' % path)
            if FORMAT == '.svg':
                pixbuf = gtk.gdk.pixbuf_new_from_file(path)
                pixbuf = pixbuf.scale_simple(64, 64, gtk.gdk.INTERP_BILINEAR)
                self.logo_image.set_from_pixbuf(pixbuf)
            else:
                self.logo_image.set_from_file(path)
        else:
            icontheme = gtk.IconTheme()
            icontheme.set_custom_theme(self.icon_theme_setting.get_value(user='******'))
            try:
                self.logo_image.set_from_pixbuf(icontheme.load_icon(icon_name, 64, 0))
            except:
                pass
    def __setup_logo_image(self):
        icon_name = self.icon_setting.get_value(user="******")
        log.debug("Get icon_name from user: gdm, icon name: %s" % icon_name)

        path = os.path.expanduser(
            "~gdm/.icons/%s/apps/64/%s.png"
            % (self.icon_theme_setting.get_value(user="******"), self.icon_setting.get_value(user="******"))
        )

        if proxy.is_exists(path):
            path = proxy.get_as_tempfile(path)
            log.debug("Custom log is exits, the tempfile is %s" % path)
            self.logo_image.set_from_file(path)
        else:
            icontheme = gtk.IconTheme()
            icontheme.set_custom_theme(self.icon_theme_setting.get_value(user="******"))
            try:
                self.logo_image.set_from_pixbuf(icontheme.load_icon(icon_name, 64, 0))
            except:
                pass
示例#3
0
    def __setup_logo_image(self):
        icon_name = self.icon_setting.get_value(user='******')
        log.info('Get icon_name from user: gdm, icon name: %s' % icon_name)

        path = os.path.expanduser(
            '~gdm/.icons/%s/apps/64/%s' %
            (self.icon_theme_setting.get_value(user='******'),
             self.icon_setting.get_value(user='******')))
        EXIST = False
        FORMAT = ''
        if proxy.is_exists(path + '.png'):
            path = path + '.png'
            EXIST = True
            FORMAT = '.png'
        elif proxy.is_exists(path + '.svg'):
            path = path + '.svg'
            EXIST = True
            FORMAT = '.svg'

        if EXIST:
            log.info("The icon path is: %s" % path)
            path = proxy.get_as_tempfile(path, os.getuid())
            log.debug('Custom log is exits, the tempfile is %s' % path)
            if FORMAT == '.svg':
                pixbuf = gtk.gdk.pixbuf_new_from_file(path)
                pixbuf = pixbuf.scale_simple(64, 64, gtk.gdk.INTERP_BILINEAR)
                self.logo_image.set_from_pixbuf(pixbuf)
            else:
                self.logo_image.set_from_file(path)
        else:
            icontheme = gtk.IconTheme()
            icontheme.set_custom_theme(
                self.icon_theme_setting.get_value(user='******'))
            try:
                self.logo_image.set_from_pixbuf(
                    icontheme.load_icon(icon_name, 64, 0))
            except:
                pass