Ugh, I think I did it
This commit is contained in:
9
Gui.py
9
Gui.py
@@ -22,6 +22,7 @@ from GuiUtils import set_icon
|
||||
from Main import __version__ as ESVersion
|
||||
|
||||
from source.classes.BabelFish import BabelFish
|
||||
from source.classes.Empty import Empty
|
||||
|
||||
|
||||
def guiMain(args=None):
|
||||
@@ -152,13 +153,15 @@ def guiMain(args=None):
|
||||
self.fish = BabelFish(lang=lang)
|
||||
|
||||
# bottom of window: Open Output Directory, Open Documentation (if exists)
|
||||
self.frames["bottom"] = bottom_frame(self, self, None)
|
||||
self.pages["bottom"] = Empty()
|
||||
self.pages["bottom"].pages = {}
|
||||
self.pages["bottom"].pages["content"] = bottom_frame(self, self, None)
|
||||
## Save Settings Button
|
||||
savesettingsButton = Button(self.frames["bottom"], text='Save Settings to File', command=lambda: save_settings_from_gui(True))
|
||||
savesettingsButton = Button(self.pages["bottom"].pages["content"], text='Save Settings to File', command=lambda: save_settings_from_gui(True))
|
||||
savesettingsButton.pack(side=RIGHT)
|
||||
|
||||
# set bottom frame to main window
|
||||
self.frames["bottom"].pack(side=BOTTOM, fill=X, padx=5, pady=5)
|
||||
self.pages["bottom"].pages["content"].pack(side=BOTTOM, fill=X, padx=5, pady=5)
|
||||
|
||||
self.outputPath = StringVar()
|
||||
self.randomSprite = BooleanVar()
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
"randomizer.enemizer.enemydamage": "Enemy Damage",
|
||||
"randomizer.enemizer.enemydamage.default": "Vanilla",
|
||||
"randomizer.enemizer.enemydamage.shuffled": "Shuffled",
|
||||
"randomizer.enemizer.enemydamage.choas": "Chaos",
|
||||
"randomizer.enemizer.enemydamage.chaos": "Chaos",
|
||||
|
||||
"randomizer.enemizer.enemyhealth": "Enemy Health",
|
||||
"randomizer.enemizer.enemyhealth.default": "Vanilla",
|
||||
@@ -260,13 +260,13 @@
|
||||
"randomizer.multiworld.names": "Player names",
|
||||
|
||||
|
||||
"bottom.seed": "Seed #",
|
||||
"bottom.generationcount": "Count",
|
||||
"bottom.go": "Generate Patched Rom",
|
||||
"bottom.dialog.error": "Error while creating seed",
|
||||
"bottom.dialog.success": "Success",
|
||||
"bottom.dialog.success.message": "Rom created successfully.",
|
||||
"bottom.outputdir": "Open Output Directory",
|
||||
"bottom.docs": "Open Documentation"
|
||||
"bottom.content.seed": "Seed #",
|
||||
"bottom.content.generationcount": "Count",
|
||||
"bottom.content.go": "Generate Patched Rom",
|
||||
"bottom.content.dialog.error": "Error while creating seed",
|
||||
"bottom.content.dialog.success": "Success",
|
||||
"bottom.content.dialog.success.message": "Rom created successfully.",
|
||||
"bottom.content.outputdir": "Open Output Directory",
|
||||
"bottom.content.docs": "Open Documentation"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
"selectbox": {
|
||||
"side": "right"
|
||||
},
|
||||
"default": "Basic"
|
||||
"default": "basic"
|
||||
},
|
||||
"options": {
|
||||
"Vanilla": "vanilla",
|
||||
"Basic": "basic",
|
||||
"Crossed": "crossed"
|
||||
}
|
||||
"options": [
|
||||
"vanilla",
|
||||
"basic",
|
||||
"crossed"
|
||||
]
|
||||
},
|
||||
"experimental": {
|
||||
"type": "checkbox",
|
||||
@@ -37,13 +37,13 @@
|
||||
"selectbox": {
|
||||
"side": "right"
|
||||
},
|
||||
"default": "Auto"
|
||||
"default": "default"
|
||||
},
|
||||
"options": {
|
||||
"Auto": "default",
|
||||
"Off": "off",
|
||||
"On": "on",
|
||||
"On Compass Pickup": "pickup"
|
||||
}
|
||||
"options": [
|
||||
"default",
|
||||
"off",
|
||||
"on",
|
||||
"pickup"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"Vanilla": "none",
|
||||
"Shuffled": "shuffled",
|
||||
"Chaos": "chaos"
|
||||
}
|
||||
"options": [
|
||||
"none",
|
||||
"shuffled",
|
||||
"chaos"
|
||||
]
|
||||
},
|
||||
"bossshuffle": {
|
||||
"type": "selectbox",
|
||||
@@ -40,12 +40,12 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"Vanilla": "none",
|
||||
"Basic": "basic",
|
||||
"Shuffled": "shuffled",
|
||||
"Chaos": "chaos"
|
||||
}
|
||||
"options": [
|
||||
"none",
|
||||
"basic",
|
||||
"shuffled",
|
||||
"chaos"
|
||||
]
|
||||
}
|
||||
},
|
||||
"rightEnemizerFrame": {
|
||||
@@ -62,11 +62,11 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"Vanilla": "default",
|
||||
"Shuffled": "shuffled",
|
||||
"Chaos": "chaos"
|
||||
}
|
||||
"options": [
|
||||
"default",
|
||||
"shuffled",
|
||||
"chaos"
|
||||
]
|
||||
},
|
||||
"enemyhealth": {
|
||||
"type": "selectbox",
|
||||
@@ -81,13 +81,13 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"Vanilla": "default",
|
||||
"Easy": "easy",
|
||||
"Normal": "normal",
|
||||
"Hard": "hard",
|
||||
"Expert": "expert"
|
||||
}
|
||||
"options": [
|
||||
"default",
|
||||
"easy",
|
||||
"normal",
|
||||
"hard",
|
||||
"expert"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,20 +21,20 @@
|
||||
"label": { "side": "left" },
|
||||
"selectbox": { "side": "right" }
|
||||
},
|
||||
"options": {
|
||||
"Vanilla": "vanilla",
|
||||
"Simple": "simple",
|
||||
"Restricted": "restricted",
|
||||
"Full": "full",
|
||||
"Crossed": "crossed",
|
||||
"Insanity": "insanity",
|
||||
"Restricted (Legacy)": "restricted_legacy",
|
||||
"Full (Legacy)": "full_legacy",
|
||||
"Madness (Legacy)": "madness_legacy",
|
||||
"Insanity (Legacy)": "insanity_legacy",
|
||||
"Dungeons + Full": "dungeonsfull",
|
||||
"Dungeons + Simple": "dungeonssimple"
|
||||
}
|
||||
"options": [
|
||||
"vanilla",
|
||||
"simple",
|
||||
"restricted",
|
||||
"full",
|
||||
"crossed",
|
||||
"insanity",
|
||||
"restricted_legacy",
|
||||
"full_legacy",
|
||||
"madness_legacy",
|
||||
"insanity_legacy",
|
||||
"dungeonsfull",
|
||||
"dungeonssimple"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,13 +34,13 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"Red": "red",
|
||||
"Blue": "blue",
|
||||
"Green": "green",
|
||||
"Yellow": "yellow",
|
||||
"Random": "random"
|
||||
}
|
||||
"options": [
|
||||
"red",
|
||||
"blue",
|
||||
"green",
|
||||
"yellow",
|
||||
"random"
|
||||
]
|
||||
},
|
||||
"heartbeep": {
|
||||
"type": "selectbox",
|
||||
@@ -54,15 +54,15 @@
|
||||
"selectbox": {
|
||||
"side": "right"
|
||||
},
|
||||
"default": "Normal"
|
||||
"default": "normal"
|
||||
},
|
||||
"options": {
|
||||
"Double": "double",
|
||||
"Normal": "normal",
|
||||
"Half": "half",
|
||||
"Quarter": "quarter",
|
||||
"Off": "off"
|
||||
}
|
||||
"options": [
|
||||
"double",
|
||||
"normal",
|
||||
"half",
|
||||
"quarter",
|
||||
"off"
|
||||
]
|
||||
}
|
||||
},
|
||||
"rightRomOptionsFrame": {
|
||||
@@ -78,16 +78,16 @@
|
||||
"selectbox": {
|
||||
"side": "right"
|
||||
},
|
||||
"default": "Normal"
|
||||
"default": "normal"
|
||||
},
|
||||
"options": {
|
||||
"Instant": "instant",
|
||||
"Quadruple": "quadruple",
|
||||
"Triple": "triple",
|
||||
"Double": "double",
|
||||
"Normal": "normal",
|
||||
"Half": "half"
|
||||
}
|
||||
"options": [
|
||||
"instant",
|
||||
"quadruple",
|
||||
"triple",
|
||||
"double",
|
||||
"normal",
|
||||
"half"
|
||||
]
|
||||
},
|
||||
"owpalettes": {
|
||||
"type": "selectbox",
|
||||
@@ -102,11 +102,11 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"Default": "default",
|
||||
"Random": "random",
|
||||
"Blackout": "blackout"
|
||||
}
|
||||
"options": [
|
||||
"default",
|
||||
"random",
|
||||
"blackout"
|
||||
]
|
||||
},
|
||||
"uwpalettes": {
|
||||
"type": "selectbox",
|
||||
@@ -121,11 +121,11 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"Default": "default",
|
||||
"Random": "random",
|
||||
"Blackout": "blackout"
|
||||
}
|
||||
"options": [
|
||||
"default",
|
||||
"random",
|
||||
"blackout"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,10 +36,10 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"Ask Me": "ask",
|
||||
"Always": "always",
|
||||
"Never": "never"
|
||||
}
|
||||
"options": [
|
||||
"ask",
|
||||
"always",
|
||||
"never"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
"selectbox": {
|
||||
"side": "right"
|
||||
},
|
||||
"default": "Open"
|
||||
"default": "open"
|
||||
},
|
||||
"options": {
|
||||
"Standard": "standard",
|
||||
"Open": "open",
|
||||
"Inverted": "inverted",
|
||||
"Retro": "retro"
|
||||
}
|
||||
"options": [
|
||||
"standard",
|
||||
"open",
|
||||
"inverted",
|
||||
"retro"
|
||||
]
|
||||
},
|
||||
"logiclevel": {
|
||||
"type": "selectbox",
|
||||
@@ -42,11 +42,11 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"No Glitches": "noglitches",
|
||||
"Minor Glitches": "minorglitches",
|
||||
"No Logic": "nologic"
|
||||
}
|
||||
"options": [
|
||||
"noglitches",
|
||||
"minorglitches",
|
||||
"nologic"
|
||||
]
|
||||
},
|
||||
"goal": {
|
||||
"type": "selectbox",
|
||||
@@ -61,13 +61,13 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"Defeat Ganon": "ganon",
|
||||
"Master Sword Pedestal": "pedestal",
|
||||
"All Dungeons": "dungeons",
|
||||
"Triforce Hunt": "triforcehunt",
|
||||
"Crystals": "crystals"
|
||||
}
|
||||
"options": [
|
||||
"ganon",
|
||||
"pedestal",
|
||||
"dungeons",
|
||||
"triforcehunt",
|
||||
"crystals"
|
||||
]
|
||||
},
|
||||
"crystals_gt": {
|
||||
"type": "selectbox",
|
||||
@@ -82,17 +82,17 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"0": "0",
|
||||
"1": "1",
|
||||
"2": "2",
|
||||
"3": "3",
|
||||
"4": "4",
|
||||
"5": "5",
|
||||
"6": "6",
|
||||
"7": "7",
|
||||
"Random": "random"
|
||||
}
|
||||
"options": [
|
||||
"0",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"random"
|
||||
]
|
||||
},
|
||||
"crystals_ganon": {
|
||||
"type": "selectbox",
|
||||
@@ -107,17 +107,17 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"0": "0",
|
||||
"1": "1",
|
||||
"2": "2",
|
||||
"3": "3",
|
||||
"4": "4",
|
||||
"5": "5",
|
||||
"6": "6",
|
||||
"7": "7",
|
||||
"Random": "random"
|
||||
}
|
||||
"options": [
|
||||
"0",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"random"
|
||||
]
|
||||
},
|
||||
"weapons": {
|
||||
"type": "selectbox",
|
||||
@@ -132,12 +132,12 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"Randomized": "random",
|
||||
"Assured": "assured",
|
||||
"Swordless": "swordless",
|
||||
"Vanilla": "vanilla"
|
||||
}
|
||||
"options": [
|
||||
"random",
|
||||
"assured",
|
||||
"swordless",
|
||||
"vanilla"
|
||||
]
|
||||
}
|
||||
},
|
||||
"rightItemFrame": {
|
||||
@@ -154,11 +154,11 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"Normal": "normal",
|
||||
"Hard": "hard",
|
||||
"Expert": "expert"
|
||||
}
|
||||
"options": [
|
||||
"normal",
|
||||
"hard",
|
||||
"expert"
|
||||
]
|
||||
},
|
||||
"itemfunction": {
|
||||
"type": "selectbox",
|
||||
@@ -173,11 +173,11 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"Normal": "normal",
|
||||
"Hard": "hard",
|
||||
"Expert": "expert"
|
||||
}
|
||||
"options": [
|
||||
"normal",
|
||||
"hard",
|
||||
"expert"
|
||||
]
|
||||
},
|
||||
"timer": {
|
||||
"type": "selectbox",
|
||||
@@ -192,14 +192,14 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"No Timer": "none",
|
||||
"Stopwatch": "display",
|
||||
"Timed": "timed",
|
||||
"Timed OHKO": "timed-ohko",
|
||||
"OHKO": "ohko",
|
||||
"Timed Countdown": "timed-countdown"
|
||||
}
|
||||
"options": [
|
||||
"none",
|
||||
"display",
|
||||
"timed",
|
||||
"timed-ohko",
|
||||
"ohko",
|
||||
"timed-countdown"
|
||||
]
|
||||
},
|
||||
"progressives": {
|
||||
"type": "selectbox",
|
||||
@@ -214,11 +214,11 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"On": "on",
|
||||
"Off": "off",
|
||||
"Random": "random"
|
||||
}
|
||||
"options": [
|
||||
"on",
|
||||
"off",
|
||||
"random"
|
||||
]
|
||||
},
|
||||
"accessibility": {
|
||||
"type": "selectbox",
|
||||
@@ -233,11 +233,11 @@
|
||||
"side": "right"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"100% Inventory": "items",
|
||||
"100% Locations": "locations",
|
||||
"Beatable": "none"
|
||||
}
|
||||
"options": [
|
||||
"items",
|
||||
"locations",
|
||||
"none"
|
||||
]
|
||||
},
|
||||
"sortingalgo": {
|
||||
"type": "selectbox",
|
||||
@@ -251,17 +251,17 @@
|
||||
"selectbox": {
|
||||
"side": "right"
|
||||
},
|
||||
"default": "Balanced"
|
||||
"default": "balanced"
|
||||
},
|
||||
"options": {
|
||||
"Freshness": "freshness",
|
||||
"Flood": "flood",
|
||||
"VT8.21": "vt21",
|
||||
"VT8.22": "vt22",
|
||||
"VT8.25": "vt25",
|
||||
"VT8.26": "vt26",
|
||||
"Balanced": "balanced"
|
||||
}
|
||||
"options": [
|
||||
"freshness",
|
||||
"flood",
|
||||
"vt21",
|
||||
"vt22",
|
||||
"vt25",
|
||||
"vt26",
|
||||
"balanced"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,5 +110,11 @@ SETTINGSTOPROCESS = {
|
||||
"usecustompool": "custom",
|
||||
"saveonexit": "saveonexit"
|
||||
}
|
||||
},
|
||||
"bottom": {
|
||||
"content": {
|
||||
"seed": "seed",
|
||||
"generationcount": "count"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,11 +36,12 @@ def bottom_frame(self, parent, args=None):
|
||||
savedSeed = parent.settings["seed"]
|
||||
self.widgets[widget].storageVar = StringVar(value=savedSeed)
|
||||
# textbox
|
||||
self.widgets[widget].type = "textbox"
|
||||
self.widgets[widget].pieces["textbox"] = Entry(self.widgets[widget].pieces["frame"], width=15, textvariable=self.widgets[widget].storageVar)
|
||||
self.widgets[widget].pieces["textbox"].pack(side=LEFT)
|
||||
|
||||
def saveSeed(caller,_,mode):
|
||||
savedSeed = self.seedVar.get()
|
||||
savedSeed = self.widgets["seed"].storageVar.get()
|
||||
parent.settings["seed"] = int(savedSeed) if savedSeed.isdigit() else None
|
||||
self.widgets[widget].storageVar.trace_add("write",saveSeed)
|
||||
# frame: pack
|
||||
@@ -91,6 +92,7 @@ def bottom_frame(self, parent, args=None):
|
||||
self.widgets[widget].pieces = {}
|
||||
|
||||
# button
|
||||
self.widgets[widget].type = "button"
|
||||
self.widgets[widget].pieces["button"] = Button(self, text='Generate Patched Rom', command=generateRom)
|
||||
# button: pack
|
||||
self.widgets[widget].pieces["button"].pack(side=LEFT)
|
||||
@@ -114,14 +116,12 @@ def bottom_frame(self, parent, args=None):
|
||||
self.widgets[widget].storageVar = StringVar(value=parent.settings["outputpath"])
|
||||
|
||||
# button
|
||||
self.widgets[widget].type = "button"
|
||||
self.widgets[widget].pieces["button"] = Button(self, text='Open Output Directory', command=open_output)
|
||||
# button: pack
|
||||
self.widgets[widget].pieces["button"].pack(side=RIGHT)
|
||||
|
||||
## Documentation Button
|
||||
if os.path.exists(local_path('README.html')):
|
||||
def open_readme():
|
||||
open_file(local_path('README.html'))
|
||||
# widget ID
|
||||
widget = "docs"
|
||||
|
||||
@@ -130,6 +130,12 @@ def bottom_frame(self, parent, args=None):
|
||||
# pieces
|
||||
self.widgets[widget].pieces = {}
|
||||
# button
|
||||
self.widgets[widget].type = "button"
|
||||
self.widgets[widget].selectbox = Empty()
|
||||
self.widgets[widget].selectbox.storageVar = Empty()
|
||||
if os.path.exists(local_path('README.html')):
|
||||
def open_readme():
|
||||
open_file(local_path('README.html'))
|
||||
self.widgets[widget].pieces["button"] = Button(self, text='Open Documentation', command=open_readme)
|
||||
# button: pack
|
||||
self.widgets[widget].pieces["button"].pack(side=RIGHT)
|
||||
|
||||
@@ -24,16 +24,26 @@ def loadcliargs(gui, args, settings=None):
|
||||
for subpage in options[mainpage]:
|
||||
# Cycle through each widget
|
||||
for widget in options[mainpage][subpage]:
|
||||
if widget in gui.pages[mainpage].pages[subpage].widgets:
|
||||
thisType = ""
|
||||
# Get the value and set it
|
||||
arg = options[mainpage][subpage][widget]
|
||||
label = fish.translate("gui","gui",mainpage + '.' + subpage + '.' + widget)
|
||||
if hasattr(gui.pages[mainpage].pages[subpage].widgets[widget],"type"):
|
||||
type = gui.pages[mainpage].pages[subpage].widgets[widget].type
|
||||
if type == "checkbox":
|
||||
thisType = gui.pages[mainpage].pages[subpage].widgets[widget].type
|
||||
if thisType == "checkbox":
|
||||
gui.pages[mainpage].pages[subpage].widgets[widget].checkbox.configure(text=label)
|
||||
elif type == "selectbox":
|
||||
elif thisType == "selectbox":
|
||||
theseOptions = gui.pages[mainpage].pages[subpage].widgets[widget].selectbox.options
|
||||
gui.pages[mainpage].pages[subpage].widgets[widget].label.configure(text=label)
|
||||
elif type == "spinbox":
|
||||
i = 0
|
||||
for value in theseOptions["values"]:
|
||||
gui.pages[mainpage].pages[subpage].widgets[widget].selectbox.options["labels"][i] = fish.translate("gui","gui",mainpage + '.' + subpage + '.' + widget + '.' + value)
|
||||
i += 1
|
||||
for i in range(0, len(theseOptions["values"])):
|
||||
gui.pages[mainpage].pages[subpage].widgets[widget].selectbox["menu"].entryconfigure(i, label=theseOptions["labels"][i])
|
||||
gui.pages[mainpage].pages[subpage].widgets[widget].selectbox.options = theseOptions
|
||||
elif thisType == "spinbox":
|
||||
gui.pages[mainpage].pages[subpage].widgets[widget].label.configure(text=label)
|
||||
gui.pages[mainpage].pages[subpage].widgets[widget].storageVar.set(args[arg])
|
||||
# If we're on the Game Options page and it's not about Hints
|
||||
@@ -105,47 +115,53 @@ def loadcliargs(gui, args, settings=None):
|
||||
|
||||
# Get Seed ID
|
||||
mainpage = "bottom"
|
||||
subpage = "content"
|
||||
widget = "seed"
|
||||
setting = "seed"
|
||||
if args[setting]:
|
||||
gui.frames[mainpage].widgets[widget].storageVar.set(str(args[setting]))
|
||||
gui.pages[mainpage].widgets[widget].storageVar.set(str(args[setting]))
|
||||
# set textbox/frame label
|
||||
label = fish.translate("gui","gui",mainpage + '.' + widget)
|
||||
gui.frames[mainpage].widgets[widget].pieces["frame"].label.configure(text=label)
|
||||
label = fish.translate("gui","gui",mainpage + '.' + subpage + '.' + widget)
|
||||
gui.pages[mainpage].pages[subpage].widgets[widget].pieces["frame"].label.configure(text=label)
|
||||
|
||||
# Get number of generations to run
|
||||
mainpage = "bottom"
|
||||
subpage = "content"
|
||||
widget = "generationcount"
|
||||
setting = "count"
|
||||
if args[setting]:
|
||||
gui.frames[mainpage].widgets[widget].storageVar.set(str(args[setting]))
|
||||
gui.pages[mainpage].pages[subpage].widgets[widget].storageVar.set(str(args[setting]))
|
||||
# set textbox/frame label
|
||||
label = fish.translate("gui","gui",mainpage + '.' + widget)
|
||||
gui.frames[mainpage].widgets[widget].label.configure(text=label)
|
||||
label = fish.translate("gui","gui",mainpage + '.' + subpage + '.' + widget)
|
||||
gui.pages[mainpage].pages[subpage].widgets[widget].label.configure(text=label)
|
||||
|
||||
# Set Generate button
|
||||
mainpage = "bottom"
|
||||
subpage = "content"
|
||||
widget = "go"
|
||||
# set textbox/frame label
|
||||
label = fish.translate("gui","gui",mainpage + '.' + widget)
|
||||
gui.frames[mainpage].widgets[widget].pieces["button"].configure(text=label)
|
||||
label = fish.translate("gui","gui",mainpage + '.' + subpage + '.' + widget)
|
||||
gui.pages[mainpage].pages[subpage].widgets[widget].pieces["button"].configure(text=label)
|
||||
|
||||
# Set Output Directory button
|
||||
mainpage = "bottom"
|
||||
subpage = "content"
|
||||
widget = "outputdir"
|
||||
# set textbox/frame label
|
||||
label = fish.translate("gui","gui",mainpage + '.' + widget)
|
||||
gui.frames[mainpage].widgets[widget].pieces["button"].configure(text=label)
|
||||
label = fish.translate("gui","gui",mainpage + '.' + subpage + '.' + widget)
|
||||
gui.pages[mainpage].pages[subpage].widgets[widget].pieces["button"].configure(text=label)
|
||||
# Get output path
|
||||
gui.frames[mainpage].widgets[widget].storageVar.set(args["outputpath"])
|
||||
gui.pages[mainpage].pages[subpage].widgets[widget].storageVar.set(args["outputpath"])
|
||||
|
||||
# Set Output Directory button
|
||||
# Set Documentation button
|
||||
mainpage = "bottom"
|
||||
subpage = "content"
|
||||
widget = "docs"
|
||||
if widget in gui.pages[mainpage].pages[subpage].widgets:
|
||||
if "button" in gui.pages[mainpage].pages[subpage].widgets[widget].pieces:
|
||||
# set textbox/frame label
|
||||
label = fish.translate("gui","gui",mainpage + '.' + widget)
|
||||
if widget in gui.frames[mainpage].widgets:
|
||||
gui.frames[mainpage].widgets[widget].pieces["button"].configure(text=label)
|
||||
label = fish.translate("gui","gui",mainpage + '.' + subpage + '.' + widget)
|
||||
gui.pages[mainpage].pages[subpage].widgets[widget].pieces["button"].configure(text=label)
|
||||
|
||||
# Figure out Sprite Selection
|
||||
def sprite_setter(spriteObject):
|
||||
|
||||
@@ -28,27 +28,81 @@ def make_checkbox(self, parent, label, storageVar, manager, managerAttrs):
|
||||
|
||||
# Make an OptionMenu with a label and pretty option labels
|
||||
def make_selectbox(self, parent, label, options, storageVar, manager, managerAttrs):
|
||||
def change_storage(*args):
|
||||
self.storageVar.set(options[self.labelVar.get()])
|
||||
def change_selected(*args):
|
||||
keys = options.keys()
|
||||
vals = options.values()
|
||||
keysList = list(keys)
|
||||
valsList = list(vals)
|
||||
self.labelVar.set(keysList[valsList.index(str(self.storageVar.get()))])
|
||||
self = Frame(parent, name="selectframe-" + label.lower())
|
||||
self.storageVar = storageVar
|
||||
self.storageVar.trace_add("write",change_selected)
|
||||
|
||||
labels = options
|
||||
|
||||
if isinstance(options,dict):
|
||||
labels = options.keys()
|
||||
|
||||
self.labelVar = StringVar()
|
||||
self.storageVar = storageVar
|
||||
self.selectbox = OptionMenu(self, self.labelVar, *labels)
|
||||
self.selectbox.options = {}
|
||||
|
||||
if isinstance(options,dict):
|
||||
self.selectbox.options["labels"] = list(options.keys())
|
||||
self.selectbox.options["values"] = list(options.values())
|
||||
else:
|
||||
self.selectbox.options["labels"] = ["" for i in range(0,len(options))]
|
||||
self.selectbox.options["values"] = options
|
||||
|
||||
def change_thing(thing, *args):
|
||||
labels = self.selectbox.options["labels"]
|
||||
values = self.selectbox.options["values"]
|
||||
check = ""
|
||||
lbl = ""
|
||||
val = ""
|
||||
idx = 0
|
||||
|
||||
if thing == "storage":
|
||||
check = self.labelVar.get()
|
||||
elif thing == "label":
|
||||
check = self.storageVar.get()
|
||||
|
||||
if check in labels:
|
||||
idx = labels.index(check)
|
||||
if check in values:
|
||||
idx = values.index(check)
|
||||
|
||||
lbl = labels[idx]
|
||||
val = values[idx]
|
||||
|
||||
if thing == "storage":
|
||||
self.storageVar.set(val)
|
||||
elif thing == "label":
|
||||
self.labelVar.set(lbl)
|
||||
self.selectbox["menu"].entryconfigure(idx,label=lbl)
|
||||
self.selectbox.configure(state="active")
|
||||
|
||||
|
||||
def change_storage(*args):
|
||||
change_thing("storage", *args)
|
||||
def change_selected(*args):
|
||||
change_thing("label", *args)
|
||||
|
||||
self.storageVar.trace_add("write",change_selected)
|
||||
self.labelVar.trace_add("write",change_storage)
|
||||
self.label = Label(self, text=label)
|
||||
|
||||
if managerAttrs is not None and "label" in managerAttrs:
|
||||
self.label.pack(managerAttrs["label"])
|
||||
else:
|
||||
self.label.pack()
|
||||
self.selectbox = OptionMenu(self, self.labelVar, *options.keys())
|
||||
|
||||
self.selectbox.config(width=20)
|
||||
self.labelVar.set(managerAttrs["default"] if "default" in managerAttrs else list(options.keys())[0])
|
||||
idx = 0
|
||||
default = self.selectbox.options["values"][idx]
|
||||
if "default" in managerAttrs:
|
||||
default = managerAttrs["default"]
|
||||
labels = self.selectbox.options["labels"]
|
||||
values = self.selectbox.options["values"]
|
||||
if default in values:
|
||||
idx = values.index(default)
|
||||
default = labels[idx]
|
||||
self.labelVar.set(default)
|
||||
self.selectbox["menu"].entryconfigure(idx,label=default)
|
||||
|
||||
if managerAttrs is not None and "selectbox" in managerAttrs:
|
||||
self.selectbox.pack(managerAttrs["selectbox"])
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user