Updated the way it shows files

- Updated the sorting to be 1,2,3,4,5,6,7,8,9,10,11 instead of 1,10,11,2,3,4,5,6,7,8,9
- Made it so it doesn't show _backup files.
This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2023-06-26 19:34:44 +00:00
parent d30a1dcb62
commit 914f4c5748

View file

@ -22,6 +22,7 @@ from project_manager import pm_project
#UI modules #UI modules
from UI import UI_elements from UI import UI_elements
from UI import UI_color from UI import UI_color
from UI import UI_math
# Studio # Studio
from studio import checklist from studio import checklist
@ -82,10 +83,13 @@ def layer(win, call):
if "AllFiles" not in win.current: if "AllFiles" not in win.current:
win.current["AllFiles"] = [] win.current["AllFiles"] = []
for r, d, f in sorted(os.walk(win.project)): for r, d, f in os.walk(win.project):
for item in f: for item in f:
win.current["AllFiles"].append(os.path.join(r, item).replace(win.project, "")) win.current["AllFiles"].append(os.path.join(r, item).replace(win.project, ""))
UI_math.sort_nicely(win.current["AllFiles"])
# Now that we have the files. There should be some way to filter them. # Now that we have the files. There should be some way to filter them.
# I guess let's add a searchbox and buttons on the side for filtering. # I guess let's add a searchbox and buttons on the side for filtering.
@ -223,12 +227,17 @@ def layer(win, call):
win.scroll["file_select"] = 0 win.scroll["file_select"] = 0
if "AllFiles" in win.current: if "AllFiles" in win.current:
for filename in win.current["AllFiles"]: for filename in reversed(win.current["AllFiles"]):
######################## FILTERING STARTS ########################## ######################## FILTERING STARTS ##########################
okay = True okay = True
# Remove all _backup files
if "_backup" in filename:
okay = False
# By search # By search
for stuff in win.text["file_select_search"]["text"].split(" "): for stuff in win.text["file_select_search"]["text"].split(" "):