diff --git a/tasmotonov-gui-config.json b/tasmotonov-gui-config.json deleted file mode 100644 index ff4f70f..0000000 --- a/tasmotonov-gui-config.json +++ /dev/null @@ -1 +0,0 @@ -{"file": "", "inline": "# Dies ist ein Test\n\n# 192.168.30.10\n# \u2191 so ein Kommentar wird auch gespeichert!\n\n192.168.30.68\n192.168.30.69\n192.168.30.70\n192.168.30.71 # Leselampe Benni\n192.168.30.72\n", "action": "toggle"} \ No newline at end of file diff --git a/tasmotonov-gui.py b/tasmotonov-gui.py index 2cd0b49..c3401bf 100755 --- a/tasmotonov-gui.py +++ b/tasmotonov-gui.py @@ -47,6 +47,10 @@ def load_config(file="tasmotonov-gui-config.json"): # load config from configpa a_new = to_load['action'] if a_new != "": action = a_new + if "tab_index" in to_load: + tab_index = to_load["tab_index"] + if type(tab_index) == int and (0 <= tab_index < window.tabWidget.count()): + window.tabWidget.setCurrentIndex(to_load["tab_index"]) except FileNotFoundError: pass # no config there yet @@ -57,6 +61,7 @@ def save_config(file="tasmotonov-gui-config.json"): to_save['file'] = str(filename) to_save['inline'] = str(window.tab2_plainTextEdit.toPlainText()) to_save['action'] = str(action) + to_save['tab_index'] = window.tabWidget.currentIndex() with open(file, 'w') as f: f.write(json.dumps(to_save))