Пример #1
0
Файл: cfg.py Проект: rkulla/imgv
def get_color(line):
    color = chopnl(line).upper()  # strip newline and make case insensitive
    if color.find(',') != -1:
        color = color.split(',')
        if len(color) >= 3:
            try:
                color = (int(color[0]), int(color[1]), int(color[2]))
                return color
            except:
                errorbox("Error in imgv.conf", "'%s' is an invalid color" % (line[:-1]))
    elif color not in gl.COLORS.keys():
        errorbox("Error in imgv.conf", "'%s' is an invalid color" % (line[:-1]))
    return gl.COLORS[color]
Пример #2
0
SUBDIRS = 0
SORT_HIT = 0


IMG_TYPES = [".gif",".GIF", ".jpg",".JPG", ".jpeg",".JPEG", ".png",".PNG", ".bmp",".BMP", ".ppm",".PPM", ".pcx",".PCX", 
".tga",".TGA", ".tif",".TIF", ".tiff",".TIFF", ".pnm",".PNM", ".pbm",".PBM", ".pgm",".PGM", ".xpm",".XPM", ".xcf",".XCF",
".lbm",".LBM", ".iff",".IFF"]


if MOVIES_VAL:
    for t in (".mpg", ".MPG", ".mpeg", ".MPEG"):
        IMG_TYPES.append(t)


if not version.ver >= "1.1":
    errorbox("Version Error", "You need pygame 1.1 or greater to run imgv")


if len(argv) < 2:
    if START_DIRECTORY_VAL == "CURRENT":
        dir_or_file = '.'
    else:
        dir_or_file = START_DIRECTORY_VAL
else:
    dir_or_file = argv[1]
    if not os.path.exists(dir_or_file):
        # make a full path if user didn't (i.e., they typed "../foo/bar/bla.jpg")
        dir_or_file = BASE_DIR + os.sep + dir_or_file 


# set initial directory values