Skip to content

Commit 4a50f5c

Browse files
author
Ryan
committed
code cleanup
1 parent 5e69e20 commit 4a50f5c

File tree

2 files changed

+44
-38
lines changed

2 files changed

+44
-38
lines changed

UIRetrieve/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# UI Retriever
22

3-
Retrieves UI for a given stage
3+
Retrieves UI for a given stage or fighter
44

55
## Usage
66

7-
Use when creating UI for a stage. This will search your ArcExplorer export folder and retrieve the relevant UI for a stage and place it in your desired workspace
7+
Use when creating UI for a stage or fighter. This will search your ArcExplorer export folder and retrieve the relevant UI for a stage/fighter and place it in your desired workspace

UIRetrieve/UIRetrieve.py

+42-36
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ def setDestinationDir():
107107

108108
#Set Destination Dir
109109
root.destinationDir = ""
110+
#Get or Set root.destinationDir
111+
if (root.destinationDir == ""):
112+
setDestinationDir()
113+
114+
110115
root.modSkins = []
111116

112117
def GetModSkins():
@@ -133,11 +138,7 @@ def GetModSkins():
133138
root.modSkins.append(skinName)
134139

135140

136-
#Get or Set root.destinationDir
137-
if (root.destinationDir == ""):
138-
setDestinationDir()
139141

140-
root.fighterUINames = [0,1,2,3,4,6]
141142
def combUIFolder(target,uiArray,folderUI):
142143
modType = "chara" if root.modType=="fighter" else "stage"
143144
ui_Folder = root.arcDir + r"/export/ui/" + folderUI + r"/"+modType
@@ -180,6 +181,7 @@ def getUI(quitOnFail=False):
180181
if (len(uiArray)==0):
181182
if (quitOnFail==False):
182183
print("Could not find UI for "+root.modName+", searching manually")
184+
manualUI()
183185
return
184186
else:
185187
messagebox.showinfo(root.title(),"Could not find UI for that "+root.modType)
@@ -234,46 +236,50 @@ def getUI(quitOnFail=False):
234236

235237

236238

237-
root.modName = ""
238-
subfolders = [f.path for f in os.scandir(root.destinationDir) if f.is_dir()]
239-
for dirname in list(subfolders):
240-
if (os.path.basename(dirname) == "stage"):
241-
modsubfolder = [s.path for s in os.scandir(dirname) if s.is_dir()]
242-
root.modName = os.path.basename(modsubfolder[0])
243-
if (root.modName == "common" and len(modsubfolder)>1):
244-
root.modName = os.path.basename(modsubfolder[1])
245-
elif (os.path.basename(dirname) == "fighter"):
246-
modsubfolder = [s.path for s in os.scandir(dirname) if s.is_dir()]
247-
root.modName = os.path.basename(modsubfolder[0])
248-
if (root.modName == "common" and len(modsubfolder)>1):
249-
root.modName = os.path.basename(modsubfolder[1])
250-
251-
print ("Selected mod: "+root.modName )
252-
if (root.modType == "fighter"):
253-
GetModSkins()
254-
if (root.modName!=""):
255-
getUI()
256-
#GetUI exists system on completion
239+
def GetModName():
240+
subfolders = [f.path for f in os.scandir(root.destinationDir) if f.is_dir()]
241+
for dirname in list(subfolders):
242+
if (os.path.basename(dirname) == root.modType):
243+
modsubfolder = [s.path for s in os.scandir(dirname) if s.is_dir()]
244+
desiredName = os.path.basename(modsubfolder[0])
245+
if (desiredName == "common" and len(modsubfolder)>1):
246+
return os.path.basename(modsubfolder[1])
247+
else:
248+
return desiredName
249+
return ""
250+
257251

258252
#Create UI for manually if no stage/fighter name was found
259-
def manualUI():
253+
def manualUIFinished():
260254
root.modName = root.e.get()
261255
root.withdraw()
262256
if (root.modName==None or root.modName == ""):
263257
root.destroy()
264258
sys.exit("no input")
265259
getUI(True)
266260

267-
messagebox.showinfo(root.title(),"Could not find "+root.modType+" associated with this mod, please type in the "+root.modType+" name manually on the next window")
268-
root.deiconify()
269-
root.label = Label(root, text="Type in the name of the "+root.modType+" you want to destination (ie ridley,battlefield_s,etc)", anchor=N)
270-
root.label.pack(side = TOP)
271-
root.e = Entry(root,width =50)
272-
root.e.pack()
273-
root.e.focus_set()
274-
b = Button(root, text = "OK", width = 10, command = manualUI)
275-
b.pack()
276-
277-
mainloop()
261+
def manualUI():
262+
messagebox.showinfo(root.title(),"Could not find "+root.modType+" associated with this mod, please type in the "+root.modType+" name manually on the next window")
263+
root.deiconify()
264+
root.label = Label(root, text="Type in the name of the "+root.modType+" you want to destination (ie ridley,battlefield_s,etc)", anchor=N)
265+
root.label.pack(side = TOP)
266+
root.e = Entry(root,width =50)
267+
root.e.pack()
268+
root.e.focus_set()
269+
b = Button(root, text = "OK", width = 10, command = manualUIFinished)
270+
b.pack()
278271

279272

273+
def Main():
274+
root.modName = GetModName()
275+
print ("Selected mod: "+root.modName )
276+
if (root.modType == "fighter"):
277+
GetModSkins()
278+
279+
if (root.modName!=""):
280+
getUI()
281+
else:
282+
manualUI()
283+
284+
Main()
285+
root.mainloop()

0 commit comments

Comments
 (0)