Fix a few issues related to opening settings and quitting

This commit is contained in:
Micah Lee 2019-10-27 16:36:32 -07:00
parent a14464d834
commit f4e3f92c7b
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
3 changed files with 13 additions and 13 deletions

View File

@ -237,14 +237,10 @@ class MainWindow(QtWidgets.QMainWindow):
self.website_mode.server_status.autostart_timer_container.hide()
d = SettingsDialog(self.common)
d.settings_saved.connect(reload_settings)
# d.settings_saved.connect(reload_settings)
# TODO: move the reload_settings logic into tabs
d.exec_()
# When settings close, refresh the server status UI
self.share_mode.server_status.update()
self.receive_mode.server_status.update()
self.website_mode.server_status.update()
def check_for_updates(self):
"""
Check for updates in a new thread, if enabled.

View File

@ -496,12 +496,15 @@ class Tab(QtWidgets.QWidget):
self.status_bar.clearMessage()
def get_mode(self):
if self.mode == self.common.gui.MODE_SHARE:
return self.share_mode
elif self.mode == self.common.gui.MODE_RECEIVE:
return self.receive_mode
if self.mode:
if self.mode == self.common.gui.MODE_SHARE:
return self.share_mode
elif self.mode == self.common.gui.MODE_RECEIVE:
return self.receive_mode
else:
return self.website_mode
else:
return self.website_mode
return None
def persistence_button_clicked(self):
self.common.log("Tab", "persistence_button_clicked")

View File

@ -127,8 +127,9 @@ class TabWidget(QtWidgets.QTabWidget):
"""
for tab_id in self.tabs:
mode = self.tabs[tab_id].get_mode()
if mode.server_status.status != mode.server_status.STATUS_STOPPED:
return True
if mode:
if mode.server_status.status != mode.server_status.STATUS_STOPPED:
return True
return False
def resizeEvent(self, event):