Update ts_qt.py to not throw Errors when no library is open

Before this the Refresh/Save Library/Save Library Backup would throw an Error when no Library is open
This commit is contained in:
Theasacraft 2024-04-24 00:53:41 +02:00 committed by GitHub
parent f67b26fbd6
commit 1489d56be7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3791,6 +3791,8 @@ class QtDriver(QObject):
def save_library(self):
if not self.lib.library_dir:
return
logging.info(f'Saving Library...')
self.main_window.statusbar.showMessage(f'Saving Library...')
start_time = time.time()
@ -3799,6 +3801,8 @@ class QtDriver(QObject):
self.main_window.statusbar.showMessage(f'Library Saved! ({format_timespan(end_time - start_time)})')
def backup_library(self):
if not self.lib.library_dir:
return
logging.info(f'Backing Up Library...')
self.main_window.statusbar.showMessage(f'Saving Library...')
start_time = time.time()
@ -3807,6 +3811,8 @@ class QtDriver(QObject):
self.main_window.statusbar.showMessage(f'Library Backup Saved at: "{os.path.normpath(os.path.normpath(f"{self.lib.library_dir}/{TS_FOLDER_NAME}/{BACKUP_FOLDER_NAME}/{fn}"))}" ({format_timespan(end_time - start_time)})')
def add_tag_action_callback(self):
if not self.lib.library_dir:
return
self.modal = PanelModal(BuildTagPanel(self.lib),
'New Tag',
'Add Tag',