Skip to content

Commit d93cb74

Browse files
committed
displays hb as scrollable list
1 parent f3be82b commit d93cb74

File tree

1 file changed

+34
-11
lines changed

1 file changed

+34
-11
lines changed

main.py

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import tkinter
88
from tkinter import messagebox
99
from tkinter import filedialog
10+
import tkinter.ttk
1011
import os
1112
import platform
1213
import sys
@@ -87,7 +88,12 @@ def un7zipper(_7za, zipfile, destination):
8788

8889

8990
def start():
90-
outputBox.delete(0, tkinter.END)
91+
92+
#Clear outputBox
93+
outputBox.configure(state='normal')
94+
outputBox.delete('1.0', tkinter.END)
95+
outputBox.configure(state='disabled')
96+
9197
sysname = platform.system()
9298
#Locate 7z binary
9399
_7za = os.path.join(sysname, '7za')
@@ -127,10 +133,7 @@ def start():
127133
return
128134
print("7-Zip found!")
129135

130-
#Clear outputBox
131-
outputBox.configure(state='normal')
132-
outputBox.delete('1.0', tkinter.END)
133-
outputBox.configure(state='disabled')
136+
134137

135138
#Variables
136139
directory = SDentry.get()
@@ -182,6 +185,9 @@ def start():
182185
shutil.copy(cwdtemp + "DSi&3DS - SD card users/_nds/nds-bootstrap-hb-nightly.nds", directory + "/_nds")
183186
shutil.copy(cwdtemp + "DSi&3DS - SD card users/_nds/nds-bootstrap-hb-release.nds", directory + "/_nds")
184187
Path(directory + "/roms/").mkdir(parents=True,exist_ok=True)
188+
#Some Homebrew write to the _nds folder so it is better to clear it first
189+
shutil.rmtree(cwdtemp +"_nds/")
190+
Path(cwdtemp +"_nds/").mkdir(parents=True,exist_ok=True)
185191

186192
print("TWiLight Menu ++ placed in", directory)
187193
outputbox("TWiLight Menu ++ placed ")
@@ -208,9 +214,7 @@ def start():
208214
#Extract Unlaunch
209215
unzipper(unlaunchLocation,directory)
210216

211-
#Some Homebrew write to the _nds folder so it is better to clear it first
212-
shutil.rmtree(cwdtemp +"_nds/")
213-
Path(cwdtemp +"_nds/").mkdir(parents=True,exist_ok=True)
217+
214218

215219
#Creates roms/nds if it does not exist
216220
roms = directory +"/roms/nds/"
@@ -240,7 +244,8 @@ def start():
240244
else:
241245
un7zipper(_7za, downloadLocation, cwdtemp)
242246
if "root" in item["location"]:
243-
distutils.dir_util.copy_tree(cwdtemp+item["location"]["root"],directory+"/"+item["location"]["root"])
247+
Path(directory+(item["location"]["root"].split('/')).pop()).mkdir(parents=True,exist_ok=True)
248+
shutil.copy(cwdtemp+item["location"]["root"],directory+((item["location"]["root"].split('/')).pop().pop(0)))
244249
if "roms" in item["location"]:
245250
shutil.copy(cwdtemp+item["location"]["roms"],roms)
246251

@@ -271,13 +276,31 @@ def extraHomebrew():
271276
homebrewWindowLabel2 = tkinter.Label(homebrewWindow, text="Select additional homebrew for download then press OK")
272277
homebrewWindowLabel2.pack(anchor = "w")
273278

279+
vscrollbar = tkinter.Scrollbar(homebrewWindow)
280+
canvas = tkinter.Canvas(homebrewWindow, yscrollcommand=vscrollbar.set)
281+
vscrollbar.config(command=canvas.yview)
282+
vscrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y)
283+
284+
homebrewFrame = tkinter.Frame(canvas)
285+
homebrewWindow.title("Homebrew List")
286+
homebrewWindow.resizable(0,0)
287+
canvas.pack(side="left", fill="both", expand=True)
288+
canvas.create_window(0,0, window=homebrewFrame, anchor="n")
274289
for count, x in enumerate(homebrewDB):
275-
l = tkinter.Checkbutton(homebrewWindow, text=x["title"], variable=homebrewList[count])
290+
l = tkinter.Checkbutton(homebrewFrame, text=x["title"] + " by " + x["author"], variable=homebrewList[count])
276291
l.pack(anchor = "w")
292+
293+
frame = tkinter.ttk.Frame(homebrewWindow, relief=tkinter.RAISED, borderwidth=1)
294+
frame.pack(fill=tkinter.BOTH, expand=True)
277295

278296
okButton = tkinter.Button(homebrewWindow, text = "OK", font=("Verdana",12,"bold"), command=lambda:okButtonPress(homebrewWindow))
279-
okButton.pack()
297+
okButton.pack(side=tkinter.RIGHT, padx=5, pady=5)
298+
homebrewWindow.update()
299+
canvas.config(scrollregion=canvas.bbox("all"))
300+
280301
homebrewWindow.protocol("WM_DELETE_WINDOW",lambda:okButtonPress(homebrewWindow))
302+
303+
281304

282305

283306
if(sys.version_info.major < 3):

0 commit comments

Comments
 (0)