Skip to content

Commit 33a8b01

Browse files
committed
First time fixes
1 parent d1490e7 commit 33a8b01

File tree

2 files changed

+32
-30
lines changed

2 files changed

+32
-30
lines changed

SharpSuite.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@
2020

2121
from queue import Queue
2222

23+
#create ui for program
24+
root = Tk()
25+
root.title("Sharp Smash Suite")
26+
root.withdraw()
27+
28+
root.destinationDir = ""
29+
root.searchDir = ""
30+
31+
root.hasModel=False
32+
root.hasMesh=False
33+
2334
import configparser
2435
config = configparser.ConfigParser()
2536
if (not os.path.isfile(os.getcwd() + r"/img2nutexbGUI/config.ini")):
@@ -44,16 +55,6 @@ def truncate(string,direciton=W,limit=20,ellipsis=True):
4455
text = string[0:limit]+addEllipsis
4556
return text
4657

47-
#create ui for program
48-
root = Tk()
49-
root.title("Sharp Smash Suite")
50-
root.withdraw()
51-
52-
root.destinationDir = ""
53-
root.searchDir = ""
54-
55-
root.hasModel=False
56-
root.hasMesh=False
5758

5859
imgnutexbLocation = os.getcwd() + "/img2nutexbGUI/img2nutexb.exe"
5960

img2nutexbGUI/img2nutexbGUI.py

+21-20
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
'nutexbcliLocation': defaultCliLocation,
3838
'searchDir' : "",
3939
'destDir' : "",
40-
'root.maxThreads': "4"
40+
'maxThreads': "4"
4141
}
4242

4343

@@ -102,20 +102,23 @@ def ValidatePorgram():
102102
message(type = "ERROR",text = "Selected file not valid")
103103
root.destroy()
104104
sys.exit("No img2nutexb.exe file")
105+
105106
#if we don't have nutexbCli here, then ask for it!
106107
if (ValidCliExe() == False):
107-
message(type = "Warning",text = "nutexb_cli.exe not found, please select it (this can be skipped)")
108-
ftypes = [
109-
('nutexb_cli program', ["*.exe"])
110-
]
111-
file = filedialog.askopenfile(title = "Search",filetypes = ftypes)
112-
root.nutexbcliLocation = file.name if file else ""
113-
#if selected file is in valid, quit
114-
if (not ValidCliExe()):
115-
config.set("DEFAULT","nutexbcliLocation",defaultLocation)
116-
#message(type = "ERROR",text = "Selected file not valid")
117-
#root.destroy()
118-
#sys.exit("No nutexb_cli.exe file")
108+
root.nutexbcliLocation = root.imgnutexbLocation.replace("img2nutexb.exe","nutexb_cli/nutexb_cli.exe")
109+
if not ValidCliExe():
110+
message(type = "Warning",text = "nutexb_cli.exe not found, please select it (this can be skipped)")
111+
ftypes = [
112+
('nutexb_cli program', ["*.exe"])
113+
]
114+
file = filedialog.askopenfile(title = "Search",filetypes = ftypes)
115+
root.nutexbcliLocation = file.name if file else ""
116+
#if selected file is in valid, quit
117+
if (not ValidCliExe()):
118+
config.set("DEFAULT","nutexbcliLocation",defaultLocation)
119+
#message(type = "ERROR",text = "Selected file not valid")
120+
#root.destroy()
121+
#sys.exit("No nutexb_cli.exe file")
119122

120123
#write new location to config
121124
config.set("DEFAULT","img2nutexbLocation",root.imgnutexbLocation)
@@ -242,7 +245,7 @@ def startGUI():
242245

243246
#create cli combo
244247
root.varCli = IntVar(value=(1 if ValidCliExe else 0))
245-
if (ValidCliExe):
248+
if (ValidCliExe()):
246249
root.checkCli = Checkbutton(searchFrame, text='Use nutexb_cli.exe',variable=root.varCli, onvalue=1, offvalue=0)
247250
searchFrame.add(root.checkCli)
248251

@@ -335,8 +338,8 @@ def init(searchDir="",destDir="",currentDir=""):
335338

336339
root.imgnutexbLocation = config["DEFAULT"]["img2nutexbLocation"]
337340
print("imgnutexbLocation: "+root.imgnutexbLocation)
338-
if not "root.maxThreads" in config["DEFAULT"]:
339-
config["DEFAULT"]["root.maxThreads"]="4"
341+
if not "maxThreads" in config["DEFAULT"]:
342+
config["DEFAULT"]["maxThreads"]="4"
340343
with open('config.ini', 'w+') as configfile:
341344
config.write(configfile)
342345
root.maxThreads = int(config["DEFAULT"]["maxThreads"])
@@ -456,6 +459,7 @@ def BatchImg(textures):
456459
subcallTarget.append(targetFile)
457460
subcallNewFile.append(newNutexb)
458461

462+
progressroot.UseCli = UseCli()
459463
if (UseCli()):
460464
useDDSPrompt=False
461465
useDDSOption=False
@@ -467,9 +471,6 @@ def BatchImg(textures):
467471
subcallExtra.append("-u")
468472

469473
root.withdraw()
470-
471-
472-
473474
progressroot.deiconify()
474475

475476
progressroot.queue = Queue(maxsize=0)
@@ -588,7 +589,7 @@ def BatchImgSubCall():
588589
sourceFilePath = subcall[1]
589590
targetFilePath = subcall[2]
590591
convertedDDS = " using nutexb_cli.exe"
591-
if (not UseCli()):
592+
if (not progressroot.UseCli):
592593
sourceFilePath = subcall[2]
593594
targetFilePath = subcall[3]
594595
convertedDDS = " using dds options" if len(subcall)>4 else ""

0 commit comments

Comments
 (0)