From 08a967a1823ce3d34254ada4586150ad2848fb47 Mon Sep 17 00:00:00 2001 From: Blahpr Date: Wed, 25 Sep 2024 09:40:36 -0700 Subject: [PATCH] Add files via upload --- D.pyw | 27 +++++++++++++++++++++++---- Setup.bat | 3 ++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/D.pyw b/D.pyw index f8c520a..403a4a2 100644 --- a/D.pyw +++ b/D.pyw @@ -399,33 +399,52 @@ class FileOrganizerApp: def simplify_name(self, filename, options): name, ext = os.path.splitext(filename) + + # Remove special characters if the option is enabled if options['remove_special']: name = re.sub(r'[^\w\s.-]', '', name) + + # Replace underscores with spaces if the option is enabled if options['replace_underscore']: name = name.replace('_', ' ') + + # Replace dots, but preserve dots within numbers (e.g., version numbers) if options['replace_dot']: - # Keep periods within numbers, replace only other periods - name = re.sub(r'(? "Plus 26") + name = re.sub(r'(?<=[a-zA-Z])\.(?=\d)', ' ', name) # Handles "Plus.26" -> "Plus 26" + name = re.sub(r'(?<=\d)\.(?=[a-zA-Z])', ' ', name) # Handles dots between numbers and letters + name = re.sub(r'(? "360 Utility") if options['replace_dot']: name = re.sub(r'\.(?=[A-Za-z])', ' ', name) + # Replace hyphens and other separators with spaces if options['remove_hyphen']: name = re.sub(r'[^\w\s\.]', ' ', name) + # Remove extra spaces (redundant, but ensures clean output) if options['remove_double_spaces']: name = re.sub(r'\s+', ' ', name) + # Return the modified name along with the original file extension return f"{name.strip()}{ext}" def load_data(self): diff --git a/Setup.bat b/Setup.bat index 647c883..c4f67f7 100644 --- a/Setup.bat +++ b/Setup.bat @@ -1,4 +1,5 @@ @echo off -pyinstaller --onefile --icon=images\D.ico --name="Text Right v1.0" --distpath="Text Right v1.0" --add-data="images;images" --add-data "C:\Users\Bobzer\AppData\Local\Programs\Python\Python312\Lib\site-packages\tkdnd\tkdnd\win64;tkdnd" --upx-dir "C:\upx-4.2.4-win64" D.pyw +pyinstaller --onefile --icon=images\D.ico --name="Text Right v1.0" --distpath="Text Right v1.0" --add-data="images;images" --add-data "C:\Users\Bobzer\AppData\Local\Programs\Python\Python312\Lib\site-packages\tkdnd\tkdnd\win64;tkdnd" --upx-dir "C:\upx-4.2.4-win64" D.pyw +"C:\upx-4.2.4-win64\upx.exe" --brute --force "Text Right v1.0\Text Right v1.0.exe" echo. pause.