Streamline guiargs
This commit is contained in:
130
gui/bottom.py
130
gui/bottom.py
@@ -88,68 +88,94 @@ def bottom_frame(self, parent, args=None):
|
|||||||
|
|
||||||
def create_guiargs(parent):
|
def create_guiargs(parent):
|
||||||
guiargs = Namespace()
|
guiargs = Namespace()
|
||||||
guiargs.retro = bool(parent.pages["randomizer"].pages["item"].widgets["retro"].storageVar.get())
|
|
||||||
guiargs.mode = parent.pages["randomizer"].pages["item"].widgets["worldstate"].storageVar.get()
|
|
||||||
guiargs.logic = parent.pages["randomizer"].pages["item"].widgets["logiclevel"].storageVar.get()
|
|
||||||
guiargs.goal = parent.pages["randomizer"].pages["item"].widgets["goal"].storageVar.get()
|
|
||||||
guiargs.crystals_gt = parent.pages["randomizer"].pages["item"].widgets["crystals_gt"].storageVar.get()
|
|
||||||
guiargs.crystals_ganon = parent.pages["randomizer"].pages["item"].widgets["crystals_ganon"].storageVar.get()
|
|
||||||
guiargs.swords = parent.pages["randomizer"].pages["item"].widgets["weapons"].storageVar.get()
|
|
||||||
guiargs.difficulty = parent.pages["randomizer"].pages["item"].widgets["itempool"].storageVar.get()
|
|
||||||
guiargs.item_functionality = parent.pages["randomizer"].pages["item"].widgets["itemfunction"].storageVar.get()
|
|
||||||
guiargs.timer = parent.pages["randomizer"].pages["item"].widgets["timer"].storageVar.get()
|
|
||||||
guiargs.progressive = parent.pages["randomizer"].pages["item"].widgets["progressives"].storageVar.get()
|
|
||||||
guiargs.accessibility = parent.pages["randomizer"].pages["item"].widgets["accessibility"].storageVar.get()
|
|
||||||
guiargs.algorithm = parent.pages["randomizer"].pages["item"].widgets["sortingalgo"].storageVar.get()
|
|
||||||
|
|
||||||
guiargs.openpyramid = bool(parent.pages["randomizer"].pages["entrance"].widgets["openpyramid"].storageVar.get())
|
# set up settings to gather
|
||||||
guiargs.shuffleganon = bool(parent.pages["randomizer"].pages["entrance"].widgets["shuffleganon"].storageVar.get())
|
# Page::Subpage::GUI-id::param-id
|
||||||
guiargs.shuffle = parent.pages["randomizer"].pages["entrance"].widgets["entranceshuffle"].storageVar.get()
|
options = {
|
||||||
|
"randomizer": {
|
||||||
guiargs.shufflepots = bool(parent.pages["randomizer"].pages["enemizer"].widgets["potshuffle"].storageVar.get())
|
"item": {
|
||||||
guiargs.enemizercli = parent.pages["randomizer"].pages["enemizer"].enemizerCLIpathVar.get()
|
"retro": "retro",
|
||||||
guiargs.shuffleenemies = parent.pages["randomizer"].pages["enemizer"].widgets["enemyshuffle"].storageVar.get()
|
"worldstate": "mode",
|
||||||
guiargs.shufflebosses = parent.pages["randomizer"].pages["enemizer"].widgets["bossshuffle"].storageVar.get()
|
"logiclevel": "logic",
|
||||||
guiargs.enemy_damage = parent.pages["randomizer"].pages["enemizer"].widgets["enemydamage"].storageVar.get()
|
"goal": "goal",
|
||||||
guiargs.enemy_health = parent.pages["randomizer"].pages["enemizer"].widgets["enemyhealth"].storageVar.get()
|
"crystals_gt": "crystals_gt",
|
||||||
|
"crystals_ganon": "crystals_ganon",
|
||||||
guiargs.mapshuffle = bool(parent.pages["randomizer"].pages["dungeon"].widgets["mapshuffle"].storageVar.get())
|
"weapons": "swords",
|
||||||
guiargs.compassshuffle = bool(parent.pages["randomizer"].pages["dungeon"].widgets["compassshuffle"].storageVar.get())
|
"itempool": "difficulty",
|
||||||
guiargs.keyshuffle = bool(parent.pages["randomizer"].pages["dungeon"].widgets["smallkeyshuffle"].storageVar.get())
|
"itemfunction": "item_functionality",
|
||||||
guiargs.bigkeyshuffle = bool(parent.pages["randomizer"].pages["dungeon"].widgets["bigkeyshuffle"].storageVar.get())
|
"timer": "timer",
|
||||||
guiargs.door_shuffle = parent.pages["randomizer"].pages["dungeon"].widgets["dungeondoorshuffle"].storageVar.get()
|
"progressives": "progressive",
|
||||||
guiargs.experimental = parent.pages["randomizer"].pages["dungeon"].widgets["experimental"].storageVar.get()
|
"accessibility": "accessibility",
|
||||||
|
"sortingalgo": "algorithm"
|
||||||
|
},
|
||||||
|
"entrance": {
|
||||||
|
"openpyramid": "openpyramid",
|
||||||
|
"shuffleganon": "shuffleganon",
|
||||||
|
"entranceshuffle": "shuffle"
|
||||||
|
},
|
||||||
|
"enemizer": {
|
||||||
|
"potshuffle": "shufflepots",
|
||||||
|
"enemyshuffle": "shuffleenemies",
|
||||||
|
"bossshuffle": "shufflebosses",
|
||||||
|
"enemydamage": "enemy_damage",
|
||||||
|
"enemyhealth": "enemy_health"
|
||||||
|
},
|
||||||
|
"dungeon": {
|
||||||
|
"mapshuffle": "mapshuffle",
|
||||||
|
"compassshuffle": "compassshuffle",
|
||||||
|
"smallkeyshuffle": "keyshuffle",
|
||||||
|
"bigkeyshuffle": "bigkeyshuffle",
|
||||||
|
"dungeondoorshuffle": "door_shuffle",
|
||||||
|
"experimental": "experimental"
|
||||||
|
},
|
||||||
|
"multiworld": {
|
||||||
|
"names": "names"
|
||||||
|
},
|
||||||
|
"gameoptions": {
|
||||||
|
"hints": "hints",
|
||||||
|
"nobgm": "disablemusic",
|
||||||
|
"quickswap": "quickswap",
|
||||||
|
"heartcolor": "heartcolor",
|
||||||
|
"heartbeep": "heartbeep",
|
||||||
|
"menuspeed": "fastmenu",
|
||||||
|
"owpalettes": "ow_palettes",
|
||||||
|
"uwpalettes": "uw_palettes"
|
||||||
|
},
|
||||||
|
"generation": {
|
||||||
|
"spoiler": "create_spoiler",
|
||||||
|
"suppressrom": "suppress_rom"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for mainpage in options:
|
||||||
|
for subpage in options[mainpage]:
|
||||||
|
for widget in options[mainpage][subpage]:
|
||||||
|
arg = options[mainpage][subpage][widget]
|
||||||
|
setattr(guiargs, arg, parent.pages[mainpage].pages[subpage].widgets[widget].storageVar.get())
|
||||||
|
|
||||||
guiargs.multi = int(parent.pages["randomizer"].pages["multiworld"].widgets["worlds"].storageVar.get())
|
guiargs.multi = int(parent.pages["randomizer"].pages["multiworld"].widgets["worlds"].storageVar.get())
|
||||||
guiargs.names = parent.pages["randomizer"].pages["multiworld"].namesVar.get()
|
|
||||||
|
|
||||||
guiargs.hints = bool(parent.pages["randomizer"].pages["gameoptions"].widgets["hints"].storageVar.get())
|
|
||||||
guiargs.disablemusic = bool(parent.pages["randomizer"].pages["gameoptions"].widgets["nobgm"].storageVar.get())
|
|
||||||
guiargs.quickswap = bool(parent.pages["randomizer"].pages["gameoptions"].widgets["quickswap"].storageVar.get())
|
|
||||||
guiargs.heartcolor = parent.pages["randomizer"].pages["gameoptions"].widgets["heartcolor"].storageVar.get()
|
|
||||||
guiargs.heartbeep = parent.pages["randomizer"].pages["gameoptions"].widgets["heartbeep"].storageVar.get()
|
|
||||||
guiargs.fastmenu = parent.pages["randomizer"].pages["gameoptions"].widgets["menuspeed"].storageVar.get()
|
|
||||||
guiargs.ow_palettes = parent.pages["randomizer"].pages["gameoptions"].widgets["owpalettes"].storageVar.get()
|
|
||||||
guiargs.uw_palettes = parent.pages["randomizer"].pages["gameoptions"].widgets["uwpalettes"].storageVar.get()
|
|
||||||
|
|
||||||
guiargs.create_spoiler = bool(parent.pages["randomizer"].pages["generation"].widgets["spoiler"].storageVar.get())
|
|
||||||
guiargs.skip_playthrough = not bool(parent.pages["randomizer"].pages["generation"].widgets["spoiler"].storageVar.get())
|
|
||||||
guiargs.suppress_rom = bool(parent.pages["randomizer"].pages["generation"].widgets["suppressrom"].storageVar.get())
|
|
||||||
guiargs.rom = parent.pages["randomizer"].pages["generation"].romVar.get()
|
guiargs.rom = parent.pages["randomizer"].pages["generation"].romVar.get()
|
||||||
guiargs.custom = bool(parent.pages["randomizer"].pages["generation"].widgets["usecustompool"].storageVar.get())
|
guiargs.custom = bool(parent.pages["randomizer"].pages["generation"].widgets["usecustompool"].storageVar.get())
|
||||||
|
|
||||||
guiargs.seed = int(parent.frames["bottom"].seedVar.get()) if parent.frames["bottom"].seedVar.get() else None
|
guiargs.seed = int(parent.frames["bottom"].seedVar.get()) if parent.frames["bottom"].seedVar.get() else None
|
||||||
guiargs.count = int(parent.frames["bottom"].widgets["generationcount"].storageVar.get()) if parent.frames["bottom"].widgets["generationcount"].storageVar.get() != '1' else None
|
guiargs.count = int(parent.frames["bottom"].widgets["generationcount"].storageVar.get()) if parent.frames["bottom"].widgets["generationcount"].storageVar.get() != '1' else None
|
||||||
|
|
||||||
guiargs.customitemarray = [int(parent.pages["custom"].content.customWidgets["bow"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["silversupgrade"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["boomerang"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["redmerang"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["hookshot"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["mushroom"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["powder"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["firerod"].storageVar.get()),
|
customitems = [
|
||||||
int(parent.pages["custom"].content.customWidgets["icerod"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["bombos"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["ether"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["quake"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["lamp"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["hammer"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["shovel"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["flute"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["bugnet"].storageVar.get()),
|
"bow", "silversupgrade", "boomerang", "redmerang", "hookshot", "mushroom", "powder", "firerod",
|
||||||
int(parent.pages["custom"].content.customWidgets["book"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["bottle"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["somaria"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["byrna"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["cape"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["mirror"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["boots"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["powerglove"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["titansmitt"].storageVar.get()),
|
"icerod", "bombos", "ether", "quake", "lamp", "hammer", "shovel", "flute", "bugnet",
|
||||||
int(parent.pages["custom"].content.customWidgets["progressiveglove"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["flippers"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["pearl"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["heartpiece"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["heartcontainer"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["sancheart"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["sword1"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["sword2"].storageVar.get()),
|
"book", "bottle", "somaria", "byrna", "cape", "mirror", "boots", "powerglove", "titansmitt",
|
||||||
int(parent.pages["custom"].content.customWidgets["sword3"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["sword4"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["progressivesword"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["shield1"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["shield2"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["shield3"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["progressiveshield"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["mail2"].storageVar.get()),
|
"progressiveglove", "flippers", "pearl", "heartpiece", "heartcontainer", "sancheart", "sword1", "sword2",
|
||||||
int(parent.pages["custom"].content.customWidgets["mail3"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["progressivemail"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["halfmagic"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["quartermagic"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["bombsplus5"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["bombsplus10"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["arrowsplus5"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["arrowsplus10"].storageVar.get()),
|
"sword3", "sword4", "progressivesword", "shield1", "shield2", "shield3", "progressiveshield", "mail2",
|
||||||
int(parent.pages["custom"].content.customWidgets["arrow1"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["arrow10"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["bomb1"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["bomb3"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["rupee1"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["rupee5"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["rupee20"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["rupee50"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["rupee100"].storageVar.get()),
|
"mail3", "progressivemail", "halfmagic", "quartermagic", "bombsplus5", "bombsplus10", "arrowsplus5", "arrowsplus10",
|
||||||
int(parent.pages["custom"].content.customWidgets["rupee300"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["rupoor"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["blueclock"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["greenclock"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["redclock"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["progressivebow"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["bomb10"].storageVar.get()), int(parent.pages["custom"].content.customWidgets["triforcepieces"].storageVar.get()),int(parent.pages["custom"].content.customWidgets["triforcepiecesgoal"].storageVar.get()),
|
"arrow1", "arrow10", "bomb1", "bomb3", "rupee1", "rupee5", "rupee20", "rupee50", "rupee100",
|
||||||
int(parent.pages["custom"].content.customWidgets["triforce"].storageVar.get()),int(parent.pages["custom"].content.customWidgets["rupoorcost"].storageVar.get()),int(parent.pages["custom"].content.customWidgets["generickeys"].storageVar.get())]
|
"rupee300", "rupoor", "blueclock", "greenclock", "redclock", "progressivebow", "bomb10", "triforcepieces", "triforcepiecesgoal",
|
||||||
|
"triforce", "rupoorcost", "generickeys"
|
||||||
|
]
|
||||||
|
guiargs.customitemarray = []
|
||||||
|
for customitem in customitems:
|
||||||
|
guiargs.customitemarray.append(int(parent.pages["custom"].content.customWidgets[customitem].storageVar.get()))
|
||||||
|
|
||||||
guiargs.sprite = parent.pages["randomizer"].pages["gameoptions"].widgets["sprite"]["spriteObject"]
|
guiargs.sprite = parent.pages["randomizer"].pages["gameoptions"].widgets["sprite"]["spriteObject"]
|
||||||
guiargs.randomSprite = parent.randomSprite.get()
|
guiargs.randomSprite = parent.randomSprite.get()
|
||||||
guiargs.outputpath = parent.outputPath.get()
|
guiargs.outputpath = parent.outputPath.get()
|
||||||
|
|||||||
@@ -13,57 +13,57 @@ def loadcliargs(gui, args, settings=None):
|
|||||||
# set up options to get
|
# set up options to get
|
||||||
# Page::Subpage::GUI-id::param-id
|
# Page::Subpage::GUI-id::param-id
|
||||||
options = {
|
options = {
|
||||||
"randomizer": {
|
"randomizer": {
|
||||||
"item": {
|
"item": {
|
||||||
"retro": "retro",
|
"retro": "retro",
|
||||||
"worldstate": "mode",
|
"worldstate": "mode",
|
||||||
"logiclevel": "logic",
|
"logiclevel": "logic",
|
||||||
"goal": "goal",
|
"goal": "goal",
|
||||||
"crystals_gt": "crystals_gt",
|
"crystals_gt": "crystals_gt",
|
||||||
"crystals_ganon": "crystals_ganon",
|
"crystals_ganon": "crystals_ganon",
|
||||||
"weapons": "swords",
|
"weapons": "swords",
|
||||||
"itempool": "difficulty",
|
"itempool": "difficulty",
|
||||||
"itemfunction": "item_functionality",
|
"itemfunction": "item_functionality",
|
||||||
"timer": "timer",
|
"timer": "timer",
|
||||||
"progressives": "progressive",
|
"progressives": "progressive",
|
||||||
"accessibility": "accessibility",
|
"accessibility": "accessibility",
|
||||||
"sortingalgo": "algorithm"
|
"sortingalgo": "algorithm"
|
||||||
},
|
},
|
||||||
"entrance": {
|
"entrance": {
|
||||||
"openpyramid": "openpyramid",
|
"openpyramid": "openpyramid",
|
||||||
"shuffleganon": "shuffleganon",
|
"shuffleganon": "shuffleganon",
|
||||||
"entranceshuffle": "shuffle"
|
"entranceshuffle": "shuffle"
|
||||||
},
|
},
|
||||||
"enemizer": {
|
"enemizer": {
|
||||||
"potshuffle": "shufflepots",
|
"potshuffle": "shufflepots",
|
||||||
"enemyshuffle": "shuffleenemies",
|
"enemyshuffle": "shuffleenemies",
|
||||||
"bossshuffle": "shufflebosses",
|
"bossshuffle": "shufflebosses",
|
||||||
"enemydamage": "enemy_damage",
|
"enemydamage": "enemy_damage",
|
||||||
"enemyhealth": "enemy_health"
|
"enemyhealth": "enemy_health"
|
||||||
},
|
},
|
||||||
"dungeon": {
|
"dungeon": {
|
||||||
"mapshuffle": "mapshuffle",
|
"mapshuffle": "mapshuffle",
|
||||||
"compassshuffle": "compassshuffle",
|
"compassshuffle": "compassshuffle",
|
||||||
"smallkeyshuffle": "keyshuffle",
|
"smallkeyshuffle": "keyshuffle",
|
||||||
"bigkeyshuffle": "bigkeyshuffle",
|
"bigkeyshuffle": "bigkeyshuffle",
|
||||||
"dungeondoorshuffle": "door_shuffle",
|
"dungeondoorshuffle": "door_shuffle",
|
||||||
"experimental": "experimental"
|
"experimental": "experimental"
|
||||||
},
|
},
|
||||||
"gameoptions": {
|
"gameoptions": {
|
||||||
"hints": "hints",
|
"hints": "hints",
|
||||||
"nobgm": "disablemusic",
|
"nobgm": "disablemusic",
|
||||||
"quickswap": "quickswap",
|
"quickswap": "quickswap",
|
||||||
"heartcolor": "heartcolor",
|
"heartcolor": "heartcolor",
|
||||||
"heartbeep": "heartbeep",
|
"heartbeep": "heartbeep",
|
||||||
"menuspeed": "fastmenu",
|
"menuspeed": "fastmenu",
|
||||||
"owpalettes": "ow_palettes",
|
"owpalettes": "ow_palettes",
|
||||||
"uwpalettes": "uw_palettes"
|
"uwpalettes": "uw_palettes"
|
||||||
},
|
},
|
||||||
"generation": {
|
"generation": {
|
||||||
"spoiler": "create_spoiler",
|
"spoiler": "create_spoiler",
|
||||||
"suppressrom": "suppress_rom"
|
"suppressrom": "suppress_rom"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for mainpage in options:
|
for mainpage in options:
|
||||||
for subpage in options[mainpage]:
|
for subpage in options[mainpage]:
|
||||||
|
|||||||
@@ -21,15 +21,16 @@ def multiworld_page(parent,settings):
|
|||||||
self.widgets[key].pack(side=LEFT, anchor=N)
|
self.widgets[key].pack(side=LEFT, anchor=N)
|
||||||
|
|
||||||
## List of Player Names
|
## List of Player Names
|
||||||
namesFrame = Frame(self)
|
key = "names"
|
||||||
namesLabel = Label(namesFrame, text='Player names')
|
self.widgets[key] = Frame(self)
|
||||||
self.namesVar = StringVar(value=settings["names"])
|
self.widgets[key].label = Label(self.widgets[key], text='Player names')
|
||||||
|
self.widgets[key].storageVar = StringVar(value=settings["names"])
|
||||||
def saveMultiNames(caller,_,mode):
|
def saveMultiNames(caller,_,mode):
|
||||||
settings["names"] = self.namesVar.get()
|
settings["names"] = self.widgets[key].storageVar.get()
|
||||||
self.namesVar.trace_add("write",saveMultiNames)
|
self.widgets[key].storageVar.trace_add("write",saveMultiNames)
|
||||||
namesEntry = Entry(namesFrame, textvariable=self.namesVar)
|
self.widgets[key].textbox = Entry(self.widgets[key], textvariable=self.widgets[key].storageVar)
|
||||||
namesLabel.pack(side=LEFT)
|
self.widgets[key].label.pack(side=LEFT)
|
||||||
namesEntry.pack(side=LEFT, fill=X, expand=True)
|
self.widgets[key].textbox.pack(side=LEFT, fill=X, expand=True)
|
||||||
namesFrame.pack(anchor=N, fill=X, expand=True)
|
self.widgets[key].pack(anchor=N, fill=X, expand=True)
|
||||||
|
|
||||||
return self,settings
|
return self,settings
|
||||||
|
|||||||
@@ -14,10 +14,11 @@ class mySpinbox(Spinbox):
|
|||||||
self.invoke('buttonup')
|
self.invoke('buttonup')
|
||||||
|
|
||||||
def make_checkbox(self, parent, label, storageVar, packAttrs):
|
def make_checkbox(self, parent, label, storageVar, packAttrs):
|
||||||
self = Frame(parent)
|
self = Frame(parent, name="checkframe-" + label.lower())
|
||||||
self.storageVar = storageVar
|
self.storageVar = storageVar
|
||||||
self.checkbox = Checkbutton(self, text=label, variable=self.storageVar)
|
self.checkbox = Checkbutton(self, text=label, variable=self.storageVar, name="checkbox-" + label.lower())
|
||||||
self.checkbox.pack(packAttrs)
|
if packAttrs is not None:
|
||||||
|
self.checkbox.pack(packAttrs)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def make_selectbox(self, parent, label, options, storageVar, packAttrs):
|
def make_selectbox(self, parent, label, options, storageVar, packAttrs):
|
||||||
@@ -29,24 +30,27 @@ def make_selectbox(self, parent, label, options, storageVar, packAttrs):
|
|||||||
keysList = list(keys)
|
keysList = list(keys)
|
||||||
valsList = list(vals)
|
valsList = list(vals)
|
||||||
self.labelVar.set(keysList[valsList.index(str(self.storageVar.get()))])
|
self.labelVar.set(keysList[valsList.index(str(self.storageVar.get()))])
|
||||||
self = Frame(parent)
|
self = Frame(parent, name="selectframe-" + label.lower())
|
||||||
self.storageVar = storageVar
|
self.storageVar = storageVar
|
||||||
self.storageVar.trace_add("write",change_selected)
|
self.storageVar.trace_add("write",change_selected)
|
||||||
self.labelVar = StringVar()
|
self.labelVar = StringVar()
|
||||||
self.labelVar.trace_add("write",change_storage)
|
self.labelVar.trace_add("write",change_storage)
|
||||||
self.label = Label(self, text=label)
|
self.label = Label(self, text=label)
|
||||||
self.label.pack(packAttrs["label"])
|
if packAttrs is not None and "label" in packAttrs:
|
||||||
|
self.label.pack(packAttrs["label"])
|
||||||
self.selectbox = OptionMenu(self, self.labelVar, *options.keys())
|
self.selectbox = OptionMenu(self, self.labelVar, *options.keys())
|
||||||
self.selectbox.config(width=20)
|
self.selectbox.config(width=20)
|
||||||
self.labelVar.set(packAttrs["default"] if "default" in packAttrs else list(options.keys())[0])
|
self.labelVar.set(packAttrs["default"] if "default" in packAttrs else list(options.keys())[0])
|
||||||
self.selectbox.pack(packAttrs["selectbox"])
|
if packAttrs is not None and "selectbox" in packAttrs:
|
||||||
|
self.selectbox.pack(packAttrs["selectbox"])
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def make_spinbox(self, parent, label, storageVar, packAttrs):
|
def make_spinbox(self, parent, label, storageVar, packAttrs):
|
||||||
self = Frame(parent)
|
self = Frame(parent, name="spinframe-" + label.lower())
|
||||||
self.storageVar = storageVar
|
self.storageVar = storageVar
|
||||||
self.label = Label(self, text=label)
|
self.label = Label(self, text=label)
|
||||||
self.label.pack(packAttrs["label"])
|
if packAttrs is not None and "label" in packAttrs:
|
||||||
|
self.label.pack(packAttrs["label"])
|
||||||
fromNum = 1
|
fromNum = 1
|
||||||
toNum = 100
|
toNum = 100
|
||||||
if "spinbox" in packAttrs:
|
if "spinbox" in packAttrs:
|
||||||
@@ -54,19 +58,22 @@ def make_spinbox(self, parent, label, storageVar, packAttrs):
|
|||||||
fromNum = packAttrs["spinbox"]["from"]
|
fromNum = packAttrs["spinbox"]["from"]
|
||||||
if "to" in packAttrs:
|
if "to" in packAttrs:
|
||||||
toNum = packAttrs["spinbox"]["to"]
|
toNum = packAttrs["spinbox"]["to"]
|
||||||
self.spinbox = mySpinbox(self, from_=fromNum, to=toNum, width=5, textvariable=self.storageVar)
|
self.spinbox = mySpinbox(self, from_=fromNum, to=toNum, width=5, textvariable=self.storageVar, name="spinbox-" + label.lower())
|
||||||
self.spinbox.pack(packAttrs["spinbox"])
|
if packAttrs is not None and "spinbox" in packAttrs:
|
||||||
|
self.spinbox.pack(packAttrs["spinbox"])
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def make_textbox(self, parent, label, storageVar, packAttrs):
|
def make_textbox(self, parent, label, storageVar, packAttrs):
|
||||||
self = Frame(parent)
|
self = Frame(parent)
|
||||||
self.storageVar = storageVar
|
self.storageVar = storageVar
|
||||||
self.label = Label(self, text=label)
|
self.label = Label(self, text=label)
|
||||||
self.label.pack(packAttrs["label"])
|
if packAttrs is not None and "label" in packAttrs:
|
||||||
|
self.label.pack(packAttrs["label"])
|
||||||
self.textbox = Entry(self, justify=RIGHT, textvariable=self.storageVar, width=3)
|
self.textbox = Entry(self, justify=RIGHT, textvariable=self.storageVar, width=3)
|
||||||
if "default" in packAttrs:
|
if "default" in packAttrs:
|
||||||
self.storageVar.set(packAttrs["default"])
|
self.storageVar.set(packAttrs["default"])
|
||||||
self.textbox.pack(packAttrs["textbox"])
|
if packAttrs is not None and "textbox" in packAttrs:
|
||||||
|
self.textbox.pack(packAttrs["textbox"])
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user