Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ back.bmp
Snark.code-workspace
*.mdl
# scripts/
WinSize.txt
WinSize*.txt
56 changes: 30 additions & 26 deletions GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self):
self.devMode = False
# Flag specifically for Snark, scripts are currently not implemented yet and is a copy of the scripting system from SMD Tools v1.1
# This will allow me to disable the functionality for it until I come up with a proper implementation
self.allowScripts = False
self.allowScripts = True
# Another flag for Snark, it disables booting to the "games" menu and makes the menu show a "This menu will be completed soon" message
# instead of showing the menu
self.allowGames = True
Expand Down Expand Up @@ -285,8 +285,9 @@ def __init__(self):
self.selTheme = self.options["theme"]

winSizeFile = False
if sys.platform == "linux" and os.path.exists("WinSize.txt"):
wsFile = open("WinSize.txt", "r")
winSizeVer = 2
if sys.platform == "linux" and os.path.exists(f"WinSize{winSizeVer}.txt"):
wsFile = open(f"WinSize{winSizeVer}.txt", "r")
ws = wsFile.readlines()
wsFile.close()
winSizeFile = True
Expand Down Expand Up @@ -351,14 +352,14 @@ def __init__(self):
"txt": "white",
"tt": "#dc5200"
}
if self.options["save_paths"]:
"""if self.options["save_paths"]:
self.save_paths = True
js = open("save/paths.json", 'r')
self.sPaths = json.loads(js.read())
self.bonez = self.sPaths["bonez"]
self.matfix = self.sPaths["matFix"]
else:
self.save_paths = False
self.save_paths = False"""

self.chkVerTheme = thCol

Expand Down Expand Up @@ -405,7 +406,7 @@ def __init__(self):
self.comp_button = Button(self.header, text="Compile", command=self.cmp_menu, bg=thCol["btn"][0], cursor="hand2")
self.comp_button.grid(column=3, row=0, sticky=(N), ipadx=buttonPad)

self.scripts = Button(self.header, text="Scripts", command=self.scripts, bg=thCol["btn"][0], cursor="hand2")
self.scripts = Button(self.header, text="Batch Manager", command=self.scripts, bg=thCol["btn"][0], cursor="hand2")
self.scripts.grid(column=4, row=0, sticky=(N), ipadx=buttonPad)

self.options = Button(self.header, text="Options", command=self.optionsMenu, bg=thCol["btn"][0], cursor="hand2")
Expand Down Expand Up @@ -436,23 +437,24 @@ def __init__(self):
self.dumbFixMenu4.grid(column=0, row=2, sticky="nsew", columnspan=10)
self.compSetMenu = CompSetupMenu(self.mTemplate, self.dumbFixMenu4, self.updateComps, self.flags.allowGames)
self.dumbFixMenu4.grid_remove()

if self.flags.allowScripts:
self.dumbFixMenu5.grid(column=0, row=2, sticky="nsew", columnspan=10)
self.batchMenu = BatchManagerM(self.mTemplate, self.dumbFixMenu5, True)
self.dumbFixMenu5.grid_remove()

self.decMenu = DecompMenu(self.mTemplate, menu, True)
self.decMenu = DecompMenu(self.mTemplate, menu, self.batchMenu, True)

self.dumbFixMenu.grid(column=0, row=2, sticky="nsew", columnspan=10)
self.cmpMenu = CompMenu(self.mTemplate, self.dumbFixMenu, False)
self.cmpMenu = CompMenu(self.mTemplate, self.dumbFixMenu, self.batchMenu, False)
if winSizeFile:
self.dumbFixMenu.grid_remove()
self.cmpMenu.hidden = True

self.dumbFixMenu2.grid(column=0, row=2, sticky="nsew", columnspan=10)
self.abtMenu = AboutMenu(self.mTemplate, self.dumbFixMenu2, True)
self.dumbFixMenu2.grid_remove()

if self.flags.allowScripts:
self.dumbFixMenu5.grid(column=0, row=2, sticky="nsew", columnspan=10)
self.scrMenu = ScriptMenu(self.mTemplate, self.dumbFixMenu5, True)
self.dumbFixMenu5.grid_remove()

# Getting the maximum height
if not self.cmpMenu.hidden or winSizeFile:
if winSizeFile and not ws[1] == "":
Expand All @@ -472,8 +474,8 @@ def __init__(self):
else:
self.geometry("501x443")

if not os.path.exists("WinSize.txt"):
wsf = open("WinSize.txt", "w")
if not os.path.exists(f"WinSize{winSizeVer}.txt"):
wsf = open(f"WinSize{winSizeVer}.txt", "w")
wsf.write(f"{self.goodWidth}\n{self.goodHeight}")
wsf.close()

Expand Down Expand Up @@ -504,6 +506,8 @@ def help(self):
browser.open_new('https://github.com/PostScriptReal/Snark_Compiler/wiki/How-to-use-Snark#decompiling')
elif not self.optMenu.hidden and self.optMenu.curPage == 1:
browser.open_new('https://github.com/PostScriptReal/Snark_Compiler/wiki/How-to-use-Snark#setting-up-hlamhlmv-for-snark')
elif not self.batchMenu.hidden:
browser.open_new('https://github.com/PostScriptReal/Snark_Compiler/wiki/How-to-use-Snark#batch-decompiling-and-compiling')
else:
browser.open_new('https://github.com/PostScriptReal/Snark_Compiler/wiki')

Expand Down Expand Up @@ -577,13 +581,13 @@ def changeTheme(self, a):
self.decMenu.changeTheme(thCol)
self.optMenu.changeTheme(thCol)
self.compSetMenu.changeTheme(thCol)
self.scrMenu.changeTheme(thCol)
self.batchMenu.changeTheme(thCol)
self.setupMenu.master.config(bg=thCol["bg"])
self.cmpMenu.master.config(bg=thCol["bg"])
self.abtMenu.master.config(bg=thCol["bg"])
self.optMenu.master.config(bg=thCol["bg"])
self.compSetMenu.master.config(bg=thCol["bg"])
self.scrMenu.master.config(bg=thCol["bg"])
self.batchMenu.master.config(bg=thCol["bg"])
self.frame.config(bg=thCol["bg"])
self.header.config(bg=thCol["bg"])
for w in self.header.winfo_children():
Expand All @@ -609,7 +613,7 @@ def about(self):
self.decMenu.hide()
self.optMenu.hide()
if self.flags.allowScripts:
self.scrMenu.hide()
self.batchMenu.hide()

def updateOpt(self, key, val):
self.setupMenu.updateOpt(key, val)
Expand All @@ -619,7 +623,7 @@ def updateOpt(self, key, val):
self.decMenu.updateOpt(key, val)
self.optMenu.updateOpt(key, val)
if self.flags.allowScripts:
self.scrMenu.updateOpt(key, val)
self.batchMenu.updateOpt(key, val)

def updateGames(self, comp):
self.cmpMenu.updateGames(comp)
Expand All @@ -641,7 +645,7 @@ def optionsMenu(self):
self.decMenu.hide()
self.optMenu.show()
if self.flags.allowScripts:
self.scrMenu.hide()
self.batchMenu.hide()

def openfile(self):
startDir = self.options["startFolder"]
Expand Down Expand Up @@ -678,7 +682,7 @@ def bd_menu(self):
self.abtMenu.hide()
self.optMenu.hide()
if self.flags.allowScripts:
self.scrMenu.hide()
self.batchMenu.hide()

def cmpSetupMenu(self):
if self.compSetMenu.hidden:
Expand All @@ -694,7 +698,7 @@ def cmpSetupMenu(self):
self.abtMenu.hide()
self.optMenu.hide()
if self.flags.allowScripts:
self.scrMenu.hide()
self.batchMenu.hide()


""" Switches menu to Decompile Menu """
Expand All @@ -712,7 +716,7 @@ def mnc_menu(self):
self.optMenu.hide()
self.compSetMenu.hide()
if self.flags.allowScripts:
self.scrMenu.hide()
self.batchMenu.hide()

""" Switches menu to Compile Menu """
def cmp_menu(self):
Expand All @@ -729,12 +733,12 @@ def cmp_menu(self):
self.abtMenu.hide()
self.optMenu.hide()
if self.flags.allowScripts:
self.scrMenu.hide()
self.batchMenu.hide()
# print(f"width: {self.winfo_width()} height: {self.winfo_height()}")

def scripts(self):
if self.flags.allowScripts:
if self.scrMenu.hidden:
if self.batchMenu.hidden:
self.setupMenu.hide()
self.compSetMenu.hide()
self.dumbFixMenu.grid_remove()
Expand All @@ -746,7 +750,7 @@ def scripts(self):
self.decMenu.hide()
self.abtMenu.hide()
self.optMenu.hide()
self.scrMenu.show()
self.batchMenu.show()
else:
a = ScriptWin()

Expand Down
Binary file added git_images/batchManager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified git_images/compErr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified git_images/compSetup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified git_images/compWin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified git_images/decompWin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified git_images/gameSetup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 12 additions & 4 deletions helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, master, startText:str='', columnn=0, roww=0, widthh=100, heig
self.miniTerminal['state'] = 'disabled'

# Sets the output of the console to something else.
def setOutput(self, replace):
def setOutput(self, replace:str):
self.miniTerminal['state'] = 'normal'
self.miniTerminal.delete('1.0', 'end')
self.miniTerminal.insert('1.0', replace)
Expand All @@ -54,7 +54,7 @@ def setOutput(self, replace):
self.lines.append(replace)

# Appends a new line to the bottom of the console.
def append(self, e):
def append(self, e:str):
self.miniTerminal['state'] = 'normal'
self.miniTerminal.insert('end', e)
self.lines.append(e)
Expand Down Expand Up @@ -101,9 +101,9 @@ def hide(self):

class BoolEntry():

def __init__(self, master, textvariable, placeholder="placeholder", bg="white", fg="black"):
def __init__(self, master, textvariable, placeholder="placeholder", bg="white", fg="black", width=20):
self.placeholder = placeholder
self.entry = Entry(master, state="disabled", textvariable=textvariable, bg=bg, fg=fg)
self.entry = Entry(master, state="disabled", textvariable=textvariable, bg=bg, fg=fg, width=width)

def grid(self, column=0, row=0, padx=0, pady=0, sticky="nsew"):
self.entry.grid(column=column, row=row, padx=padx, pady=pady, sticky=sticky)
Expand Down Expand Up @@ -426,3 +426,11 @@ def checkCustom(self, name):
if g.name == name and g.isCustom:
return True
return False

class BatchMDL():

def __init__(self, name:str, qcLoc:str, output:str):
self.name = name
self.qcLoc, self.mdlLoc = qcLoc, qcLoc
self.skip = False
self.output = output
Loading