update
This commit is contained in:
@@ -616,7 +616,7 @@ def load_autotext() -> dict:
|
||||
"user_specialty_default": data.get("user_specialty_default", "dermatology"),
|
||||
"user_specialties_selected": data.get("user_specialties_selected", []),
|
||||
"ui_font_delta": int(data.get("ui_font_delta", -2)),
|
||||
"global_right_click_paste": data.get("global_right_click_paste", True),
|
||||
"global_right_click_paste": data.get("global_right_click_paste", False),
|
||||
"todo_auto_open": data.get("todo_auto_open", False),
|
||||
"autocopy_after_diktat": data.get("autocopy_after_diktat", True),
|
||||
"kommentare_auto_open": data.get("kommentare_auto_open", False),
|
||||
@@ -630,6 +630,7 @@ def load_autotext() -> dict:
|
||||
"stilprofil_enabled": data.get("stilprofil_enabled", False),
|
||||
"stilprofil_name": data.get("stilprofil_name", ""),
|
||||
"stilprofil_default_brief": data.get("stilprofil_default_brief", False),
|
||||
"main_window_topmost": bool(data.get("main_window_topmost", True)),
|
||||
}
|
||||
return out
|
||||
except Exception:
|
||||
@@ -668,7 +669,7 @@ def load_autotext() -> dict:
|
||||
"user_specialty_default": "dermatology",
|
||||
"user_specialties_selected": [],
|
||||
"ui_font_delta": -2,
|
||||
"global_right_click_paste": True,
|
||||
"global_right_click_paste": False,
|
||||
"todo_auto_open": False,
|
||||
"autocopy_after_diktat": True,
|
||||
"kommentare_auto_open": False,
|
||||
@@ -678,6 +679,7 @@ def load_autotext() -> dict:
|
||||
"stilprofil_enabled": False,
|
||||
"stilprofil_name": "",
|
||||
"stilprofil_default_brief": False,
|
||||
"main_window_topmost": True,
|
||||
}
|
||||
|
||||
|
||||
@@ -717,7 +719,7 @@ def save_autotext(data: dict) -> None:
|
||||
"user_specialty_default": data.get("user_specialty_default", "dermatology"),
|
||||
"user_specialties_selected": data.get("user_specialties_selected", []),
|
||||
"ui_font_delta": int(data.get("ui_font_delta", -2)),
|
||||
"global_right_click_paste": bool(data.get("global_right_click_paste", True)),
|
||||
"global_right_click_paste": bool(data.get("global_right_click_paste", False)),
|
||||
"todo_auto_open": bool(data.get("todo_auto_open", False)),
|
||||
"autocopy_after_diktat": bool(data.get("autocopy_after_diktat", True)),
|
||||
"kommentare_auto_open": bool(data.get("kommentare_auto_open", False)),
|
||||
@@ -731,6 +733,7 @@ def save_autotext(data: dict) -> None:
|
||||
"stilprofil_enabled": bool(data.get("stilprofil_enabled", False)),
|
||||
"stilprofil_name": data.get("stilprofil_name", ""),
|
||||
"stilprofil_default_brief": bool(data.get("stilprofil_default_brief", False)),
|
||||
"main_window_topmost": bool(data.get("main_window_topmost", True)),
|
||||
},
|
||||
f, ensure_ascii=False, indent=2,
|
||||
)
|
||||
@@ -747,11 +750,16 @@ def is_autocopy_after_diktat_enabled() -> bool:
|
||||
|
||||
|
||||
def is_global_right_click_paste_enabled() -> bool:
|
||||
"""Ob Rechtsklick in externen Apps direkt einfügt (Standard: ja)."""
|
||||
"""Ob Rechtsklick in externen Apps direkt einfügt.
|
||||
|
||||
Standard: aus (False). Wird der Nutzer es in den Arbeitsoptionen
|
||||
aktivieren, wird der Wert gespeichert und beim naechsten Start
|
||||
respektiert.
|
||||
"""
|
||||
try:
|
||||
return bool(load_autotext().get("global_right_click_paste", True))
|
||||
return bool(load_autotext().get("global_right_click_paste", False))
|
||||
except Exception:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def save_autocopy_prefs(autocopy: bool | None = None, global_right_click: bool | None = None) -> None:
|
||||
@@ -767,6 +775,57 @@ def save_autocopy_prefs(autocopy: bool | None = None, global_right_click: bool |
|
||||
pass
|
||||
|
||||
|
||||
# ── Hauptfenster Pin / Always-on-top ─────────────────────────────────────────
|
||||
# Eigener kleiner Settings-Slot in derselben JSON wie der Autotext-Block,
|
||||
# damit kein neues File noetig ist. Wir lesen / schreiben den Schluessel
|
||||
# 'main_window_topmost' direkt auf das geladene Autotext-Dict — save_autotext
|
||||
# behaelt unbekannte Top-Level-Keys NICHT (Whitelist), darum geht der Wert
|
||||
# ueber eine eigene get/set-Routine mit separater raw-JSON-Persistenz.
|
||||
|
||||
def is_main_window_topmost_enabled() -> bool:
|
||||
"""Ob das Tk-Hauptfenster beim Start als topmost (angepinnt) starten soll.
|
||||
|
||||
Standard: True (angepinnt). Benutzer kann ueber die Pin-Nadel im Header
|
||||
umschalten; der neue Wert wird persistiert und beim naechsten Start
|
||||
respektiert.
|
||||
"""
|
||||
try:
|
||||
path = _autotext_config_path()
|
||||
if not os.path.isfile(path):
|
||||
return True
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
raw = json.load(f)
|
||||
if isinstance(raw, dict) and "main_window_topmost" in raw:
|
||||
return bool(raw.get("main_window_topmost"))
|
||||
except Exception:
|
||||
pass
|
||||
return True
|
||||
|
||||
|
||||
def save_main_window_topmost(value: bool) -> None:
|
||||
"""Speichert den Pin-/Topmost-Wunsch fuer das Hauptfenster.
|
||||
|
||||
Schreibt direkt in dieselbe JSON-Datei wie save_autotext, ohne die
|
||||
bestehende Whitelist anzufassen — alle anderen Felder bleiben unangetastet.
|
||||
"""
|
||||
try:
|
||||
path = _autotext_config_path()
|
||||
raw = {}
|
||||
if os.path.isfile(path):
|
||||
try:
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
raw = json.load(f)
|
||||
except Exception:
|
||||
raw = {}
|
||||
if not isinstance(raw, dict):
|
||||
raw = {}
|
||||
raw["main_window_topmost"] = bool(value)
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
json.dump(raw, f, ensure_ascii=False, indent=2)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def _is_admin() -> bool:
|
||||
"""Prüft, ob die Anwendung mit Administratorrechten läuft (für globalen Autotext)."""
|
||||
if sys.platform != "win32":
|
||||
|
||||
Reference in New Issue
Block a user