Small update
[Python-Scripts.git] / PyXV / xv-alt.py
blobfd9a8e8a2cfd238ed1159a613ba7c3bbdfe73ae7
1 #!/usr/bin/python
2 '''
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the Revised BSD License.
6 This program is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 Revised BSD License for more details.
11 Copyright 2011-2013 Cool Dude 2k - http://idb.berlios.de/
12 Copyright 2011-2013 Game Maker 2k - http://intdb.sourceforge.net/
13 Copyright 2011-2013 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
15 $FileInfo: xv-alt.py - Last Update: 04/01/2013 Ver. 1.0.0 - Author: cooldude2k $
16 '''
17 import argparse
18 import os
19 import sys
21 import pygame
23 parser = argparse.ArgumentParser()
24 parser.add_argument("-name", help="title name")
25 parser.add_argument("file", help="file name")
26 getargs = parser.parse_args()
28 if (getargs.file is not None):
29 pygame.display.quit()
30 pygame.quit()
31 sys.exit(0)
32 if (not os.path.exists(getargs.file) or not os.path.isfile(getargs.file)):
33 pygame.display.quit()
34 pygame.quit()
35 sys.exit(0)
37 pygame.display.init()
38 pyicon = pygame.image.load("/mnt/utmp/upctest/old_icon.png")
39 pygame.display.set_icon(pyicon)
40 ppmimg = pygame.image.load(getargs.file)
41 width, height = ppmimg.get_size()
42 screen = pygame.display.set_mode((width, height))
43 if (getargs.name is not None):
44 pygame.display.set_caption("PyXV - " + str(getargs.name))
45 if (getargs.name is None):
46 pygame.display.set_caption("PyXV - " + str(os.path.basename(getargs.file)))
47 pygame.display.get_active()
48 pygame.mouse.set_visible(0)
50 screen.blit(ppmimg, (0, 0))
51 pygame.display.flip()
52 done = False
53 while not done:
54 for event in pygame.event.get():
55 if (event.type == pygame.QUIT):
56 done = True
57 if (event.type == pygame.KEYDOWN):
58 if (event.key == pygame.K_t) or (event.key == pygame.K_w):
59 pygame.display.toggle_fullscreen()
60 if (event.key == pygame.K_i) or (event.key == pygame.K_m):
61 pygame.display.iconify()
62 if (event.key == pygame.K_ESCAPE) or (event.key == pygame.K_q):
63 done = True
64 pygame.display.quit()
65 pygame.quit()
66 os._exit(0)