-Sprite selection fix
-Scrollbar added -Experimental checkbox added -Settings file created -Random sprite work for settings file
This commit is contained in:
64
Gui.py
64
Gui.py
@@ -1,17 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
from argparse import Namespace
|
||||
from glob import glob
|
||||
import json
|
||||
import logging
|
||||
import random
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from tkinter import Checkbutton, OptionMenu, Toplevel, LabelFrame, PhotoImage, Tk, LEFT, RIGHT, BOTTOM, TOP, StringVar, IntVar, Frame, Label, W, E, X, BOTH, Entry, Spinbox, Button, filedialog, messagebox, ttk
|
||||
from urllib.parse import urlparse
|
||||
from urllib.request import urlopen
|
||||
from tkinter import Tk, BOTTOM, TOP, StringVar, BooleanVar, X, BOTH, ttk
|
||||
|
||||
from AdjusterMain import adjust
|
||||
from argparse import Namespace
|
||||
from CLI import get_working_dirs
|
||||
from DungeonRandomizer import parse_arguments
|
||||
from gui.adjust.overview import adjust_page
|
||||
@@ -24,11 +17,10 @@ from gui.randomize.dungeon import dungeon_page
|
||||
from gui.randomize.multiworld import multiworld_page
|
||||
from gui.randomize.gameoptions import gameoptions_page
|
||||
from gui.randomize.generation import generation_page
|
||||
from gui.bottom import bottom_frame
|
||||
from GuiUtils import ToolTips, set_icon, BackgroundTaskProgress
|
||||
from Main import main, __version__ as ESVersion
|
||||
from Rom import Sprite
|
||||
from Utils import is_bundled, local_path, output_path, open_file
|
||||
from gui.bottom import bottom_frame, create_guiargs
|
||||
from GuiUtils import set_icon
|
||||
from Main import __version__ as ESVersion
|
||||
from Rom import get_sprite_from_name
|
||||
|
||||
|
||||
def guiMain(args=None):
|
||||
@@ -38,13 +30,27 @@ def guiMain(args=None):
|
||||
working_dirs_path = os.path.join(user_resources_path)
|
||||
if not os.path.exists(working_dirs_path):
|
||||
os.makedirs(working_dirs_path)
|
||||
with open(os.path.join(working_dirs_path,"working_dirs.json"),"w+") as f:
|
||||
f.write(json.dumps(self.working_dirs,indent=2))
|
||||
os.chmod(os.path.join(working_dirs_path,"working_dirs.json"),0o755)
|
||||
with open(os.path.join(working_dirs_path, "working_dirs.json"),"w+") as f:
|
||||
f.write(json.dumps(self.working_dirs, indent=2))
|
||||
os.chmod(os.path.join(working_dirs_path, "working_dirs.json"),0o755)
|
||||
|
||||
def save_settings(args):
|
||||
user_resources_path = os.path.join(".", "resources", "user")
|
||||
settings_path = os.path.join(user_resources_path)
|
||||
if not os.path.exists(settings_path):
|
||||
os.makedirs(settings_path)
|
||||
with open(os.path.join(settings_path, "settings.json"), "w+") as f:
|
||||
f.write(json.dumps(args, indent=2))
|
||||
|
||||
# routine for exiting the app
|
||||
def guiExit():
|
||||
save_working_dirs()
|
||||
gui_args = vars(create_guiargs(self))
|
||||
if self.randomSprite.get():
|
||||
gui_args['sprite'] = 'random'
|
||||
elif gui_args['sprite']:
|
||||
gui_args['sprite'] = gui_args['sprite'].name
|
||||
save_settings(gui_args)
|
||||
sys.exit(0)
|
||||
|
||||
# make main window
|
||||
@@ -52,7 +58,7 @@ def guiMain(args=None):
|
||||
mainWindow = Tk()
|
||||
self = mainWindow
|
||||
mainWindow.wm_title("Door Shuffle %s" % ESVersion)
|
||||
mainWindow.protocol("WM_DELETE_WINDOW",guiExit) # intercept when user clicks the X
|
||||
mainWindow.protocol("WM_DELETE_WINDOW", guiExit) # intercept when user clicks the X
|
||||
|
||||
# set program icon
|
||||
set_icon(mainWindow)
|
||||
@@ -103,7 +109,7 @@ def guiMain(args=None):
|
||||
self.randomizerNotebook.add(self.multiworldWindow, text="Multiworld")
|
||||
|
||||
# Game Options
|
||||
self.gameOptionsWindow = gameoptions_page(self.randomizerNotebook)
|
||||
self.gameOptionsWindow = gameoptions_page(self, self.randomizerNotebook)
|
||||
self.randomizerNotebook.add(self.gameOptionsWindow, text="Game Options")
|
||||
|
||||
# Generation Setup
|
||||
@@ -114,12 +120,15 @@ def guiMain(args=None):
|
||||
self.randomizerNotebook.pack()
|
||||
|
||||
# bottom of window: Open Output Directory, Open Documentation (if exists)
|
||||
self.farBottomFrame = bottom_frame(self,self,None)
|
||||
self.farBottomFrame = bottom_frame(self, self, None)
|
||||
# set bottom frame to main window
|
||||
self.farBottomFrame.pack(side=BOTTOM, fill=X, padx=5, pady=5)
|
||||
|
||||
self.outputPath = StringVar()
|
||||
self.randomSprite = BooleanVar()
|
||||
|
||||
# Adjuster Controls
|
||||
self.adjustContent,self.working_dirs = adjust_page(self,self.adjustWindow,self.working_dirs)
|
||||
self.adjustContent,self.working_dirs = adjust_page(self, self.adjustWindow, self.working_dirs)
|
||||
self.adjustContent.pack(side=TOP, fill=BOTH, expand=True)
|
||||
|
||||
# Custom Controls
|
||||
@@ -134,10 +143,21 @@ def guiMain(args=None):
|
||||
vcmd=(self.customContent.register(validation), '%P')
|
||||
|
||||
# load args from CLI into options
|
||||
loadcliargs(self,args)
|
||||
loadcliargs(self, args)
|
||||
|
||||
# load settings second
|
||||
settings_path = os.path.join(".", "resources", "user", "settings.json")
|
||||
if os.path.exists(settings_path):
|
||||
with(open(settings_path)) as json_file:
|
||||
data = json.load(json_file)
|
||||
if 'sprite' in data.keys() and data['sprite']:
|
||||
data['sprite'] = get_sprite_from_name(data['sprite'])
|
||||
settings_args = Namespace(**data)
|
||||
loadcliargs(self, settings_args)
|
||||
|
||||
mainWindow.mainloop()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = parse_arguments(None)
|
||||
guiMain(args)
|
||||
|
||||
@@ -10,13 +10,14 @@ from GuiUtils import ToolTips, set_icon, BackgroundTaskProgress
|
||||
from Rom import Sprite
|
||||
from Utils import is_bundled, local_path, output_path, open_file
|
||||
|
||||
|
||||
class SpriteSelector(object):
|
||||
def __init__(self, parent, callback, adjuster=False):
|
||||
if is_bundled():
|
||||
self.deploy_icons()
|
||||
self.parent = parent
|
||||
self.window = Toplevel(parent)
|
||||
self.window.geometry("900x768")
|
||||
self.window.geometry("800x650")
|
||||
self.sections = []
|
||||
self.callback = callback
|
||||
self.adjuster = adjuster
|
||||
@@ -64,27 +65,21 @@ class SpriteSelector(object):
|
||||
self.window.focus()
|
||||
|
||||
def icon_section(self, frame_label, path, no_results_label):
|
||||
self.frame = LabelFrame(self.window, labelwidget=frame_label, padx=5, pady=5)
|
||||
# self.canvas = Canvas(self.frame)
|
||||
frame = LabelFrame(self.window, labelwidget=frame_label, padx=5, pady=5)
|
||||
canvas = Canvas(frame, borderwidth=0)
|
||||
y_scrollbar = Scrollbar(frame, orient="vertical", command=canvas.yview)
|
||||
y_scrollbar.pack(side="right", fill="y")
|
||||
content_frame = Frame(canvas)
|
||||
canvas.pack(side="left", fill="both", expand=True)
|
||||
canvas.create_window((4, 4), window=content_frame, anchor="nw")
|
||||
canvas.configure(yscrollcommand=y_scrollbar.set)
|
||||
|
||||
"""
|
||||
self.frame.grid_rowconfigure(0, weight=1)
|
||||
self.frame.grid_columnconfigure(0, weight=1)
|
||||
def onFrameConfigure(canvas):
|
||||
"""Reset the scroll region to encompass the inner frame"""
|
||||
canvas.configure(scrollregion=canvas.bbox("all"))
|
||||
|
||||
xscrollbar = Scrollbar(self.frame, orient=HORIZONTAL)
|
||||
xscrollbar.grid(row=1, column=0, sticky=EW)
|
||||
|
||||
yscrollbar = Scrollbar(self.frame)
|
||||
yscrollbar.grid(row=0, column=1, sticky=NS)
|
||||
|
||||
self.canvas.configure(scrollregion=self.canvas.bbox(ALL),xscrollcommand=xscrollbar.set, yscrollcommand=yscrollbar.set)
|
||||
self.canvas.grid(row=0, column=0, sticky=NSEW)
|
||||
|
||||
xscrollbar.config(command=self.canvas.xview)
|
||||
yscrollbar.config(command=self.canvas.yview)
|
||||
"""
|
||||
|
||||
self.frame.pack(side=TOP, fill=X)
|
||||
content_frame.bind("<Configure>", lambda event, canvas=canvas: onFrameConfigure(canvas))
|
||||
frame.pack(side=TOP, fill=X)
|
||||
|
||||
sprites = []
|
||||
|
||||
@@ -99,17 +94,16 @@ class SpriteSelector(object):
|
||||
if image is None:
|
||||
continue
|
||||
self.all_sprites.append(sprite)
|
||||
button = Button(self.frame, image=image, command=lambda spr=sprite: self.select_sprite(spr))
|
||||
button = Button(content_frame, image=image, command=lambda spr=sprite: self.select_sprite(spr))
|
||||
ToolTips.register(button, sprite.name + ("\nBy: %s" % sprite.author_name if sprite.author_name else ""))
|
||||
button.image = image
|
||||
button.grid(row=i // 16, column=i % 16)
|
||||
i += 1
|
||||
|
||||
if i == 0:
|
||||
label = Label(self.frame, text=no_results_label)
|
||||
label = Label(content_frame, text=no_results_label)
|
||||
label.pack()
|
||||
|
||||
|
||||
def update_official_sprites(self):
|
||||
# need to wrap in try catch. We don't want errors getting the json or downloading the files to break us.
|
||||
self.window.destroy()
|
||||
@@ -181,7 +175,6 @@ class SpriteSelector(object):
|
||||
|
||||
BackgroundTaskProgress(self.parent, work, "Updating Sprites")
|
||||
|
||||
|
||||
def browse_for_sprite(self):
|
||||
sprite = filedialog.askopenfilename(
|
||||
filetypes=[("All Sprite Sources", (".zspr", ".spr", ".sfc", ".smc")),
|
||||
@@ -195,24 +188,22 @@ class SpriteSelector(object):
|
||||
self.callback(None)
|
||||
self.window.destroy()
|
||||
|
||||
|
||||
def use_default_sprite(self):
|
||||
self.callback(None)
|
||||
self.callback(None, False)
|
||||
self.window.destroy()
|
||||
|
||||
def use_default_link_sprite(self):
|
||||
self.callback(Sprite.default_link_sprite())
|
||||
self.callback(Sprite.default_link_sprite(), False)
|
||||
self.window.destroy()
|
||||
|
||||
def use_random_sprite(self):
|
||||
self.callback(random.choice(self.all_sprites) if self.all_sprites else None)
|
||||
self.callback(random.choice(self.all_sprites) if self.all_sprites else None, True)
|
||||
self.window.destroy()
|
||||
|
||||
def select_sprite(self, spritename):
|
||||
self.callback(spritename)
|
||||
self.callback(spritename, False)
|
||||
self.window.destroy()
|
||||
|
||||
|
||||
def deploy_icons(self):
|
||||
if not os.path.exists(self.unofficial_sprite_dir):
|
||||
os.makedirs(self.unofficial_sprite_dir)
|
||||
|
||||
@@ -5,32 +5,33 @@ from classes.SpriteSelector import SpriteSelector
|
||||
import gui.widgets as widgets
|
||||
import logging
|
||||
|
||||
def adjust_page(top,parent,working_dirs):
|
||||
|
||||
def adjust_page(top, parent, working_dirs):
|
||||
# Adjust page
|
||||
self = ttk.Frame(parent)
|
||||
|
||||
# Adjust options
|
||||
self.adjustWidgets = {}
|
||||
|
||||
## Disable BGM
|
||||
# Disable BGM
|
||||
key = "nobgm"
|
||||
self.adjustWidgets[key] = widgets.make_widget(
|
||||
self,
|
||||
"checkbox",
|
||||
self,
|
||||
"Disable Music & MSU-1",
|
||||
None
|
||||
top.gameOptionsWindow.gameOptionsWidgets["nobgm"].storageVar
|
||||
)
|
||||
self.adjustWidgets[key].pack(anchor=W)
|
||||
|
||||
## L/R Quickswap
|
||||
# L/R Quickswap
|
||||
key = "quickswap"
|
||||
self.adjustWidgets[key] = widgets.make_widget(
|
||||
self,
|
||||
"checkbox",
|
||||
self,
|
||||
"L/R Quickswapping",
|
||||
None
|
||||
top.gameOptionsWindow.gameOptionsWidgets["quickswap"].storageVar
|
||||
)
|
||||
self.adjustWidgets[key].pack(anchor=W)
|
||||
|
||||
@@ -50,7 +51,7 @@ def adjust_page(top,parent,working_dirs):
|
||||
"selectbox",
|
||||
leftAdjustFrame,
|
||||
"Heart Color",
|
||||
None,
|
||||
top.gameOptionsWindow.gameOptionsWidgets["heartcolor"].storageVar,
|
||||
{"label": {"side": LEFT}, "selectbox": {"side": RIGHT}},
|
||||
{
|
||||
"Red": "red",
|
||||
@@ -69,7 +70,7 @@ def adjust_page(top,parent,working_dirs):
|
||||
"selectbox",
|
||||
leftAdjustFrame,
|
||||
"Heart Beep sound rate",
|
||||
None,
|
||||
top.gameOptionsWindow.gameOptionsWidgets["heartbeep"].storageVar,
|
||||
{"label": {"side": LEFT}, "selectbox": {"side": RIGHT}, "default": "Normal"},
|
||||
{
|
||||
"Double": "double",
|
||||
@@ -85,16 +86,17 @@ def adjust_page(top,parent,working_dirs):
|
||||
self.spriteNameVar2 = StringVar()
|
||||
spriteDialogFrame2 = Frame(leftAdjustFrame)
|
||||
baseSpriteLabel2 = Label(spriteDialogFrame2, text='Sprite:')
|
||||
self.spriteNameVar2.set('(unchanged)')
|
||||
spriteEntry2 = Label(spriteDialogFrame2, textvariable=self.spriteNameVar2)
|
||||
self.sprite = None
|
||||
|
||||
def set_sprite(sprite_param):
|
||||
def set_sprite(sprite_param, random_sprite):
|
||||
if sprite_param is None or not sprite_param.valid:
|
||||
sprite = None
|
||||
self.sprite = None
|
||||
self.spriteNameVar2.set('(unchanged)')
|
||||
else:
|
||||
sprite = sprite_param
|
||||
self.spriteNameVar2.set(sprite.name)
|
||||
self.sprite = sprite_param
|
||||
self.spriteNameVar2.set(self.sprite.name)
|
||||
top.randomSprite.set(random_sprite)
|
||||
|
||||
def SpriteSelectAdjuster():
|
||||
SpriteSelector(parent, set_sprite, adjuster=True)
|
||||
@@ -106,14 +108,14 @@ def adjust_page(top,parent,working_dirs):
|
||||
spriteSelectButton2.pack(side=LEFT)
|
||||
spriteDialogFrame2.pack(anchor=E)
|
||||
|
||||
## Menu Speed
|
||||
# Menu Speed
|
||||
key = "menuspeed"
|
||||
self.adjustWidgets[key] = widgets.make_widget(
|
||||
self,
|
||||
"selectbox",
|
||||
rightAdjustFrame,
|
||||
"Menu Speed",
|
||||
None,
|
||||
top.gameOptionsWindow.gameOptionsWidgets["menuspeed"].storageVar,
|
||||
{"label": {"side": LEFT}, "selectbox": {"side": RIGHT}, "default": "Normal"},
|
||||
{
|
||||
"Instant": "instant",
|
||||
@@ -126,14 +128,14 @@ def adjust_page(top,parent,working_dirs):
|
||||
)
|
||||
self.adjustWidgets[key].pack(anchor=E)
|
||||
|
||||
## Overworld Palettes (not Enemizer)
|
||||
# Overworld Palettes (not Enemizer)
|
||||
key = "owpalettes"
|
||||
self.adjustWidgets[key] = widgets.make_widget(
|
||||
self,
|
||||
"selectbox",
|
||||
rightAdjustFrame,
|
||||
"Overworld Palettes",
|
||||
None,
|
||||
top.gameOptionsWindow.gameOptionsWidgets["owpalettes"].storageVar,
|
||||
{"label": {"side": LEFT}, "selectbox": {"side": RIGHT}},
|
||||
{
|
||||
"Default": "default",
|
||||
@@ -143,14 +145,14 @@ def adjust_page(top,parent,working_dirs):
|
||||
)
|
||||
self.adjustWidgets[key].pack(anchor=E)
|
||||
|
||||
## Underworld Palettes (not Enemizer)
|
||||
# Underworld Palettes (not Enemizer)
|
||||
key = "uwpalettes"
|
||||
self.adjustWidgets[key] = widgets.make_widget(
|
||||
self,
|
||||
"selectbox",
|
||||
rightAdjustFrame,
|
||||
"Underworld Palettes",
|
||||
None,
|
||||
top.gameOptionsWindow.gameOptionsWidgets["uwpalettes"].storageVar,
|
||||
{"label": {"side": LEFT}, "selectbox": {"side": RIGHT}},
|
||||
{
|
||||
"Default": "default",
|
||||
@@ -179,16 +181,16 @@ def adjust_page(top,parent,working_dirs):
|
||||
|
||||
def adjustRom():
|
||||
guiargs = Namespace()
|
||||
guiargs.heartbeep = self.adjustWidgets["heartbeep"].get()
|
||||
guiargs.heartcolor = self.adjustWidgets["heartcolor"].get()
|
||||
guiargs.fastmenu = self.adjustWidgets["menuspeed"].get()
|
||||
guiargs.ow_palettes = self.adjustWidgets["owpalettes"].get()
|
||||
guiargs.uw_palettes = self.adjustWidgets["uwpalettes"].get()
|
||||
guiargs.quickswap = bool(self.adjustWidgets["quickswap"].get())
|
||||
guiargs.disablemusic = bool(self.adjustWidgets["nobgm"].get())
|
||||
guiargs.heartbeep = self.adjustWidgets["heartbeep"].storageVar.get()
|
||||
guiargs.heartcolor = self.adjustWidgets["heartcolor"].storageVar.get()
|
||||
guiargs.fastmenu = self.adjustWidgets["menuspeed"].storageVar.get()
|
||||
guiargs.ow_palettes = self.adjustWidgets["owpalettes"].storageVar.get()
|
||||
guiargs.uw_palettes = self.adjustWidgets["uwpalettes"].storageVar.get()
|
||||
guiargs.quickswap = bool(self.adjustWidgets["quickswap"].storageVar.get())
|
||||
guiargs.disablemusic = bool(self.adjustWidgets["nobgm"].storageVar.get())
|
||||
guiargs.rom = self.romVar2.get()
|
||||
guiargs.baserom = top.generationSetupWindow.romVar.get()
|
||||
# guiargs.sprite = sprite
|
||||
guiargs.sprite = self.sprite
|
||||
try:
|
||||
adjust(args=guiargs)
|
||||
except Exception as e:
|
||||
|
||||
124
gui/bottom.py
124
gui/bottom.py
@@ -8,7 +8,8 @@ from Main import main
|
||||
from Utils import local_path, output_path, open_file
|
||||
import gui.widgets as widgets
|
||||
|
||||
def bottom_frame(self,parent,args=None):
|
||||
|
||||
def bottom_frame(self, parent, args=None):
|
||||
# Bottom Frame
|
||||
self = ttk.Frame(parent)
|
||||
|
||||
@@ -42,63 +43,7 @@ def bottom_frame(self,parent,args=None):
|
||||
self.bottomWidgets[key].pack(side=LEFT)
|
||||
|
||||
def generateRom():
|
||||
guiargs = Namespace()
|
||||
guiargs.multi = int(parent.multiworldWindow.multiworldWidgets["worlds"].storageVar.get())
|
||||
guiargs.names = parent.multiworldWindow.namesVar.get()
|
||||
guiargs.seed = int(parent.farBottomFrame.seedVar.get()) if parent.farBottomFrame.seedVar.get() else None
|
||||
guiargs.count = int(parent.farBottomFrame.bottomWidgets["generationcount"].storageVar.get()) if parent.farBottomFrame.bottomWidgets["generationcount"].storageVar.get() != '1' else None
|
||||
guiargs.mode = parent.itemWindow.itemWidgets["worldstate"].storageVar.get()
|
||||
guiargs.logic = parent.itemWindow.itemWidgets["logiclevel"].storageVar.get()
|
||||
|
||||
guiargs.goal = parent.itemWindow.itemWidgets["goal"].storageVar.get()
|
||||
guiargs.crystals_gt = parent.itemWindow.itemWidgets["crystals_gt"].storageVar.get()
|
||||
guiargs.crystals_ganon = parent.itemWindow.itemWidgets["crystals_ganon"].storageVar.get()
|
||||
guiargs.swords = parent.itemWindow.itemWidgets["weapons"].storageVar.get()
|
||||
guiargs.difficulty = parent.itemWindow.itemWidgets["itempool"].storageVar.get()
|
||||
guiargs.item_functionality = parent.itemWindow.itemWidgets["itemfunction"].storageVar.get()
|
||||
guiargs.timer = parent.itemWindow.itemWidgets["timer"].storageVar.get()
|
||||
guiargs.progressive = parent.itemWindow.itemWidgets["progressives"].storageVar.get()
|
||||
guiargs.accessibility = parent.itemWindow.itemWidgets["accessibility"].storageVar.get()
|
||||
guiargs.algorithm = parent.itemWindow.itemWidgets["sortingalgo"].storageVar.get()
|
||||
guiargs.shuffle = parent.entrandoWindow.entrandoWidgets["entranceshuffle"].storageVar.get()
|
||||
guiargs.door_shuffle = parent.dungeonRandoWindow.dungeonWidgets["dungeondoorshuffle"].storageVar.get()
|
||||
guiargs.heartbeep = parent.gameOptionsWindow.gameOptionsWidgets["heartbeep"].storageVar.get()
|
||||
guiargs.heartcolor = parent.gameOptionsWindow.gameOptionsWidgets["heartcolor"].storageVar.get()
|
||||
guiargs.fastmenu = parent.gameOptionsWindow.gameOptionsWidgets["menuspeed"].storageVar.get()
|
||||
guiargs.create_spoiler = bool(parent.generationSetupWindow.generationWidgets["spoiler"].storageVar.get())
|
||||
guiargs.skip_playthrough = not bool(parent.generationSetupWindow.generationWidgets["spoiler"].storageVar.get())
|
||||
guiargs.suppress_rom = bool(parent.generationSetupWindow.generationWidgets["suppressrom"].storageVar.get())
|
||||
guiargs.openpyramid = bool(parent.entrandoWindow.entrandoWidgets["openpyramid"].storageVar.get())
|
||||
guiargs.mapshuffle = bool(parent.dungeonRandoWindow.dungeonWidgets["mapshuffle"].storageVar.get())
|
||||
guiargs.compassshuffle = bool(parent.dungeonRandoWindow.dungeonWidgets["compassshuffle"].storageVar.get())
|
||||
guiargs.keyshuffle = bool(parent.dungeonRandoWindow.dungeonWidgets["smallkeyshuffle"].storageVar.get())
|
||||
guiargs.bigkeyshuffle = bool(parent.dungeonRandoWindow.dungeonWidgets["bigkeyshuffle"].storageVar.get())
|
||||
guiargs.retro = bool(parent.itemWindow.itemWidgets["retro"].storageVar.get())
|
||||
guiargs.quickswap = bool(parent.gameOptionsWindow.gameOptionsWidgets["quickswap"].storageVar.get())
|
||||
guiargs.disablemusic = bool(parent.gameOptionsWindow.gameOptionsWidgets["nobgm"].storageVar.get())
|
||||
guiargs.ow_palettes = parent.gameOptionsWindow.gameOptionsWidgets["owpalettes"].storageVar.get()
|
||||
guiargs.uw_palettes = parent.gameOptionsWindow.gameOptionsWidgets["uwpalettes"].storageVar.get()
|
||||
guiargs.shuffleganon = bool(parent.entrandoWindow.entrandoWidgets["shuffleganon"].storageVar.get())
|
||||
guiargs.hints = bool(parent.gameOptionsWindow.gameOptionsWidgets["hints"].storageVar.get())
|
||||
guiargs.enemizercli = parent.enemizerWindow.enemizerCLIpathVar.get()
|
||||
guiargs.shufflebosses = parent.enemizerWindow.enemizerWidgets["bossshuffle"].storageVar.get()
|
||||
guiargs.shuffleenemies = parent.enemizerWindow.enemizerWidgets["enemyshuffle"].storageVar.get()
|
||||
guiargs.enemy_health = parent.enemizerWindow.enemizerWidgets["enemyhealth"].storageVar.get()
|
||||
guiargs.enemy_damage = parent.enemizerWindow.enemizerWidgets["enemydamage"].storageVar.get()
|
||||
guiargs.shufflepots = bool(parent.enemizerWindow.enemizerWidgets["potshuffle"].storageVar.get())
|
||||
guiargs.custom = bool(parent.generationSetupWindow.generationWidgets["usecustompool"].storageVar.get())
|
||||
guiargs.customitemarray = [int(parent.customContent.customWidgets["bow"].storageVar.get()), int(parent.customContent.customWidgets["silversupgrade"].storageVar.get()), int(parent.customContent.customWidgets["boomerang"].storageVar.get()), int(parent.customContent.customWidgets["redmerang"].storageVar.get()), int(parent.customContent.customWidgets["hookshot"].storageVar.get()), int(parent.customContent.customWidgets["mushroom"].storageVar.get()), int(parent.customContent.customWidgets["powder"].storageVar.get()), int(parent.customContent.customWidgets["firerod"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["icerod"].storageVar.get()), int(parent.customContent.customWidgets["bombos"].storageVar.get()), int(parent.customContent.customWidgets["ether"].storageVar.get()), int(parent.customContent.customWidgets["quake"].storageVar.get()), int(parent.customContent.customWidgets["lamp"].storageVar.get()), int(parent.customContent.customWidgets["hammer"].storageVar.get()), int(parent.customContent.customWidgets["shovel"].storageVar.get()), int(parent.customContent.customWidgets["flute"].storageVar.get()), int(parent.customContent.customWidgets["bugnet"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["book"].storageVar.get()), int(parent.customContent.customWidgets["bottle"].storageVar.get()), int(parent.customContent.customWidgets["somaria"].storageVar.get()), int(parent.customContent.customWidgets["byrna"].storageVar.get()), int(parent.customContent.customWidgets["cape"].storageVar.get()), int(parent.customContent.customWidgets["mirror"].storageVar.get()), int(parent.customContent.customWidgets["boots"].storageVar.get()), int(parent.customContent.customWidgets["powerglove"].storageVar.get()), int(parent.customContent.customWidgets["titansmitt"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["progressiveglove"].storageVar.get()), int(parent.customContent.customWidgets["flippers"].storageVar.get()), int(parent.customContent.customWidgets["pearl"].storageVar.get()), int(parent.customContent.customWidgets["heartpiece"].storageVar.get()), int(parent.customContent.customWidgets["heartcontainer"].storageVar.get()), int(parent.customContent.customWidgets["sancheart"].storageVar.get()), int(parent.customContent.customWidgets["sword1"].storageVar.get()), int(parent.customContent.customWidgets["sword2"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["sword3"].storageVar.get()), int(parent.customContent.customWidgets["sword4"].storageVar.get()), int(parent.customContent.customWidgets["progressivesword"].storageVar.get()), int(parent.customContent.customWidgets["shield1"].storageVar.get()), int(parent.customContent.customWidgets["shield2"].storageVar.get()), int(parent.customContent.customWidgets["shield3"].storageVar.get()), int(parent.customContent.customWidgets["progressiveshield"].storageVar.get()), int(parent.customContent.customWidgets["mail2"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["mail3"].storageVar.get()), int(parent.customContent.customWidgets["progressivemail"].storageVar.get()), int(parent.customContent.customWidgets["halfmagic"].storageVar.get()), int(parent.customContent.customWidgets["quartermagic"].storageVar.get()), int(parent.customContent.customWidgets["bombsplus5"].storageVar.get()), int(parent.customContent.customWidgets["bombsplus10"].storageVar.get()), int(parent.customContent.customWidgets["arrowsplus5"].storageVar.get()), int(parent.customContent.customWidgets["arrowsplus10"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["arrow1"].storageVar.get()), int(parent.customContent.customWidgets["arrow10"].storageVar.get()), int(parent.customContent.customWidgets["bomb1"].storageVar.get()), int(parent.customContent.customWidgets["bomb3"].storageVar.get()), int(parent.customContent.customWidgets["rupee1"].storageVar.get()), int(parent.customContent.customWidgets["rupee5"].storageVar.get()), int(parent.customContent.customWidgets["rupee20"].storageVar.get()), int(parent.customContent.customWidgets["rupee50"].storageVar.get()), int(parent.customContent.customWidgets["rupee100"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["rupee300"].storageVar.get()), int(parent.customContent.customWidgets["rupoor"].storageVar.get()), int(parent.customContent.customWidgets["blueclock"].storageVar.get()), int(parent.customContent.customWidgets["greenclock"].storageVar.get()), int(parent.customContent.customWidgets["redclock"].storageVar.get()), int(parent.customContent.customWidgets["progressivebow"].storageVar.get()), int(parent.customContent.customWidgets["bomb10"].storageVar.get()), int(parent.customContent.customWidgets["triforcepieces"].storageVar.get()),int(parent.customContent.customWidgets["triforcepiecesgoal"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["triforce"].storageVar.get()),int(parent.customContent.customWidgets["rupoorcost"].storageVar.get()),int(parent.customContent.customWidgets["generickeys"].storageVar.get())]
|
||||
guiargs.rom = parent.generationSetupWindow.romVar.get()
|
||||
guiargs.sprite = parent.gameOptionsWindow.gameOptionsWidgets["sprite"]["spriteObject"]
|
||||
guiargs.outputpath = args.outputpath if args else None
|
||||
guiargs = create_guiargs(parent)
|
||||
# get default values for missing parameters
|
||||
for k,v in vars(parse_arguments(['--multi', str(guiargs.multi)])).items():
|
||||
if k not in vars(guiargs):
|
||||
@@ -139,3 +84,66 @@ def bottom_frame(self,parent,args=None):
|
||||
openReadmeButton.pack()
|
||||
|
||||
return self
|
||||
|
||||
|
||||
def create_guiargs(parent):
|
||||
guiargs = Namespace()
|
||||
guiargs.multi = int(parent.multiworldWindow.multiworldWidgets["worlds"].storageVar.get())
|
||||
guiargs.names = parent.multiworldWindow.namesVar.get()
|
||||
guiargs.seed = int(parent.farBottomFrame.seedVar.get()) if parent.farBottomFrame.seedVar.get() else None
|
||||
guiargs.count = int(parent.farBottomFrame.bottomWidgets["generationcount"].storageVar.get()) if parent.farBottomFrame.bottomWidgets["generationcount"].storageVar.get() != '1' else None
|
||||
guiargs.mode = parent.itemWindow.itemWidgets["worldstate"].storageVar.get()
|
||||
guiargs.logic = parent.itemWindow.itemWidgets["logiclevel"].storageVar.get()
|
||||
|
||||
guiargs.goal = parent.itemWindow.itemWidgets["goal"].storageVar.get()
|
||||
guiargs.crystals_gt = parent.itemWindow.itemWidgets["crystals_gt"].storageVar.get()
|
||||
guiargs.crystals_ganon = parent.itemWindow.itemWidgets["crystals_ganon"].storageVar.get()
|
||||
guiargs.swords = parent.itemWindow.itemWidgets["weapons"].storageVar.get()
|
||||
guiargs.difficulty = parent.itemWindow.itemWidgets["itempool"].storageVar.get()
|
||||
guiargs.item_functionality = parent.itemWindow.itemWidgets["itemfunction"].storageVar.get()
|
||||
guiargs.timer = parent.itemWindow.itemWidgets["timer"].storageVar.get()
|
||||
guiargs.progressive = parent.itemWindow.itemWidgets["progressives"].storageVar.get()
|
||||
guiargs.accessibility = parent.itemWindow.itemWidgets["accessibility"].storageVar.get()
|
||||
guiargs.algorithm = parent.itemWindow.itemWidgets["sortingalgo"].storageVar.get()
|
||||
guiargs.shuffle = parent.entrandoWindow.entrandoWidgets["entranceshuffle"].storageVar.get()
|
||||
guiargs.door_shuffle = parent.dungeonRandoWindow.dungeonWidgets["dungeondoorshuffle"].storageVar.get()
|
||||
guiargs.experimental = parent.dungeonRandoWindow.dungeonWidgets["experimental"].storageVar.get()
|
||||
guiargs.heartbeep = parent.gameOptionsWindow.gameOptionsWidgets["heartbeep"].storageVar.get()
|
||||
guiargs.heartcolor = parent.gameOptionsWindow.gameOptionsWidgets["heartcolor"].storageVar.get()
|
||||
guiargs.fastmenu = parent.gameOptionsWindow.gameOptionsWidgets["menuspeed"].storageVar.get()
|
||||
guiargs.create_spoiler = bool(parent.generationSetupWindow.generationWidgets["spoiler"].storageVar.get())
|
||||
guiargs.skip_playthrough = not bool(parent.generationSetupWindow.generationWidgets["spoiler"].storageVar.get())
|
||||
guiargs.suppress_rom = bool(parent.generationSetupWindow.generationWidgets["suppressrom"].storageVar.get())
|
||||
guiargs.openpyramid = bool(parent.entrandoWindow.entrandoWidgets["openpyramid"].storageVar.get())
|
||||
guiargs.mapshuffle = bool(parent.dungeonRandoWindow.dungeonWidgets["mapshuffle"].storageVar.get())
|
||||
guiargs.compassshuffle = bool(parent.dungeonRandoWindow.dungeonWidgets["compassshuffle"].storageVar.get())
|
||||
guiargs.keyshuffle = bool(parent.dungeonRandoWindow.dungeonWidgets["smallkeyshuffle"].storageVar.get())
|
||||
guiargs.bigkeyshuffle = bool(parent.dungeonRandoWindow.dungeonWidgets["bigkeyshuffle"].storageVar.get())
|
||||
guiargs.retro = bool(parent.itemWindow.itemWidgets["retro"].storageVar.get())
|
||||
guiargs.quickswap = bool(parent.gameOptionsWindow.gameOptionsWidgets["quickswap"].storageVar.get())
|
||||
guiargs.disablemusic = bool(parent.gameOptionsWindow.gameOptionsWidgets["nobgm"].storageVar.get())
|
||||
guiargs.ow_palettes = parent.gameOptionsWindow.gameOptionsWidgets["owpalettes"].storageVar.get()
|
||||
guiargs.uw_palettes = parent.gameOptionsWindow.gameOptionsWidgets["uwpalettes"].storageVar.get()
|
||||
guiargs.shuffleganon = bool(parent.entrandoWindow.entrandoWidgets["shuffleganon"].storageVar.get())
|
||||
guiargs.hints = bool(parent.gameOptionsWindow.gameOptionsWidgets["hints"].storageVar.get())
|
||||
guiargs.enemizercli = parent.enemizerWindow.enemizerCLIpathVar.get()
|
||||
guiargs.shufflebosses = parent.enemizerWindow.enemizerWidgets["bossshuffle"].storageVar.get()
|
||||
guiargs.shuffleenemies = parent.enemizerWindow.enemizerWidgets["enemyshuffle"].storageVar.get()
|
||||
guiargs.enemy_health = parent.enemizerWindow.enemizerWidgets["enemyhealth"].storageVar.get()
|
||||
guiargs.enemy_damage = parent.enemizerWindow.enemizerWidgets["enemydamage"].storageVar.get()
|
||||
guiargs.shufflepots = bool(parent.enemizerWindow.enemizerWidgets["potshuffle"].storageVar.get())
|
||||
guiargs.custom = bool(parent.generationSetupWindow.generationWidgets["usecustompool"].storageVar.get())
|
||||
guiargs.customitemarray = [int(parent.customContent.customWidgets["bow"].storageVar.get()), int(parent.customContent.customWidgets["silversupgrade"].storageVar.get()), int(parent.customContent.customWidgets["boomerang"].storageVar.get()), int(parent.customContent.customWidgets["redmerang"].storageVar.get()), int(parent.customContent.customWidgets["hookshot"].storageVar.get()), int(parent.customContent.customWidgets["mushroom"].storageVar.get()), int(parent.customContent.customWidgets["powder"].storageVar.get()), int(parent.customContent.customWidgets["firerod"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["icerod"].storageVar.get()), int(parent.customContent.customWidgets["bombos"].storageVar.get()), int(parent.customContent.customWidgets["ether"].storageVar.get()), int(parent.customContent.customWidgets["quake"].storageVar.get()), int(parent.customContent.customWidgets["lamp"].storageVar.get()), int(parent.customContent.customWidgets["hammer"].storageVar.get()), int(parent.customContent.customWidgets["shovel"].storageVar.get()), int(parent.customContent.customWidgets["flute"].storageVar.get()), int(parent.customContent.customWidgets["bugnet"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["book"].storageVar.get()), int(parent.customContent.customWidgets["bottle"].storageVar.get()), int(parent.customContent.customWidgets["somaria"].storageVar.get()), int(parent.customContent.customWidgets["byrna"].storageVar.get()), int(parent.customContent.customWidgets["cape"].storageVar.get()), int(parent.customContent.customWidgets["mirror"].storageVar.get()), int(parent.customContent.customWidgets["boots"].storageVar.get()), int(parent.customContent.customWidgets["powerglove"].storageVar.get()), int(parent.customContent.customWidgets["titansmitt"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["progressiveglove"].storageVar.get()), int(parent.customContent.customWidgets["flippers"].storageVar.get()), int(parent.customContent.customWidgets["pearl"].storageVar.get()), int(parent.customContent.customWidgets["heartpiece"].storageVar.get()), int(parent.customContent.customWidgets["heartcontainer"].storageVar.get()), int(parent.customContent.customWidgets["sancheart"].storageVar.get()), int(parent.customContent.customWidgets["sword1"].storageVar.get()), int(parent.customContent.customWidgets["sword2"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["sword3"].storageVar.get()), int(parent.customContent.customWidgets["sword4"].storageVar.get()), int(parent.customContent.customWidgets["progressivesword"].storageVar.get()), int(parent.customContent.customWidgets["shield1"].storageVar.get()), int(parent.customContent.customWidgets["shield2"].storageVar.get()), int(parent.customContent.customWidgets["shield3"].storageVar.get()), int(parent.customContent.customWidgets["progressiveshield"].storageVar.get()), int(parent.customContent.customWidgets["mail2"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["mail3"].storageVar.get()), int(parent.customContent.customWidgets["progressivemail"].storageVar.get()), int(parent.customContent.customWidgets["halfmagic"].storageVar.get()), int(parent.customContent.customWidgets["quartermagic"].storageVar.get()), int(parent.customContent.customWidgets["bombsplus5"].storageVar.get()), int(parent.customContent.customWidgets["bombsplus10"].storageVar.get()), int(parent.customContent.customWidgets["arrowsplus5"].storageVar.get()), int(parent.customContent.customWidgets["arrowsplus10"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["arrow1"].storageVar.get()), int(parent.customContent.customWidgets["arrow10"].storageVar.get()), int(parent.customContent.customWidgets["bomb1"].storageVar.get()), int(parent.customContent.customWidgets["bomb3"].storageVar.get()), int(parent.customContent.customWidgets["rupee1"].storageVar.get()), int(parent.customContent.customWidgets["rupee5"].storageVar.get()), int(parent.customContent.customWidgets["rupee20"].storageVar.get()), int(parent.customContent.customWidgets["rupee50"].storageVar.get()), int(parent.customContent.customWidgets["rupee100"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["rupee300"].storageVar.get()), int(parent.customContent.customWidgets["rupoor"].storageVar.get()), int(parent.customContent.customWidgets["blueclock"].storageVar.get()), int(parent.customContent.customWidgets["greenclock"].storageVar.get()), int(parent.customContent.customWidgets["redclock"].storageVar.get()), int(parent.customContent.customWidgets["progressivebow"].storageVar.get()), int(parent.customContent.customWidgets["bomb10"].storageVar.get()), int(parent.customContent.customWidgets["triforcepieces"].storageVar.get()),int(parent.customContent.customWidgets["triforcepiecesgoal"].storageVar.get()),
|
||||
int(parent.customContent.customWidgets["triforce"].storageVar.get()),int(parent.customContent.customWidgets["rupoorcost"].storageVar.get()),int(parent.customContent.customWidgets["generickeys"].storageVar.get())]
|
||||
guiargs.rom = parent.generationSetupWindow.romVar.get()
|
||||
guiargs.sprite = parent.gameOptionsWindow.gameOptionsWidgets["sprite"]["spriteObject"]
|
||||
guiargs.randomSprite = parent.randomSprite.get()
|
||||
guiargs.outputpath = parent.outputPath.get()
|
||||
return guiargs
|
||||
|
||||
@@ -2,55 +2,82 @@ from classes.SpriteSelector import SpriteSelector as spriteSelector
|
||||
from gui.randomize.gameoptions import set_sprite
|
||||
from Rom import Sprite
|
||||
|
||||
def loadcliargs(gui,args):
|
||||
if args is not None:
|
||||
for k,v in vars(args).items():
|
||||
if type(v) is dict:
|
||||
setattr(args, k, v[1]) # only get values for player 1 for now
|
||||
# load values from commandline args
|
||||
gui.generationSetupWindow.generationWidgets["spoiler"].storageVar.set(int(args.create_spoiler))
|
||||
gui.generationSetupWindow.generationWidgets["suppressrom"].storageVar.set(int(args.suppress_rom))
|
||||
gui.dungeonRandoWindow.dungeonWidgets["mapshuffle"].storageVar.set(args.mapshuffle)
|
||||
gui.dungeonRandoWindow.dungeonWidgets["compassshuffle"].storageVar.set(args.compassshuffle)
|
||||
gui.dungeonRandoWindow.dungeonWidgets["smallkeyshuffle"].storageVar.set(args.keyshuffle)
|
||||
gui.dungeonRandoWindow.dungeonWidgets["bigkeyshuffle"].storageVar.set(args.bigkeyshuffle)
|
||||
gui.itemWindow.itemWidgets["retro"].storageVar.set(args.retro)
|
||||
gui.entrandoWindow.entrandoWidgets["openpyramid"].storageVar.set(args.openpyramid)
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["quickswap"].storageVar.set(int(args.quickswap))
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["nobgm"].storageVar.set(int(args.disablemusic))
|
||||
if args.multi:
|
||||
gui.multiworldWindow.multiworldWidgets["worlds"].storageVar.set(str(args.multi))
|
||||
if args.count:
|
||||
gui.farBottomFrame.bottomWidgets["generationcount"].storageVar.set(str(args.count))
|
||||
if args.seed:
|
||||
gui.farBottomFrame.seedVar.set(str(args.seed))
|
||||
gui.itemWindow.itemWidgets["worldstate"].storageVar.set(args.mode)
|
||||
gui.itemWindow.itemWidgets["weapons"].storageVar.set(args.swords)
|
||||
gui.itemWindow.itemWidgets["itempool"].storageVar.set(args.difficulty)
|
||||
gui.itemWindow.itemWidgets["itemfunction"].storageVar.set(args.item_functionality)
|
||||
gui.itemWindow.itemWidgets["timer"].storageVar.set(args.timer)
|
||||
gui.itemWindow.itemWidgets["progressives"].storageVar.set(args.progressive)
|
||||
gui.itemWindow.itemWidgets["accessibility"].storageVar.set(args.accessibility)
|
||||
gui.itemWindow.itemWidgets["goal"].storageVar.set(args.goal)
|
||||
gui.itemWindow.itemWidgets["crystals_gt"].storageVar.set(args.crystals_gt)
|
||||
gui.itemWindow.itemWidgets["crystals_ganon"].storageVar.set(args.crystals_ganon)
|
||||
gui.itemWindow.itemWidgets["sortingalgo"].storageVar.set(args.algorithm)
|
||||
gui.entrandoWindow.entrandoWidgets["entranceshuffle"].storageVar.set(args.shuffle)
|
||||
gui.dungeonRandoWindow.dungeonWidgets["dungeondoorshuffle"].storageVar.set(args.door_shuffle)
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["heartcolor"].storageVar.set(args.heartcolor)
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["heartbeep"].storageVar.set(args.heartbeep)
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["menuspeed"].storageVar.set(args.fastmenu)
|
||||
gui.itemWindow.itemWidgets["logiclevel"].storageVar.set(args.logic)
|
||||
gui.generationSetupWindow.romVar.set(args.rom)
|
||||
gui.entrandoWindow.entrandoWidgets["shuffleganon"].storageVar.set(args.shuffleganon)
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["hints"].storageVar.set(args.hints)
|
||||
gui.enemizerWindow.enemizerCLIpathVar.set(args.enemizercli)
|
||||
gui.enemizerWindow.enemizerWidgets["potshuffle"].storageVar.set(args.shufflepots)
|
||||
gui.enemizerWindow.enemizerWidgets["enemyshuffle"].storageVar.set(args.shuffleenemies)
|
||||
gui.enemizerWindow.enemizerWidgets["bossshuffle"].storageVar.set(args.shufflebosses)
|
||||
gui.enemizerWindow.enemizerWidgets["enemydamage"].storageVar.set(args.enemy_damage)
|
||||
gui.enemizerWindow.enemizerWidgets["enemyhealth"].storageVar.set(args.enemy_health)
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["owpalettes"].storageVar.set(args.ow_palettes)
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["uwpalettes"].storageVar.set(args.uw_palettes)
|
||||
if args.sprite is not None:
|
||||
set_sprite(Sprite(args.sprite),spriteObject=gui.gameOptionsWindow.gameOptionsWidgets["sprite"]["spriteObject"],spriteNameVar=gui.gameOptionsWindow.gameOptionsWidgets["sprite"]["spriteNameVar"])
|
||||
|
||||
def loadcliargs(gui, args):
|
||||
if args is not None:
|
||||
for k, v in vars(args).items():
|
||||
if type(v) is dict:
|
||||
setattr(args, k, v[1]) # only get values for player 1 for now
|
||||
# load values from commandline args
|
||||
gui.generationSetupWindow.generationWidgets["spoiler"].storageVar.set(int(args.create_spoiler))
|
||||
gui.generationSetupWindow.generationWidgets["suppressrom"].storageVar.set(int(args.suppress_rom))
|
||||
gui.dungeonRandoWindow.dungeonWidgets["mapshuffle"].storageVar.set(args.mapshuffle)
|
||||
gui.dungeonRandoWindow.dungeonWidgets["compassshuffle"].storageVar.set(args.compassshuffle)
|
||||
gui.dungeonRandoWindow.dungeonWidgets["smallkeyshuffle"].storageVar.set(args.keyshuffle)
|
||||
gui.dungeonRandoWindow.dungeonWidgets["bigkeyshuffle"].storageVar.set(args.bigkeyshuffle)
|
||||
gui.itemWindow.itemWidgets["retro"].storageVar.set(args.retro)
|
||||
gui.entrandoWindow.entrandoWidgets["openpyramid"].storageVar.set(args.openpyramid)
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["quickswap"].storageVar.set(int(args.quickswap))
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["nobgm"].storageVar.set(int(args.disablemusic))
|
||||
if args.multi:
|
||||
gui.multiworldWindow.multiworldWidgets["worlds"].storageVar.set(str(args.multi))
|
||||
if args.count:
|
||||
gui.farBottomFrame.bottomWidgets["generationcount"].storageVar.set(str(args.count))
|
||||
if args.seed:
|
||||
gui.farBottomFrame.seedVar.set(str(args.seed))
|
||||
gui.itemWindow.itemWidgets["worldstate"].storageVar.set(args.mode)
|
||||
gui.itemWindow.itemWidgets["weapons"].storageVar.set(args.swords)
|
||||
gui.itemWindow.itemWidgets["itempool"].storageVar.set(args.difficulty)
|
||||
gui.itemWindow.itemWidgets["itemfunction"].storageVar.set(args.item_functionality)
|
||||
gui.itemWindow.itemWidgets["timer"].storageVar.set(args.timer)
|
||||
gui.itemWindow.itemWidgets["progressives"].storageVar.set(args.progressive)
|
||||
gui.itemWindow.itemWidgets["accessibility"].storageVar.set(args.accessibility)
|
||||
gui.itemWindow.itemWidgets["goal"].storageVar.set(args.goal)
|
||||
gui.itemWindow.itemWidgets["crystals_gt"].storageVar.set(args.crystals_gt)
|
||||
gui.itemWindow.itemWidgets["crystals_ganon"].storageVar.set(args.crystals_ganon)
|
||||
gui.itemWindow.itemWidgets["sortingalgo"].storageVar.set(args.algorithm)
|
||||
gui.entrandoWindow.entrandoWidgets["entranceshuffle"].storageVar.set(args.shuffle)
|
||||
gui.dungeonRandoWindow.dungeonWidgets["dungeondoorshuffle"].storageVar.set(args.door_shuffle)
|
||||
gui.dungeonRandoWindow.dungeonWidgets["experimental"].storageVar.set(args.experimental)
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["heartcolor"].storageVar.set(args.heartcolor)
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["heartbeep"].storageVar.set(args.heartbeep)
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["menuspeed"].storageVar.set(args.fastmenu)
|
||||
gui.itemWindow.itemWidgets["logiclevel"].storageVar.set(args.logic)
|
||||
gui.generationSetupWindow.romVar.set(args.rom)
|
||||
gui.entrandoWindow.entrandoWidgets["shuffleganon"].storageVar.set(args.shuffleganon)
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["hints"].storageVar.set(args.hints)
|
||||
gui.enemizerWindow.enemizerCLIpathVar.set(args.enemizercli)
|
||||
gui.enemizerWindow.enemizerWidgets["potshuffle"].storageVar.set(args.shufflepots)
|
||||
gui.enemizerWindow.enemizerWidgets["enemyshuffle"].storageVar.set(args.shuffleenemies)
|
||||
gui.enemizerWindow.enemizerWidgets["bossshuffle"].storageVar.set(args.shufflebosses)
|
||||
gui.enemizerWindow.enemizerWidgets["enemydamage"].storageVar.set(args.enemy_damage)
|
||||
gui.enemizerWindow.enemizerWidgets["enemyhealth"].storageVar.set(args.enemy_health)
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["owpalettes"].storageVar.set(args.ow_palettes)
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["uwpalettes"].storageVar.set(args.uw_palettes)
|
||||
gui.outputPath.set(args.outputpath)
|
||||
|
||||
def sprite_setter(spriteObject):
|
||||
gui.gameOptionsWindow.gameOptionsWidgets["sprite"]["spriteObject"] = spriteObject
|
||||
if args.sprite is not None:
|
||||
sprite_obj = args.sprite if isinstance(args.sprite, Sprite) else Sprite(args.sprite)
|
||||
r_sprite_flag = args.randomSprite if hasattr(args, 'randomSprite') else False
|
||||
set_sprite(sprite_obj, r_sprite_flag, spriteSetter=sprite_setter,
|
||||
spriteNameVar=gui.gameOptionsWindow.gameOptionsWidgets["sprite"]["spriteNameVar"],
|
||||
randomSpriteVar=gui.randomSprite)
|
||||
|
||||
gui.adjustContent.adjustWidgets["nobgm"].storageVar.set(int(args.disablemusic))
|
||||
gui.adjustContent.adjustWidgets['quickswap'].storageVar.set(args.quickswap)
|
||||
gui.adjustContent.adjustWidgets["heartcolor"].storageVar.set(args.heartcolor)
|
||||
gui.adjustContent.adjustWidgets["heartbeep"].storageVar.set(args.heartbeep)
|
||||
gui.adjustContent.adjustWidgets["menuspeed"].storageVar.set(args.fastmenu)
|
||||
gui.adjustContent.adjustWidgets["owpalettes"].storageVar.set(args.ow_palettes)
|
||||
gui.adjustContent.adjustWidgets["uwpalettes"].storageVar.set(args.uw_palettes)
|
||||
|
||||
def sprite_setter_adj(spriteObject):
|
||||
gui.adjustContent.sprite = spriteObject
|
||||
if args.sprite is not None:
|
||||
sprite_obj = args.sprite if isinstance(args.sprite, Sprite) else Sprite(args.sprite)
|
||||
r_sprite_flag = args.randomSprite if hasattr(args, 'randomSprite') else False
|
||||
set_sprite(sprite_obj, r_sprite_flag, spriteSetter=sprite_setter_adj,
|
||||
spriteNameVar=gui.adjustContent.spriteNameVar2,
|
||||
randomSpriteVar=gui.randomSprite)
|
||||
|
||||
@@ -75,4 +75,15 @@ def dungeon_page(parent):
|
||||
)
|
||||
self.dungeonWidgets[key].pack(anchor=W)
|
||||
|
||||
# Experimental features
|
||||
key = "experimental"
|
||||
self.dungeonWidgets[key] = widgets.make_widget(
|
||||
self,
|
||||
"checkbox",
|
||||
self,
|
||||
"Enable Experimental Features",
|
||||
None
|
||||
)
|
||||
self.dungeonWidgets[key].pack(anchor=W)
|
||||
|
||||
return self
|
||||
|
||||
@@ -26,7 +26,7 @@ def entrando_page(parent):
|
||||
"checkbox",
|
||||
self,
|
||||
"Include Ganon's Tower and Pyramid Hole in shuffle pool",
|
||||
{"default": 1}
|
||||
None
|
||||
)
|
||||
self.entrandoWidgets[key].pack(anchor=W)
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ from functools import partial
|
||||
import classes.SpriteSelector as spriteSelector
|
||||
import gui.widgets as widgets
|
||||
|
||||
def gameoptions_page(parent):
|
||||
|
||||
def gameoptions_page(top, parent):
|
||||
# Game Options
|
||||
self = ttk.Frame(parent)
|
||||
|
||||
@@ -94,14 +95,18 @@ def gameoptions_page(parent):
|
||||
self.gameOptionsWidgets["sprite"]["spriteObject"] = None
|
||||
self.gameOptionsWidgets["sprite"]["spriteNameVar"] = StringVar()
|
||||
|
||||
set_sprite(None,self.gameOptionsWidgets["sprite"]["spriteObject"],self.gameOptionsWidgets["sprite"]["spriteNameVar"])
|
||||
self.gameOptionsWidgets["sprite"]["spriteNameVar"].set('(unchanged)')
|
||||
spriteEntry = Label(spriteDialogFrame, textvariable=self.gameOptionsWidgets["sprite"]["spriteNameVar"])
|
||||
|
||||
def SpriteSelect():
|
||||
spriteSelector.SpriteSelector(parent, partial(set_sprite,spriteObject=self.gameOptionsWidgets["sprite"]["spriteObject"],spriteNameVar=self.gameOptionsWidgets["sprite"]["spriteNameVar"]))
|
||||
def sprite_setter(spriteObject):
|
||||
self.gameOptionsWidgets["sprite"]["spriteObject"] = spriteObject
|
||||
|
||||
spriteSelectButton = Button(spriteDialogFrame, text='...', command=SpriteSelect)
|
||||
def sprite_select():
|
||||
spriteSelector.SpriteSelector(parent, partial(set_sprite, spriteSetter=sprite_setter,
|
||||
spriteNameVar=self.gameOptionsWidgets["sprite"]["spriteNameVar"],
|
||||
randomSpriteVar=top.randomSprite))
|
||||
|
||||
spriteSelectButton = Button(spriteDialogFrame, text='...', command=sprite_select)
|
||||
|
||||
baseSpriteLabel.pack(side=LEFT)
|
||||
spriteEntry.pack(side=LEFT)
|
||||
@@ -164,12 +169,18 @@ def gameoptions_page(parent):
|
||||
|
||||
return self
|
||||
|
||||
def set_sprite(sprite_param,spriteObject=None,spriteNameVar=None):
|
||||
|
||||
def set_sprite(sprite_param, random_sprite, spriteSetter=None, spriteNameVar=None, randomSpriteVar=None):
|
||||
if sprite_param is None or not sprite_param.valid:
|
||||
spriteObject = None
|
||||
if spriteSetter:
|
||||
spriteSetter(None)
|
||||
if spriteNameVar is not None:
|
||||
spriteNameVar.set('(unchanged)')
|
||||
else:
|
||||
spriteObject = sprite_param
|
||||
if spriteSetter:
|
||||
spriteSetter(sprite_param)
|
||||
if spriteNameVar is not None:
|
||||
spriteNameVar.set(spriteObject.name)
|
||||
spriteNameVar.set(sprite_param.name)
|
||||
if randomSpriteVar:
|
||||
randomSpriteVar.set(random_sprite)
|
||||
|
||||
|
||||
@@ -69,9 +69,10 @@ def make_textbox(self, parent, label, storageVar, packAttrs):
|
||||
self.textbox.pack(packAttrs["textbox"])
|
||||
return self
|
||||
|
||||
|
||||
def make_widget(self, type, parent, label, storageVar=None, packAttrs=dict(), options=None):
|
||||
widget = None
|
||||
thisStorageVar = None
|
||||
thisStorageVar = storageVar
|
||||
if isinstance(storageVar,str):
|
||||
if storageVar == "int" or storageVar == "integer":
|
||||
thisStorageVar = IntVar()
|
||||
|
||||
Reference in New Issue
Block a user