JSONify Dungeon Rando options

This commit is contained in:
Mike A. Trethewey
2020-02-17 01:26:21 -08:00
parent 20bc14ba12
commit 2a1e9726b1
3 changed files with 68 additions and 67 deletions

View File

@@ -1,5 +1,7 @@
from tkinter import ttk, IntVar, StringVar, Checkbutton, Frame, Label, OptionMenu, E, W, LEFT, RIGHT from tkinter import ttk, IntVar, StringVar, Checkbutton, Frame, Label, OptionMenu, E, W, LEFT, RIGHT
import gui.widgets as widgets import gui.widgets as widgets
import json
import os
def dungeon_page(parent): def dungeon_page(parent):
# Dungeon Shuffle # Dungeon Shuffle
@@ -14,73 +16,18 @@ def dungeon_page(parent):
mscbLabel = Label(mcsbshuffleFrame, text="Shuffle: ") mscbLabel = Label(mcsbshuffleFrame, text="Shuffle: ")
mscbLabel.pack(side=LEFT) mscbLabel.pack(side=LEFT)
myDict = { with open(os.path.join("resources","app","gui","randomize","dungeon","keysanity.json")) as keysanityItems:
## Map Shuffle myDict = json.load(keysanityItems)
"mapshuffle": { dictWidgets = widgets.make_widgets_from_dict(self, myDict, mcsbshuffleFrame)
"type": "checkbox", for key in dictWidgets:
"label": { self.widgets[key] = dictWidgets[key]
"text": "Maps" self.widgets[key].pack(side=LEFT)
}
},
## Compass Shuffle
"compassshuffle": {
"type": "checkbox",
"label": {
"text": "Compasses"
}
},
## Small Key Shuffle
"smallkeyshuffle": {
"type": "checkbox",
"label": {
"text": "Small Keys"
}
},
## Big Key Shuffle
"bigkeyshuffle": {
"type": "checkbox",
"label": {
"text": "Small Keys"
}
}
}
dictWidgets = widgets.make_widgets_from_dict(self, myDict, mcsbshuffleFrame) with open(os.path.join("resources","app","gui","randomize","dungeon","widgets.json")) as dungeonWidgets:
myDict = json.load(dungeonWidgets)
for key in dictWidgets: dictWidgets = widgets.make_widgets_from_dict(self, myDict, self)
self.widgets[key] = dictWidgets[key] for key in dictWidgets:
self.widgets[key].pack(side=LEFT) self.widgets[key] = dictWidgets[key]
self.widgets[key].pack(anchor=W)
myDict = {
"dungeondoorshuffle": {
"type": "selectbox",
"label": {
"text": "Dungeon Door Shuffle"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": {"side": RIGHT},
"default": "Basic"
},
"options": {
"Vanilla": "vanilla",
"Basic": "basic",
"Crossed": "crossed"
}
},
## Experiemental features
"experimental": {
"type": "checkbox",
"label": {
"text": "Enable Experimental Features"
}
}
}
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 return self

View File

@@ -0,0 +1,26 @@
{
"mapshuffle": {
"type": "checkbox",
"label": {
"text": "Maps"
}
},
"compassshuffle": {
"type": "checkbox",
"label": {
"text": "Compasses"
}
},
"smallkeyshuffle": {
"type": "checkbox",
"label": {
"text": "Small Keys"
}
},
"bigkeyshuffle": {
"type": "checkbox",
"label": {
"text": "Small Keys"
}
}
}

View File

@@ -0,0 +1,28 @@
{
"dungeondoorshuffle": {
"type": "selectbox",
"label": {
"text": "Dungeon Door Shuffle"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
},
"default": "Basic"
},
"options": {
"Vanilla": "vanilla",
"Basic": "basic",
"Crossed": "crossed"
}
},
"experimental": {
"type": "checkbox",
"label": {
"text": "Enable Experimental Features"
}
}
}