mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 22:52:42 +01:00
feat: simplify API udpate signals
This commit is contained in:
1 parent
dfd6850d6d
commit
69cba3460d
3 files changed
+12
-7
No files matched your search
@@ -145,6 +145,10 @@ class Emitter(GObject.GObject):
|
|||||||
def api_change_failed(self) -> None:
|
def api_change_failed(self) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||||
|
def api_change_successful(self) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||||
def already_saved_server(self) -> None:
|
def already_saved_server(self) -> None:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -301,8 +301,8 @@ class Controller(GObject.GObject):
|
|||||||
dialog = ExceptionDialog(self, str(e))
|
dialog = ExceptionDialog(self, str(e))
|
||||||
dialog.run()
|
dialog.run()
|
||||||
|
|
||||||
def update_api_key(self, key: Preferences, text: str) -> None:
|
def update_steam_api_key(self, text: str) -> None:
|
||||||
self.config_man.update_api_key(key, text)
|
self.config_man.update_steam_api_key(text)
|
||||||
|
|
||||||
def set_resolution(self, window: "OuterWindow") -> None:
|
def set_resolution(self, window: "OuterWindow") -> None:
|
||||||
self.config_man.set_resolution(window)
|
self.config_man.set_resolution(window)
|
||||||
|
|||||||
@@ -98,12 +98,13 @@ class ConfigManager:
|
|||||||
logger.critical(e)
|
logger.critical(e)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
@call_on_thread(dialogs.checking_api)
|
@call_on_thread(dialogs.checking_api, show_dialog=False)
|
||||||
def update_api_key(self, key: Preferences, text: str) -> None:
|
def update_steam_api_key(self, text: str) -> None:
|
||||||
if key is Preferences.STEAM:
|
res = test_steam_api(text)
|
||||||
res = test_steam_api(text)
|
|
||||||
if res is True:
|
if res is True:
|
||||||
self.update_config(key, text)
|
self.update_config(Preferences.STEAM, text)
|
||||||
|
func = StoredFunc(lambda: self.emitter.emit("api_change_successful"))
|
||||||
|
self.thread_man.set_cleanup_func(func)
|
||||||
else:
|
else:
|
||||||
self.thread_man.set_cleanup_func(
|
self.thread_man.set_cleanup_func(
|
||||||
StoredFunc(lambda: self.emitter.emit("api_change_failed"))
|
StoredFunc(lambda: self.emitter.emit("api_change_failed"))
|
||||||
|
|||||||
Reference in new issue
Block a user