-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto fill the selected folder's name in the Name/AppID field #64
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
import json | ||
import os | ||
import subprocess | ||
import re | ||
from sac_lib.get_file_version import GetFileVersion | ||
import shutil | ||
from time import sleep | ||
|
@@ -71,6 +72,7 @@ def DoRequest(self): | |
def select_folder(): | ||
global folder_path | ||
folder_path = filedialog.askdirectory() | ||
folder_name = re.sub(r".*(\\|/)?([^\\]+)(\\|/)", "", folder_path) | ||
if not os.path.isdir(folder_path): | ||
update_logs("\nNo folder has been selected") | ||
selectedFolderLabel.config(text="") | ||
|
@@ -84,8 +86,12 @@ def select_folder(): | |
selectedFolderLabel.config(text=f"Selected folder:\n{folder_path}") | ||
selectedFolderLabel.pack() | ||
frameGame2.pack() | ||
gameNameEntry.delete(0, last=len(gameNameEntry.get())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
gameNameEntry.insert(0, folder_name) | ||
if gameSearchDone: | ||
frameCrack2.pack() | ||
gameNameEntry.delete(0, last=len(gameNameEntry.get())) | ||
gameNameEntry.insert(0, folder_name) | ||
Comment on lines
+93
to
+94
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicate? Doesn't seem required There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you have two cases one of which when the folder already got selected. If the duplicate doesn‘t stay, it wouldn‘t auto-fill in that case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not true? It's not an if else, just a simple if. The delete & insert functions are called BEFORE the IF, so that wouldn't matter There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh shoot true, yeah than nevermind probably wouldn't the whole if clause be useless in this case? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The IF close is meant to re-display the whole "Selected crack:" section if you decide to change the selected directory AFTER doing the App search (select a folder, search for the app, then unselect/change folder); at least from what I remember |
||
|
||
def update_logs(log_message): | ||
# Get current content | ||
|
@@ -936,4 +942,4 @@ def ReloadConfig(): | |
errorFile.write(f"SteamAutoCracker GUI v{VERSION}\n---\nA Python error occurred!\nPlease report it on GitHub or cs.rin.ru\nMake sure to blank any personal detail.\n---\n\n") | ||
traceback.print_exc(file=errorFile) | ||
traceback.print_exc() | ||
print("---\nError written to error.log, please report it on GitHub or cs.rin.ru\nMake sure to blank any personal detail.") | ||
print("---\nError written to error.log, please report it on GitHub or cs.rin.ru\nMake sure to blank any personal detail.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
os.path.basename
would probably be betterThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, regex was more intuitive for me tho
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice regex though haha, I hope it was found only or ChatGPT x)
They're always so hard to make
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, i made it together with https://regex101.com
They're alright when u get used to it