From 783d2593073aea2031f124d27d8df61063013778 Mon Sep 17 00:00:00 2001 From: "Mike A. Trethewey" Date: Sat, 15 Feb 2020 07:20:27 -0800 Subject: [PATCH] Dictify Entrando Options Fix null arg issue --- gui/loadcliargs.py | 3 +- gui/randomize/entrando.py | 90 +++++++++++++++++++-------------------- 2 files changed, 46 insertions(+), 47 deletions(-) diff --git a/gui/loadcliargs.py b/gui/loadcliargs.py index 26adbde7..5fa012bc 100644 --- a/gui/loadcliargs.py +++ b/gui/loadcliargs.py @@ -123,4 +123,5 @@ def loadadjustargs(gui, settings): for subpage in options[mainpage]: for widget in options[mainpage][subpage]: key = options[mainpage][subpage][widget] - gui.pages[mainpage].content.widgets[widget].storageVar.set(settings[key]) + if key in settings: + gui.pages[mainpage].content.widgets[widget].storageVar.set(settings[key]) diff --git a/gui/randomize/entrando.py b/gui/randomize/entrando.py index ab081bb9..9c2db78f 100644 --- a/gui/randomize/entrando.py +++ b/gui/randomize/entrando.py @@ -8,52 +8,50 @@ def entrando_page(parent): # Entrance Randomizer options self.widgets = {} - ## Pyramid pre-opened - key = "openpyramid" - self.widgets[key] = widgets.make_widget( - self, - "checkbox", - self, - "Pre-open Pyramid Hole", - None - ) - self.widgets[key].pack(anchor=W) - - ## Shuffle Ganon - key = "shuffleganon" - self.widgets[key] = widgets.make_widget( - self, - "checkbox", - self, - "Include Ganon's Tower and Pyramid Hole in shuffle pool", - None - ) - self.widgets[key].pack(anchor=W) - - ## Entrance Shuffle - key = "entranceshuffle" - self.widgets[key] = widgets.make_widget( - self, - "selectbox", - self, - "Entrance Shuffle", - None, - {"label": {"side": LEFT}, "selectbox": {"side": RIGHT}}, - { - "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" + myDict = { + ## Pyramid pre-opened + "openpyramid": { + "type": "checkbox", + "label": { + "text": "Pre-open Pyramid Hole" + } + }, + ## Shuffle Ganon + "shuffleganon": { + "type": "checkbox", + "label": { + "text": "Include Ganon's Tower and Pyramid Hole in shuffle pool" + } + }, + ## Entrance Shuffle + "entranceshuffle": { + "type": "selectbox", + "label": { + "text": "Entrance Shuffle" + }, + "packAttrs": { + "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" + } } - ) - self.widgets[key].pack(anchor=W) + } + dictWidgets = widgets.make_widgets_from_dict(self, myDict, self) + for key in dictWidgets: + self.widgets[key] = dictWidgets[key] + self.widgets[key].pack(anchor=W) return self