Yet another small update.
[Python-Scripts.git] / PyXV / xv.py
blob1c9d2ec54c21dafb0ff80476658d20d584586167
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.py - Last Update: 04/01/2013 Ver. 1.0.0 - Author: cooldude2k $
16 '''
17 import os, sys, pygame;
19 pygame.display.init();
20 pyicon=pygame.image.load("/mnt/utmp/upctest/old_icon.png");
21 pygame.display.set_icon(pyicon);
22 if(len(sys.argv)==2):
23 ppmimg=pygame.image.load(sys.argv[1]);
24 if(len(sys.argv)==4):
25 ppmimg=pygame.image.load(sys.argv[3]);
26 width, height = ppmimg.get_size();
27 screen = pygame.display.set_mode((width, height));
28 if(len(sys.argv)==2):
29 pygame.display.set_caption("PyXV - "+str(os.path.basename(sys.argv[1])));
30 if(len(sys.argv)==4):
31 pygame.display.set_caption("PyXV - "+str(sys.argv[2]));
32 pygame.display.get_active();
33 pygame.mouse.set_visible(0);
35 screen.blit(ppmimg, (0, 0));
36 pygame.display.flip();
37 done = False;
38 while not done:
39 for event in pygame.event.get():
40 if (event.type == pygame.QUIT):
41 done = True;
42 if (event.type == pygame.KEYDOWN):
43 if (event.key == pygame.K_t) or (event.key == pygame.K_w):
44 pygame.display.toggle_fullscreen();
45 if (event.key == pygame.K_i) or (event.key == pygame.K_m):
46 pygame.display.iconify();
47 if (event.key == pygame.K_ESCAPE) or (event.key == pygame.K_q):
48 done = True;
49 pygame.display.quit();
50 pygame.quit();
51 os._exit(0);