JSONify Multiworld options

This commit is contained in:
Mike A. Trethewey
2020-02-19 01:29:48 -08:00
parent 2a1e9726b1
commit c848792c69
2 changed files with 24 additions and 17 deletions

View File

@@ -1,5 +1,7 @@
from tkinter import ttk, StringVar, Entry, Frame, Label, Spinbox, N, E, W, X, LEFT, RIGHT from tkinter import ttk, StringVar, Entry, Frame, Label, Spinbox, N, E, W, X, LEFT, RIGHT
import gui.widgets as widgets import gui.widgets as widgets
import json
import os
def multiworld_page(parent,settings): def multiworld_page(parent,settings):
# Multiworld # Multiworld
@@ -8,23 +10,12 @@ def multiworld_page(parent,settings):
# Multiworld options # Multiworld options
self.widgets = {} self.widgets = {}
myDict = { with open(os.path.join("resources","app","gui","randomize","multiworld","widgets.json")) as multiworldItems:
## Number of worlds myDict = json.load(multiworldItems)
"worlds": { dictWidgets = widgets.make_widgets_from_dict(self, myDict, self)
"type": "spinbox", for key in dictWidgets:
"label": { self.widgets[key] = dictWidgets[key]
"text": "Worlds" self.widgets[key].pack(side=LEFT, anchor=N)
},
"packAttrs": {
"label": { "side": LEFT },
"spinbox": { "side": RIGHT }
}
}
}
dictWidgets = widgets.make_widgets_from_dict(self, myDict, self)
for key in dictWidgets:
self.widgets[key] = dictWidgets[key]
self.widgets[key].pack(side=LEFT, anchor=N)
## List of Player Names ## List of Player Names
key = "names" key = "names"

View File

@@ -0,0 +1,16 @@
{
"worlds": {
"type": "spinbox",
"label": {
"text": "Worlds"
},
"packAttrs": {
"label": {
"side": "left"
},
"spinbox": {
"side": "right"
}
}
}
}