feat(settings): support gateway source switching
This commit is contained in:
@@ -109,6 +109,9 @@ class MainWindow(QMainWindow):
|
||||
self.tabs.currentChanged.connect(self._on_tab_changed)
|
||||
for title in TAB_TITLES:
|
||||
self.tabs.addTab(self._build_tab(title), title)
|
||||
settings_tab = self._settings_tab()
|
||||
if hasattr(settings_tab, "settingsSaved"):
|
||||
settings_tab.settingsSaved.connect(self._on_settings_saved)
|
||||
self.setCentralWidget(self.tabs)
|
||||
self.show_status("就绪", level="muted")
|
||||
if startup_status:
|
||||
@@ -182,6 +185,14 @@ class MainWindow(QMainWindow):
|
||||
if hasattr(widget, "refresh_tasks"):
|
||||
widget.refresh_tasks()
|
||||
|
||||
def _on_settings_saved(self, backend):
|
||||
for index in range(self.tabs.count()):
|
||||
widget = self.tabs.widget(index)
|
||||
if hasattr(widget, "refresh_gateway_state"):
|
||||
widget.refresh_gateway_state()
|
||||
label = "自定义网关" if str(backend) == "direct" else "默认网关"
|
||||
self.show_status("设置已保存,当前使用%s" % label, level="success")
|
||||
|
||||
def _on_tab_changed(self, index):
|
||||
if self._reverting_tab_change:
|
||||
self._last_tab_index = index
|
||||
|
||||
Reference in New Issue
Block a user