Added line number saving

This commit is contained in:
BlueFox 2025-05-17 23:12:11 +02:00
parent 3999de77d7
commit fff3699efe
2 changed files with 5 additions and 1 deletions

View File

@ -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"}

View File

@ -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))