Пример #1
0
def find_image(filename):
    logger.log( 9, 'Looking for %s (icontheme %s)', filename, icontheme)

    if filename.startswith('http://') or filename.startswith('https://'):
        return filename

    if icontheme:
        dirs = [os.path.join(config.IMAGE_DIR, 'osd', icontheme),
                os.path.join(config.ICON_DIR, 'osd', icontheme)]
    else:
        dirs = []
    dirs = dirs + [os.path.join(config.IMAGE_DIR, 'osd'),
                   os.path.join(config.ICON_DIR, 'osd'),
                   config.IMAGE_DIR,
                   config.ICON_DIR]
    for dir in dirs:
        dfile=os.path.join(dir, filename)

        if vfs.isfile(dfile):
            return vfs.abspath(dfile)

        if vfs.isfile("%s.png" % dfile):
            return vfs.abspath("%s.png" % dfile)

        if vfs.isfile("%s.jpg" % dfile):
            return vfs.abspath("%s.jpg" % dfile)

    report_error('Can\'t find image \"%s\"' % filename)

    if config.DEBUG:
        logger.debug('image search path is:')
        for dir in dirs:
            logger.debug(dir)

    return ''
Пример #2
0
def parse(filename):
    if not vfs.isfile(filename):
        if vfs.isfile(filename+'.fxd'):
            filename += '.fxd'

        elif vfs.isfile(vfs.join(config.SKIN_DIR, 'osd', '%s.fxd' % filename)):
            filename = vfs.join(config.SKIN_DIR, 'osd', '%s.fxd' % filename)

        else:
            filename = vfs.join(config.SKIN_DIR, 'osd', filename)

    if not vfs.isfile(filename):
        logger.debug('Failed to load OSD skin file: %s', filename)
        return
    logger.debug('Loading OSD skin file %s', filename)
    parser = util.fxdparser.FXD(filename)
    parser.set_handler('osds', osds_callback)
    parser.parse()
Пример #3
0
def parse(filename):
    if not vfs.isfile(filename):
        if vfs.isfile(filename + '.fxd'):
            filename += '.fxd'

        elif vfs.isfile(vfs.join(config.SKIN_DIR, 'osd', '%s.fxd' % filename)):
            filename = vfs.join(config.SKIN_DIR, 'osd', '%s.fxd' % filename)

        else:
            filename = vfs.join(config.SKIN_DIR, 'osd', filename)

    if not vfs.isfile(filename):
        logger.debug('Failed to load OSD skin file: %s', filename)
        return
    logger.debug('Loading OSD skin file %s', filename)
    parser = util.fxdparser.FXD(filename)
    parser.set_handler('osds', osds_callback)
    parser.parse()
Пример #4
0
def find_image(filename):
    logger.log(9, 'Looking for %s (icontheme %s)', filename, icontheme)

    if filename.startswith('http://') or filename.startswith('https://'):
        return filename

    if icontheme:
        dirs = [
            os.path.join(config.IMAGE_DIR, 'osd', icontheme),
            os.path.join(config.ICON_DIR, 'osd', icontheme)
        ]
    else:
        dirs = []
    dirs = dirs + [
        os.path.join(config.IMAGE_DIR, 'osd'),
        os.path.join(config.ICON_DIR, 'osd'), config.IMAGE_DIR, config.ICON_DIR
    ]
    for dir in dirs:
        dfile = os.path.join(dir, filename)

        if vfs.isfile(dfile):
            return vfs.abspath(dfile)

        if vfs.isfile("%s.png" % dfile):
            return vfs.abspath("%s.png" % dfile)

        if vfs.isfile("%s.jpg" % dfile):
            return vfs.abspath("%s.jpg" % dfile)

    report_error('Can\'t find image \"%s\"' % filename)

    if config.DEBUG:
        logger.debug('image search path is:')
        for dir in dirs:
            logger.debug(dir)

    return ''