Ugh, I think I did it

This commit is contained in:
Mike A. Trethewey
2020-03-10 17:23:23 -07:00
parent 58bb9fffba
commit e901f0f1f5
12 changed files with 339 additions and 254 deletions

View File

@@ -24,36 +24,46 @@ def loadcliargs(gui, args, settings=None):
for subpage in options[mainpage]:
# Cycle through each widget
for widget in options[mainpage][subpage]:
# 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":
gui.pages[mainpage].pages[subpage].widgets[widget].checkbox.configure(text=label)
elif type == "selectbox":
gui.pages[mainpage].pages[subpage].widgets[widget].label.configure(text=label)
elif type == "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
if subpage == "gameoptions" and not widget == "hints":
# Check if we've got settings
# Check if we've got the widget in Adjust settings
hasSettings = settings is not None
hasWidget = ("adjust." + widget) in settings if hasSettings else None
label = fish.translate("gui","gui","adjust." + widget)
if ("adjust." + widget) in label:
label = fish.translate("gui","gui","randomizer.gameoptions." + widget)
if hasattr(gui.pages["adjust"].content.widgets[widget],"type"):
type = gui.pages["adjust"].content.widgets[widget].type
if type == "checkbox":
gui.pages["adjust"].content.widgets[widget].checkbox.configure(text=label)
elif type == "selectbox":
gui.pages["adjust"].content.widgets[widget].label.configure(text=label)
if hasWidget is None:
# If we've got a Game Options val and we don't have an Adjust val, use the Game Options val
gui.pages["adjust"].content.widgets[widget].storageVar.set(args[arg])
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"):
thisType = gui.pages[mainpage].pages[subpage].widgets[widget].type
if thisType == "checkbox":
gui.pages[mainpage].pages[subpage].widgets[widget].checkbox.configure(text=label)
elif thisType == "selectbox":
theseOptions = gui.pages[mainpage].pages[subpage].widgets[widget].selectbox.options
gui.pages[mainpage].pages[subpage].widgets[widget].label.configure(text=label)
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
if subpage == "gameoptions" and not widget == "hints":
# Check if we've got settings
# Check if we've got the widget in Adjust settings
hasSettings = settings is not None
hasWidget = ("adjust." + widget) in settings if hasSettings else None
label = fish.translate("gui","gui","adjust." + widget)
if ("adjust." + widget) in label:
label = fish.translate("gui","gui","randomizer.gameoptions." + widget)
if hasattr(gui.pages["adjust"].content.widgets[widget],"type"):
type = gui.pages["adjust"].content.widgets[widget].type
if type == "checkbox":
gui.pages["adjust"].content.widgets[widget].checkbox.configure(text=label)
elif type == "selectbox":
gui.pages["adjust"].content.widgets[widget].label.configure(text=label)
if hasWidget is None:
# If we've got a Game Options val and we don't have an Adjust val, use the Game Options val
gui.pages["adjust"].content.widgets[widget].storageVar.set(args[arg])
# Get EnemizerCLI setting
mainpage = "randomizer"
@@ -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"
# 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)
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 + '.' + subpage + '.' + widget)
gui.pages[mainpage].pages[subpage].widgets[widget].pieces["button"].configure(text=label)
# Figure out Sprite Selection
def sprite_setter(spriteObject):