1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2025-01-03 05:36:19 +00:00

Reduce memory usage by removing main window from memory when closed. Fixes #207 (#208)

This commit is contained in:
Manuel Riel 2019-03-04 22:49:20 +08:00 committed by GitHub
parent b6f27a08dd
commit b115aef19b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View file

@ -50,9 +50,8 @@ def __init__(self, args_raw, single_app=False):
self.setQuitOnLastWindowClosed(False) self.setQuitOnLastWindowClosed(False)
self.scheduler = VortaScheduler(self) self.scheduler = VortaScheduler(self)
# Prepare tray and main window # Prepare system tray icon
self.tray = TrayMenu(self) self.tray = TrayMenu(self)
self.main_window = MainWindow(self)
# Apply dark stylesheet # Apply dark stylesheet
if SettingsModel.get(key='use_dark_theme').value: if SettingsModel.get(key='use_dark_theme').value:
@ -60,7 +59,7 @@ def __init__(self, args_raw, single_app=False):
args = parse_args() args = parse_args()
if hasattr(args, 'foreground') and args.foreground: if hasattr(args, 'foreground') and args.foreground:
self.main_window.show() self.open_main_window_action()
self.backup_started_event.connect(self.backup_started_event_response) self.backup_started_event.connect(self.backup_started_event_response)
self.backup_finished_event.connect(self.backup_finished_event_response) self.backup_finished_event.connect(self.backup_finished_event_response)
@ -79,6 +78,7 @@ def create_backup_action(self, profile_id=None):
self.backup_log_event.emit(translate('messages', msg['message'])) self.backup_log_event.emit(translate('messages', msg['message']))
def open_main_window_action(self): def open_main_window_action(self):
self.main_window = MainWindow(self)
self.main_window.show() self.main_window.show()
self.main_window.raise_() self.main_window.raise_()
@ -93,7 +93,6 @@ def backup_started_event_response(self):
def backup_finished_event_response(self): def backup_finished_event_response(self):
set_tray_icon(self.tray) set_tray_icon(self.tray)
self.main_window.scheduleTab._draw_next_scheduled_backup()
def backup_cancelled_event_response(self): def backup_cancelled_event_response(self):
set_tray_icon(self.tray) set_tray_icon(self.tray)

View file

@ -23,6 +23,7 @@ def __init__(self, parent=None):
super().__init__() super().__init__()
self.setupUi(self) self.setupUi(self)
self.setWindowTitle('Vorta for Borg Backup') self.setWindowTitle('Vorta for Borg Backup')
self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
self.app = parent self.app = parent
self.current_profile = BackupProfileModel.select().order_by('id').first() self.current_profile = BackupProfileModel.select().order_by('id').first()
self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMinimizeButtonHint) self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMinimizeButtonHint)

View file

@ -32,7 +32,7 @@ def app(tmpdir, qtbot):
source_dir.save() source_dir.save()
app = VortaApp([]) app = VortaApp([])
app.main_window.show() app.open_main_window_action()
qtbot.addWidget(app.main_window) qtbot.addWidget(app.main_window)
return app return app