Skip to content

Commit

Permalink
Merge pull request #2 from RandomByte/fix-create-dir
Browse files Browse the repository at this point in the history
Fix crash on macOS when launching TACL a second time + fix dark theme support
  • Loading branch information
rolait committed Aug 25, 2022
2 parents d17f865 + 4bf527f commit 8e309ff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ __pycache__/

/env/
/download/current

# macOS specific files
.DS_Store
2 changes: 1 addition & 1 deletion src/app/views/components/DatabaseInfoGroupBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):

def _createValueLabel(self) -> QLabel:
label = QLabel()
label.setStyleSheet("background-color: #ffffff; padding: 5px;")
label.setStyleSheet("background-color: #ffffff; color: #000000; padding: 5px;")
label.setTextInteractionFlags(Qt.TextSelectableByMouse )

return label
Expand Down
4 changes: 3 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ def handleException(exctype, value, traceback):
# Determine the base path

if sys.platform == 'darwin':
# On macOS: Use "~/Library/Application Support/TACL" instead of the current working directory to comply with macOS Sandbox restrictions
from AppKit import NSSearchPathForDirectoriesInDomains, NSApplicationSupportDirectory, NSUserDomainMask
# http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html#//apple_ref/c/func/NSSearchPathForDirectoriesInDomains
# Last parameter 'True' for expanding the tilde into a fully qualified path
baseDir = os.path.join(NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, True)[0], "TACL")
os.makedirs(baseDir, exist_ok=False)
# Create the directory if it does not exist yet
os.makedirs(baseDir, exist_ok=True)
elif getattr(sys, 'frozen', False) and sys.executable:
baseDir = os.path.dirname(sys.executable)
else:
Expand Down

0 comments on commit 8e309ff

Please sign in to comment.