diff --git a/Utils.py b/Utils.py index 8376d5fb..43cae912 100644 --- a/Utils.py +++ b/Utils.py @@ -78,9 +78,7 @@ def output_path(path): # True for expanding the tilde into a fully qualified path documents = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, True)[0] elif sys.platform.find("linux") or sys.platform.find("ubuntu") or sys.platform.find("unix"): - documents = os.path.expanduser("~") - print(documents) - documents = os.path.join(documents,"Documents") + documents = os.path.join(os.path.expanduser("~"),"Documents") else: raise NotImplementedError('Not supported yet') diff --git a/resources/app/cli/args.json b/resources/app/cli/args.json index f95f3a1d..b991620f 100644 --- a/resources/app/cli/args.json +++ b/resources/app/cli/args.json @@ -200,12 +200,12 @@ }, "shuffleganon": { "action": "store_true", - "type": "bool", - "help": "suppress" + "type": "bool" }, "no-shuffleganon": { "action": "store_false", - "dest": "shuffleganon" + "dest": "shuffleganon", + "help": "suppress" }, "heartbeep": { "choices": [ diff --git a/resources/app/cli/lang/en.json b/resources/app/cli/lang/en.json index 53ef9599..fdd58163 100644 --- a/resources/app/cli/lang/en.json +++ b/resources/app/cli/lang/en.json @@ -246,9 +246,9 @@ "None: You will be able to reach enough locations to beat the game." ], "hints": [ "Make telepathic tiles and storytellers give helpful hints. (default: %(default)s)" ], - "no-shuffleganon": [ - "If set, the Pyramid Hole and Ganon's Tower are not", - "included entrance shuffle pool. (default: %(default)s)" + "shuffleganon": [ + "Include the Ganon's Tower and Pyramid Hole in the", + "entrance shuffle pool. (default: %(default)s)" ], "heartbeep": [ "Select the rate at which the heart beep sound is played at", diff --git a/resources/app/gui/randomize/dungeon/keysanity.json b/resources/app/gui/randomize/dungeon/keysanity.json index 1be4c3fd..29efc0e4 100644 --- a/resources/app/gui/randomize/dungeon/keysanity.json +++ b/resources/app/gui/randomize/dungeon/keysanity.json @@ -1,26 +1,6 @@ { - "mapshuffle": { - "type": "checkbox", - "label": { - "text": "Maps" - } - }, - "compassshuffle": { - "type": "checkbox", - "label": { - "text": "Compasses" - } - }, - "smallkeyshuffle": { - "type": "checkbox", - "label": { - "text": "Small Keys" - } - }, - "bigkeyshuffle": { - "type": "checkbox", - "label": { - "text": "Big Keys" - } - } + "mapshuffle": { "type": "checkbox" }, + "compassshuffle": { "type": "checkbox" }, + "smallkeyshuffle": { "type": "checkbox" }, + "bigkeyshuffle": { "type": "checkbox" } } diff --git a/resources/app/gui/randomize/dungeon/widgets.json b/resources/app/gui/randomize/dungeon/widgets.json index be8973d8..91ef1f3e 100644 --- a/resources/app/gui/randomize/dungeon/widgets.json +++ b/resources/app/gui/randomize/dungeon/widgets.json @@ -1,16 +1,7 @@ { "dungeondoorshuffle": { "type": "selectbox", - "label": { - "text": "Dungeon Door Shuffle" - }, "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - }, "default": "basic" }, "options": [ @@ -19,24 +10,10 @@ "crossed" ] }, - "experimental": { - "type": "checkbox", - "label": { - "text": "Enable Experimental Features" - } - }, + "experimental": { "type": "checkbox" }, "dungeon_counters": { "type": "selectbox", - "label": { - "text": "Dungeon Chest Counters" - }, "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - }, "default": "default" }, "options": [ diff --git a/resources/app/gui/randomize/enemizer/widgets.json b/resources/app/gui/randomize/enemizer/widgets.json index af18a221..8103e8cb 100644 --- a/resources/app/gui/randomize/enemizer/widgets.json +++ b/resources/app/gui/randomize/enemizer/widgets.json @@ -1,26 +1,10 @@ { "checkboxes": { - "potshuffle": { - "type": "checkbox", - "label": { - "text": "Pot Shuffle" - } - } + "potshuffle": { "type": "checkbox" } }, "leftEnemizerFrame": { "enemyshuffle": { "type": "selectbox", - "label": { - "text": "Enemy Shuffle" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ "none", "shuffled", @@ -29,17 +13,6 @@ }, "bossshuffle": { "type": "selectbox", - "label": { - "text": "Boss Shuffle" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ "none", "basic", @@ -51,17 +24,6 @@ "rightEnemizerFrame": { "enemydamage": { "type": "selectbox", - "label": { - "text": "Enemy Damage" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ "default", "shuffled", @@ -70,17 +32,6 @@ }, "enemyhealth": { "type": "selectbox", - "label": { - "text": "Enemy Health" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ "default", "easy", @@ -90,4 +41,4 @@ ] } } -} \ No newline at end of file +} diff --git a/resources/app/gui/randomize/entrando/widgets.json b/resources/app/gui/randomize/entrando/widgets.json index f1c8aad6..e46ee36e 100644 --- a/resources/app/gui/randomize/entrando/widgets.json +++ b/resources/app/gui/randomize/entrando/widgets.json @@ -1,26 +1,9 @@ { "widgets": { - "openpyramid": { - "type": "checkbox", - "label": { - "text": "Pre-open Pyramid Hole" - } - }, - "shuffleganon": { - "type": "checkbox", - "label": { - "text": "Include Ganon's Tower and Pyramid Hole in shuffle pool" - } - }, - "entranceshuffle": { + "openpyramid": { "type": "checkbox" }, + "shuffleganon": { "type": "checkbox" }, + "entranceshuffle": { "type": "selectbox", - "label": { - "text": "Entrance Shuffle" - }, - "managerAttrs": { - "label": { "side": "left" }, - "selectbox": { "side": "right" } - }, "options": [ "vanilla", "simple", diff --git a/resources/app/gui/randomize/gameoptions/widgets.json b/resources/app/gui/randomize/gameoptions/widgets.json index f84ba3ee..ac187f86 100644 --- a/resources/app/gui/randomize/gameoptions/widgets.json +++ b/resources/app/gui/randomize/gameoptions/widgets.json @@ -1,39 +1,15 @@ { - "checkboxes": { + "checkboxes": { "hints": { "type": "checkbox", - "label": { - "text": "Include Helpful Hints" - }, "default": "true" }, - "nobgm": { - "type": "checkbox", - "label": { - "text": "Disable Music & MSU-1" - } - }, - "quickswap": { - "type": "checkbox", - "label": { - "text": "L/R Quickswapping" - } - } + "nobgm": { "type": "checkbox" }, + "quickswap": { "type": "checkbox" } }, "leftRomOptionsFrame": { "heartcolor": { "type": "selectbox", - "label": { - "text": "Heart Color" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ "red", "blue", @@ -44,16 +20,7 @@ }, "heartbeep": { "type": "selectbox", - "label": { - "text": "Heart Beep sound rate" - }, "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - }, "default": "normal" }, "options": [ @@ -68,16 +35,7 @@ "rightRomOptionsFrame": { "menuspeed": { "type": "selectbox", - "label": { - "text": "Menu Speed" - }, "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - }, "default": "normal" }, "options": [ @@ -91,17 +49,6 @@ }, "owpalettes": { "type": "selectbox", - "label": { - "text": "Overworld Palettes" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ "default", "random", @@ -110,17 +57,6 @@ }, "uwpalettes": { "type": "selectbox", - "label": { - "text": "Underworld Palettes" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ "default", "random", diff --git a/resources/app/gui/randomize/generation/checkboxes.json b/resources/app/gui/randomize/generation/checkboxes.json index 43693b72..d609e866 100644 --- a/resources/app/gui/randomize/generation/checkboxes.json +++ b/resources/app/gui/randomize/generation/checkboxes.json @@ -1,45 +1,6 @@ { - "spoiler": { - "type": "checkbox", - "label": { - "text": "Create Spoiler Log" - } - }, - "suppressrom": { - "type": "checkbox", - "label": { - "text": "Do not create patched ROM" - } - }, - "usestartinventory": { - "type": "checkbox", - "label": { - "text": "Use starting inventory" - } - }, - "usecustompool": { - "type": "checkbox", - "label": { - "text": "Use custom item pool" - } - }, - "saveonexit": { - "type": "selectbox", - "label": { - "text": "Save Settings on Exit" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, - "options": [ - "ask", - "always", - "never" - ] - } + "spoiler": { "type": "checkbox" }, + "suppressrom": { "type": "checkbox" }, + "usestartinventory": { "type": "checkbox" }, + "usecustompool": { "type": "checkbox" } } diff --git a/resources/app/gui/randomize/generation/widgets.json b/resources/app/gui/randomize/generation/widgets.json new file mode 100644 index 00000000..d22de592 --- /dev/null +++ b/resources/app/gui/randomize/generation/widgets.json @@ -0,0 +1,10 @@ +{ + "saveonexit": { + "type": "selectbox", + "options": [ + "ask", + "always", + "never" + ] + } +} diff --git a/resources/app/gui/randomize/item/widgets.json b/resources/app/gui/randomize/item/widgets.json index 96dcaa99..6a3ebbaa 100644 --- a/resources/app/gui/randomize/item/widgets.json +++ b/resources/app/gui/randomize/item/widgets.json @@ -1,25 +1,11 @@ { "checkboxes": { - "retro": { - "type": "checkbox", - "label": { - "text": "Retro mode (universal keys)" - } - } + "retro": { "type": "checkbox" } }, "leftItemFrame": { "worldstate": { "type": "selectbox", - "label": { - "text": "World State" - }, "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - }, "default": "open" }, "options": [ @@ -31,17 +17,6 @@ }, "logiclevel": { "type": "selectbox", - "label": { - "text": "Logic Level" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ "noglitches", "minorglitches", @@ -50,17 +25,6 @@ }, "goal": { "type": "selectbox", - "label": { - "text": "Goal" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ "ganon", "pedestal", @@ -71,67 +35,20 @@ }, "crystals_gt": { "type": "selectbox", - "label": { - "text": "Crystals to open GT" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ - "0", - "1", - "2", - "3", - "4", - "5", - "6", - "7", + 0, 1, 2, 3, 4, 5, 6, 7, "random" ] }, "crystals_ganon": { "type": "selectbox", - "label": { - "text": "Crystals to harm Ganon" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ - "0", - "1", - "2", - "3", - "4", - "5", - "6", - "7", + 0, 1, 2, 3, 4, 5, 6, 7, "random" ] }, "weapons": { "type": "selectbox", - "label": { - "text": "Weapons" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ "random", "assured", @@ -143,17 +60,6 @@ "rightItemFrame": { "itempool": { "type": "selectbox", - "label": { - "text": "Item Pool" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ "normal", "hard", @@ -162,17 +68,6 @@ }, "itemfunction": { "type": "selectbox", - "label": { - "text": "Item Functionality" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ "normal", "hard", @@ -181,17 +76,6 @@ }, "timer": { "type": "selectbox", - "label": { - "text": "Timer Setting" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ "none", "display", @@ -203,17 +87,6 @@ }, "progressives": { "type": "selectbox", - "label": { - "text": "Progressive Items" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ "on", "off", @@ -222,17 +95,6 @@ }, "accessibility": { "type": "selectbox", - "label": { - "text": "Accessibility" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - } - }, "options": [ "items", "locations", @@ -241,16 +103,7 @@ }, "sortingalgo": { "type": "selectbox", - "label": { - "text": "Item Sorting" - }, "managerAttrs": { - "label": { - "side": "left" - }, - "selectbox": { - "side": "right" - }, "default": "balanced" }, "options": [ diff --git a/resources/app/gui/randomize/multiworld/widgets.json b/resources/app/gui/randomize/multiworld/widgets.json index b943c017..4038bed7 100644 --- a/resources/app/gui/randomize/multiworld/widgets.json +++ b/resources/app/gui/randomize/multiworld/widgets.json @@ -1,16 +1,3 @@ { - "worlds": { - "type": "spinbox", - "label": { - "text": "Worlds" - }, - "managerAttrs": { - "label": { - "side": "left" - }, - "spinbox": { - "side": "right" - } - } - } + "worlds": { "type": "spinbox" } } diff --git a/source/gui/loadcliargs.py b/source/gui/loadcliargs.py index 6d8ae3b5..6db02220 100644 --- a/source/gui/loadcliargs.py +++ b/source/gui/loadcliargs.py @@ -40,7 +40,7 @@ def loadcliargs(gui, args, settings=None): 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) + gui.pages[mainpage].pages[subpage].widgets[widget].selectbox.options["labels"][i] = fish.translate("gui","gui",mainpage + '.' + subpage + '.' + widget + '.' + str(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]) diff --git a/source/gui/randomize/generation.py b/source/gui/randomize/generation.py index 58eb9b29..7bdd5cd8 100644 --- a/source/gui/randomize/generation.py +++ b/source/gui/randomize/generation.py @@ -25,6 +25,17 @@ def generation_page(parent,settings): self.widgets[key] = dictWidgets[key] self.widgets[key].pack(anchor=W) + self.frames["widgets"] = Frame(self) + self.frames["widgets"].pack(anchor=W) + # Load Generation Setup option widgets as defined by JSON file + # Defns include frame name, widget type, widget options, widget placement attributes + with open(os.path.join("resources","app","gui","randomize","generation","widgets.json")) as items: + myDict = json.load(items) + dictWidgets = widgets.make_widgets_from_dict(self, myDict, self.frames["widgets"]) + for key in dictWidgets: + self.widgets[key] = dictWidgets[key] + self.widgets[key].pack(anchor=W) + self.frames["baserom"] = Frame(self) self.frames["baserom"].pack(anchor=W, fill=X) ## Locate base ROM diff --git a/source/gui/widgets.py b/source/gui/widgets.py index f5512c89..c96dca02 100644 --- a/source/gui/widgets.py +++ b/source/gui/widgets.py @@ -1,4 +1,4 @@ -from tkinter import Checkbutton, Entry, Frame, IntVar, Label, OptionMenu, Spinbox, StringVar, RIGHT, X +from tkinter import Checkbutton, Entry, Frame, IntVar, Label, OptionMenu, Spinbox, StringVar, LEFT, RIGHT, X from source.classes.Empty import Empty # Override Spinbox to include mousewheel support for changing value @@ -17,9 +17,9 @@ class mySpinbox(Spinbox): # Make a Checkbutton with a label def make_checkbox(self, parent, label, storageVar, manager, managerAttrs): - self = Frame(parent, name="checkframe-" + label.lower()) + self = Frame(parent) self.storageVar = storageVar - self.checkbox = Checkbutton(self, text=label, variable=self.storageVar, name="checkbox-" + label.lower()) + self.checkbox = Checkbutton(self, text=label, variable=self.storageVar) if managerAttrs is not None: self.checkbox.pack(managerAttrs) else: @@ -28,7 +28,7 @@ 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): - self = Frame(parent, name="selectframe-" + label.lower()) + self = Frame(parent) labels = options @@ -88,48 +88,49 @@ def make_selectbox(self, parent, label, options, storageVar, manager, managerAtt if managerAttrs is not None and "label" in managerAttrs: self.label.pack(managerAttrs["label"]) else: - self.label.pack() + self.label.pack(side=LEFT) self.selectbox.config(width=20) idx = 0 default = self.selectbox.options["values"][idx] - if "default" in managerAttrs: + if managerAttrs is not None and "default" in managerAttrs: default = managerAttrs["default"] labels = self.selectbox.options["labels"] values = self.selectbox.options["values"] if default in values: idx = values.index(default) - self.labelVar.set(labels[idx]) + if not labels[idx] == "": + self.labelVar.set(labels[idx]) + self.selectbox["menu"].entryconfigure(idx,label=labels[idx]) self.storageVar.set(values[idx]) - self.selectbox["menu"].entryconfigure(idx,label=labels[idx]) if managerAttrs is not None and "selectbox" in managerAttrs: self.selectbox.pack(managerAttrs["selectbox"]) else: - self.selectbox.pack() + self.selectbox.pack(side=RIGHT) return self # Make a Spinbox with a label, limit 1-100 def make_spinbox(self, parent, label, storageVar, manager, managerAttrs): - self = Frame(parent, name="spinframe-" + label.lower()) + self = Frame(parent) self.storageVar = storageVar 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.label.pack(side=LEFT) fromNum = 1 toNum = 100 - if "spinbox" in managerAttrs: + if managerAttrs is not None and "spinbox" in managerAttrs: if "from" in managerAttrs: fromNum = managerAttrs["spinbox"]["from"] if "to" in managerAttrs: toNum = managerAttrs["spinbox"]["to"] - self.spinbox = mySpinbox(self, from_=fromNum, to=toNum, width=5, textvariable=self.storageVar, name="spinbox-" + label.lower()) + self.spinbox = mySpinbox(self, from_=fromNum, to=toNum, width=5, textvariable=self.storageVar) if managerAttrs is not None and "spinbox" in managerAttrs: self.spinbox.pack(managerAttrs["spinbox"]) else: - self.spinbox.pack() + self.spinbox.pack(side=RIGHT) return self # Make an Entry box with a label