1
- #!/usr/bin/env python
1
+ #!/usr/bin/env python3
2
2
3
- # Sierra Launcher replacement by C C Magnus Gustavsson
3
+ ''' Sierra Launcher replacement by C C Magnus Gustavsson'''
4
4
5
- import os , pygtk
6
- pygtk . require ( '2 .0' )
7
-
8
- from gtk import *
5
+ import gi , os
6
+ gi . require_version ( 'Gtk' , '3 .0' )
7
+ from gi . repository import Gtk
8
+ from gi . repository . Gtk import AttachOptions as options
9
9
10
10
# Actions for Linux/Unix (instead of SierraLauncher.ini)
11
- actions = ["acroread Manuals/LarryManual.pdf &" ,
12
- "dosbox lsl1vga/SCIDHUV.EXE -fullscreen -exit &" ,
13
- "dosbox lsl2/SIERRA.COM -fullscreen -exit &" ,
14
- "dosbox lsl3/SIERRA.COM -fullscreen -exit &" ,
15
- "gedit lsl4/README.TXT &" ,
16
- "dosbox lsl5/SCIDHUV.EXE -fullscreen -exit &" ,
17
- "dosbox lsl6/SIERRA.EXE -fullscreen -exit &" ]
18
-
19
- class SierraLauncher :
11
+ ACTIONS = [
12
+ "acroread Manuals/LarryManual.pdf &" ,
13
+ "dosbox lsl1vga/SCIDHUV.EXE -fullscreen -exit &" ,
14
+ "dosbox lsl2/SIERRA.COM -fullscreen -exit &" ,
15
+ "dosbox lsl3/SIERRA.COM -fullscreen -exit &" ,
16
+ "gedit lsl4/README.TXT &" ,
17
+ "dosbox lsl5/SCIDHUV.EXE -fullscreen -exit &" ,
18
+ "dosbox lsl6/SIERRA.EXE -fullscreen -exit &"
19
+ ]
20
+
21
+ class SierraLauncher (object ):
20
22
def destroy (self , widget , data = None ):
21
- main_quit ()
23
+ Gtk . main_quit ()
22
24
23
25
def delete_event (self , widget , event , data = None ):
24
26
self .destroy (self , widget )
25
27
26
28
def launch (self , widget , data = None ):
27
- os .system (actions [widget .num ])
29
+ os .system (ACTIONS [widget .num ])
28
30
if self .close_window_on_launch :
29
31
self .destroy (self , widget )
30
32
@@ -34,65 +36,65 @@ def toggle(self, widget, data=None):
34
36
def __init__ (self ):
35
37
self .close_window_on_launch = False
36
38
37
- self .window = Window (WINDOW_TOPLEVEL )
39
+ self .window = Gtk . Window ()
38
40
self .window .set_title ("Leisure Suit Larry Collection(TM)" )
39
41
self .window .set_icon_from_file ("Sierra.ico" )
40
42
self .window .set_resizable (False )
41
43
self .window .connect ("destroy" , self .destroy )
42
44
self .window .connect ("delete_event" , self .delete_event )
43
45
44
- self .table = Table (columns = 3 , rows = 9 , homogeneous = False )
46
+ self .table = Gtk . Table (columns = 3 , rows = 9 , homogeneous = False )
45
47
self .table .set_border_width (8 )
46
48
self .window .add (self .table )
47
49
48
50
for i in range (1 , 7 ):
49
- self .button = Button (' Launch ' )
51
+ self .button = Gtk . Button ('{:^36}' . format ( ' Launch' ) )
50
52
self .button .num = i
51
53
self .button .connect ("clicked" , self .launch , None )
52
54
self .button .set_border_width (4 )
53
55
self .button .show ()
54
56
55
- self .frame = Frame ("Leisure Suit Larry " + str (i ))
57
+ self .frame = Gtk . Frame (label = "Leisure Suit Larry {:d}" . format (i ))
56
58
self .frame .add (self .button )
57
- self .table .attach (self .frame , 0 , 2 , i - 1 , i , xoptions = FILL ,
58
- yoptions = FILL , xpadding = 8 , ypadding = 2 )
59
+ self .table .attach (self .frame , 0 , 2 , i - 1 , i , xoptions = options . FILL ,
60
+ yoptions = options . FILL , xpadding = 8 , ypadding = 2 )
59
61
self .frame .show ()
60
62
61
- self .dummy = Frame ()
62
- self .table .attach (self .dummy , 0 , 2 , 6 , 7 , xoptions = EXPAND ,
63
- yoptions = EXPAND , xpadding = 8 , ypadding = 2 )
63
+ self .dummy = Gtk . Frame ()
64
+ self .table .attach (self .dummy , 0 , 2 , 6 , 7 , xoptions = options . EXPAND ,
65
+ yoptions = options . EXPAND , xpadding = 8 , ypadding = 2 )
64
66
65
- self .button = Button ('View Manual' )
67
+ self .button = Gtk . Button ('View Manual' )
66
68
self .button .num = 0
67
69
self .button .connect ("clicked" , self .launch , None )
68
- self .table .attach (self .button , 0 , 1 , 7 , 8 , xoptions = EXPAND ,
69
- yoptions = EXPAND , xpadding = 4 , ypadding = 4 )
70
+ self .table .attach (self .button , 0 , 1 , 7 , 8 , xoptions = options . EXPAND ,
71
+ yoptions = options . EXPAND , xpadding = 4 , ypadding = 4 )
70
72
self .button .show ()
71
73
72
- self .button = Button (' Close ' )
73
- self .button .connect_object ("clicked" , Widget .destroy , self .window )
74
- self .table .attach (self .button , 1 , 2 , 7 , 8 , xoptions = EXPAND ,
75
- yoptions = EXPAND , xpadding = 4 , ypadding = 4 )
74
+ self .button = Gtk . Button ('{:^15}' . format ( ' Close' ) )
75
+ self .button .connect_object ("clicked" , Gtk . Widget .destroy , self .window )
76
+ self .table .attach (self .button , 1 , 2 , 7 , 8 , xoptions = options . EXPAND ,
77
+ yoptions = options . EXPAND , xpadding = 4 , ypadding = 4 )
76
78
self .button .show ()
77
79
78
- self .button = CheckButton ("Close window on launch" )
80
+ self .button = Gtk . CheckButton ("Close window on launch" )
79
81
self .button .set_active (self .close_window_on_launch )
80
82
self .button .connect ("toggled" , self .toggle , None )
81
- self .table .attach (self .button , 0 , 2 , 8 , 9 , xoptions = EXPAND ,
83
+ self .table .attach (self .button , 0 , 2 , 8 , 9 , xoptions = options . EXPAND ,
82
84
yoptions = 0 , xpadding = 4 , ypadding = 4 )
83
85
self .button .show ()
84
86
85
- self .image = Image ()
87
+ self .image = Gtk . Image ()
86
88
self .image .set_from_file ("gameart.bmp" )
87
- self .table .attach (self .image , 2 , 3 , 0 , 9 , xoptions = EXPAND ,
88
- yoptions = EXPAND , xpadding = 8 , ypadding = 8 )
89
+ self .table .attach (self .image , 2 , 3 , 0 , 9 , xoptions = options . EXPAND ,
90
+ yoptions = options . EXPAND , xpadding = 8 , ypadding = 8 )
89
91
self .image .show ()
90
92
91
93
self .table .show ()
92
94
self .window .show ()
93
95
94
96
def main (self ):
95
- main ()
97
+ Gtk . main ()
96
98
97
99
if __name__ == "__main__" :
98
100
SierraLauncher ().main ()
0 commit comments