-
Notifications
You must be signed in to change notification settings - Fork 0
/
McGUI.py
100 lines (93 loc) · 3.34 KB
/
McGUI.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
98
99
100
#!/usr/bin/python
# Tkinter interface to the McMillan installer
# (c) 2003 Alan James Salmoni - yes, all this bad code is all mine!!!
# released under the MIT license
import os, os.path
from Tkinter import *
import tkFileDialog
import FileDialog
class McGUI:
def __init__(self):
root = Tk()
fr1 = Frame(root)
fr1["width"] = 200
fr1["height"] = 100
fr1.pack(side="top")
fr2 = Frame(root)
fr2["width"] = 200
fr2["height"] = 300
fr2["borderwidth"] = 2
fr2["relief"] = "ridge"
fr2.pack()
fr4 = Frame(root)
fr4["width"]=200
fr4["height"]=100
fr4.pack(side="bottom")
getFileButton = Button(fr1)
getFileButton["text"] = "Script..."
getFileButton.bind("<Button>",self.GetFile)
getFileButton.pack(side="left")
self.filein = Entry(fr1)
self.filein.pack(side="right")
self.filetypecheck = Checkbutton(fr2)
self.filetypecheck["text"] = "One File Package "
self.filetype = IntVar()
self.filetypecheck["variable"] = self.filetype
self.filetypecheck.pack()
self.tkcheck = Checkbutton(fr2)
self.tkcheck["text"] = "Include Tcl/Tk "
self.tk = IntVar()
self.tkcheck["variable"] = self.tk
self.tkcheck.pack()
self.asciicheck = Checkbutton(fr2)
self.asciicheck["text"] = "Do NOT include decodings"
self.ascii = IntVar()
self.asciicheck["variable"] = self.ascii
self.asciicheck.pack()
self.debugcheck = Checkbutton(fr2)
self.debugcheck["text"] = "Use debug versions "
self.debug = IntVar()
self.debugcheck["variable"] = self.debug
self.debugcheck.pack()
self.noconsolecheck = Checkbutton(fr2)
self.noconsolecheck["text"] = "No console (Windows only)"
self.noconsole = IntVar()
self.noconsolecheck["variable"] = self.noconsole
self.noconsolecheck.pack()
okaybutton = Button(fr4)
okaybutton["text"] = "Okay "
okaybutton.bind("<Button>",self.makePackage)
okaybutton.pack(side="left")
cancelbutton = Button(fr4)
cancelbutton["text"] = "Cancel"
cancelbutton.bind("<Button>",self.killapp)
cancelbutton.pack(side="right")
self.fin = ''
self.fout = ''
root.mainloop()
def killapp(self, event):
sys.exit(0)
def makePackage(self, event):
commands = 'python Makespec.py '
if (self.filetype.get() == 1):
commands = commands + '--onefile '
if (self.tk.get() == 1):
commands = commands + '--tk '
if (self.ascii.get() == 1):
commands = commands + '--ascii '
if (self.debug.get() == 1):
commands = commands + '--debug '
if (self.noconsole.get() == 1):
commands = commands + '--noconsole '
commands = commands + self.fin
x = os.path.split(self.fin)
y = os.path.splitext(x[1])
os.system(commands)
commands = 'python Build.py '+str(y[0])+os.sep+str(y[0])+'.spec'
os.system(commands)
sys.exit(0)
def GetFile(self, event):
self.fin = tkFileDialog.askopenfilename()
self.filein.insert(0,self.fin)
if __name__ == "__main__":
app = McGUI()