Prompt Enhancer: clean ON/OFF toggle with green/grey status labels
This commit is contained in:
Binary file not shown.
@@ -3507,13 +3507,16 @@ class EditEndpointDialog(Gtk.Dialog):
|
||||
self._switch_enhancer = Gtk.Switch()
|
||||
self._switch_enhancer.set_active(self._data.get("prompt_enhancer", False))
|
||||
enhancer_box.pack_start(self._switch_enhancer, False, False, 0)
|
||||
enhancer_box.pack_start(Gtk.Label(label="Prompt Enhancer"), False, False, 0)
|
||||
self._enhancer_status_lbl = Gtk.Label()
|
||||
enhancer_box.pack_start(self._enhancer_status_lbl, False, False, 0)
|
||||
self._switch_enhancer.connect("notify::active", lambda *a: self._on_enhancer_toggled())
|
||||
self._combo_enhancer_mode = Gtk.ComboBoxText()
|
||||
for mode in ["offline", "ai-powered"]:
|
||||
self._combo_enhancer_mode.append(mode, mode.capitalize())
|
||||
self._combo_enhancer_mode.set_active_id(self._data.get("prompt_enhancer_mode", "offline"))
|
||||
enhancer_box.pack_start(self._combo_enhancer_mode, False, False, 6)
|
||||
add_row(8, "Enhance:", enhancer_box)
|
||||
add_row(8, "Prompt Enhancer:", enhancer_box)
|
||||
self._on_enhancer_toggled()
|
||||
|
||||
self._entry_enhancer_model = Gtk.Entry()
|
||||
self._entry_enhancer_model.set_placeholder_text("e.g. deepseek/deepseek-v4-flash (ai-powered mode only)")
|
||||
@@ -3671,6 +3674,13 @@ class EditEndpointDialog(Gtk.Dialog):
|
||||
else:
|
||||
self._lbl_reasoning.set_markup('<span foreground="#e67e22" weight="bold">OFF</span>')
|
||||
|
||||
def _on_enhancer_toggled(self, *_):
|
||||
active = self._switch_enhancer.get_active()
|
||||
if active:
|
||||
self._enhancer_status_lbl.set_markup('<span foreground="#27ae60" weight="bold">ON</span>')
|
||||
else:
|
||||
self._enhancer_status_lbl.set_markup('<span foreground="#888888" weight="bold">OFF</span>')
|
||||
|
||||
def _do_oauth_login(self):
|
||||
preset_name = self._combo_preset.get_active_text() or "Custom"
|
||||
preset = PROVIDER_PRESETS.get(preset_name, {})
|
||||
|
||||
@@ -227,11 +227,15 @@ class EditEndpointDialog:
|
||||
|
||||
enhancer_frame = ttk.Frame(grid)
|
||||
self._enhancer_var = tk.BooleanVar(value=self._data.get("prompt_enhancer", False))
|
||||
ttk.Checkbutton(enhancer_frame, text="Prompt Enhancer", variable=self._enhancer_var).pack(side="left")
|
||||
self._enhancer_cb = ttk.Checkbutton(enhancer_frame, text="Prompt Enhancer", variable=self._enhancer_var, command=self._on_enhancer_toggled)
|
||||
self._enhancer_cb.pack(side="left")
|
||||
self._enhancer_status_lbl = ttk.Label(enhancer_frame, text="", foreground="gray")
|
||||
self._enhancer_status_lbl.pack(side="left", padx=(6, 0))
|
||||
self._enhancer_mode = ttk.Combobox(enhancer_frame, values=["offline", "ai-powered"], state="readonly", width=10)
|
||||
self._enhancer_mode.set(self._data.get("prompt_enhancer_mode", "offline"))
|
||||
self._enhancer_mode.pack(side="left", padx=(8, 0))
|
||||
add_field("Enhancer:", lambda: enhancer_frame)
|
||||
add_field("Prompt Enhancer:", lambda: enhancer_frame)
|
||||
self._on_enhancer_toggled()
|
||||
|
||||
self._entry_enhancer_model = ttk.Entry(grid)
|
||||
self._entry_enhancer_model.insert(0, self._data.get("prompt_enhancer_model", ""))
|
||||
@@ -295,6 +299,12 @@ class EditEndpointDialog:
|
||||
state = "readonly" if self._reason_var.get() else "disabled"
|
||||
self._combo_effort.configure(state=state)
|
||||
|
||||
def _on_enhancer_toggled(self):
|
||||
if self._enhancer_var.get():
|
||||
self._enhancer_status_lbl.configure(text="ON", foreground="#2ea043")
|
||||
else:
|
||||
self._enhancer_status_lbl.configure(text="OFF", foreground="#888888")
|
||||
|
||||
def _apply_selected_preset(self, initial=False):
|
||||
preset_name = self._combo_preset.get() or "Custom"
|
||||
preset = PROVIDER_PRESETS.get(preset_name, {})
|
||||
|
||||
Reference in New Issue
Block a user