Small update
[Python-Scripts.git] / PyXV / xv-alt.py
blobebad0e6f613c31216b17bd8d2122734b0a04e6cb
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 os
18 import sys
19 import pygame
20 import argparse
22 parser = argparse.ArgumentParser()
23 parser.add_argument("-name", help="title name")
24 parser.add_argument("file", help="file name")
25 getargs = parser.parse_args()
27 if(getargs.file != None):
28 pygame.display.quit()
29 pygame.quit()
30 sys.exit(0)
31 if(not os.path.exists(getargs.file) or not os.path.isfile(getargs.file)):
32 pygame.display.quit()
33 pygame.quit()
34 sys.exit(0)
36 pygame.display.init()
37 pyicon = pygame.image.load("/mnt/utmp/upctest/old_icon.png")
38 pygame.display.set_icon(pyicon)
39 ppmimg = pygame.image.load(getargs.file)
40 width, height = ppmimg.get_size()
41 screen = pygame.display.set_mode((width, height))
42 if(getargs.name != None):
43 pygame.display.set_caption("PyXV - "+str(getargs.name))
44 if(getargs.name == None):
45 pygame.display.set_caption("PyXV - "+str(os.path.basename(getargs.file)))
46 pygame.display.get_active()
47 pygame.mouse.set_visible(0)
49 screen.blit(ppmimg, (0, 0))
50 pygame.display.flip()
51 done = False
52 while not done:
53 for event in pygame.event.get():
54 if (event.type == pygame.QUIT):
55 done = True
56 if (event.type == pygame.KEYDOWN):
57 if (event.key == pygame.K_t) or (event.key == pygame.K_w):
58 pygame.display.toggle_fullscreen()
59 if (event.key == pygame.K_i) or (event.key == pygame.K_m):
60 pygame.display.iconify()
61 if (event.key == pygame.K_ESCAPE) or (event.key == pygame.K_q):
62 done = True
63 pygame.display.quit()
64 pygame.quit()
65 os._exit(0)