-
Notifications
You must be signed in to change notification settings - Fork 0
/
SierraLauncher.py
executable file
·97 lines (78 loc) · 3.52 KB
/
SierraLauncher.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env python3
'''Sierra Launcher replacement by C C Magnus Gustavsson'''
import gi, os
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository.Gtk import AttachOptions as options
# Actions for Linux/Unix (instead of SierraLauncher.ini)
ACTIONS = [
"acroread Manuals/KQManual.pdf &",
"dosbox kq1sci/SIERRA.COM -fullscreen -exit &",
"dosbox kq2/SIERRA.COM -fullscreen -exit &",
"dosbox kq3/SIERRA.COM -fullscreen -exit &",
"dosbox kq4/SIERRA.COM -fullscreen -exit &",
"dosbox kq5/SIERRA.EXE -fullscreen -exit &",
"dosbox kq6/SIERRA.EXE -fullscreen -exit &",
"wine kq7/SIERRAW.EXE kq7/RESOURCE.WIN &"
]
class SierraLauncher(object):
def destroy(self, widget, data=None):
Gtk.main_quit()
def delete_event(self, widget, event, data=None):
self.destroy(self, widget)
def launch(self, widget, data=None):
os.system(ACTIONS[widget.num])
if self.close_window_on_launch:
self.destroy(self, widget)
def toggle(self, widget, data=None):
self.close_window_on_launch = widget.get_active()
def __init__(self):
self.close_window_on_launch = False
self.window = Gtk.Window()
self.window.set_title("King's Quest Collection(TM)")
self.window.set_icon_from_file("Sierra.ico")
self.window.set_resizable(False)
self.window.connect("destroy", self.destroy)
self.window.connect("delete_event", self.delete_event)
self.table = Gtk.Table(columns=3, rows=9, homogeneous=False)
self.table.set_border_width(8)
self.window.add(self.table)
for i in range(1, 8):
self.button = Gtk.Button('{:^36}'.format('Launch'))
self.button.num = i
self.button.connect("clicked", self.launch, None)
self.button.set_border_width(4)
self.button.show()
self.frame = Gtk.Frame(label="King's Quest {:d}".format(i))
self.frame.add(self.button)
self.table.attach(self.frame, 0, 2, i-1, i, xoptions=options.FILL,
yoptions=options.FILL, xpadding=8, ypadding=2)
self.frame.show()
self.button = Gtk.Button('View Manual')
self.button.num = 0
self.button.connect("clicked", self.launch, None)
self.table.attach(self.button, 0, 1, 7, 8, xoptions=options.EXPAND,
yoptions=options.EXPAND, xpadding=4, ypadding=4)
self.button.show()
self.button = Gtk.Button('{:^15}'.format('Close'))
self.button.connect_object("clicked", Gtk.Widget.destroy, self.window)
self.table.attach(self.button, 1, 2, 7, 8, xoptions=options.EXPAND,
yoptions=options.EXPAND, xpadding=4, ypadding=4)
self.button.show()
self.button = Gtk.CheckButton("Close window on launch")
self.button.set_active(self.close_window_on_launch)
self.button.connect("toggled", self.toggle, None)
self.table.attach(self.button, 0, 2, 8, 9, xoptions=options.EXPAND,
yoptions=options.EXPAND, xpadding=4, ypadding=4)
self.button.show()
self.image = Gtk.Image()
self.image.set_from_file("gameart.bmp")
self.table.attach(self.image, 2, 3, 0, 9, xoptions=options.EXPAND,
yoptions=options.EXPAND, xpadding=8, ypadding=8)
self.image.show()
self.table.show()
self.window.show()
def main(self):
Gtk.main()
if __name__ == "__main__":
SierraLauncher().main()