v2.2.0: style reasoning switch green=ON, orange=OFF with gentle rounded look
This commit is contained in:
@@ -1430,10 +1430,41 @@ class EditEndpointDialog(Gtk.Dialog):
|
||||
self._entry_cc_ver.set_placeholder_text("e.g. 0.26.8 (Command Code only)")
|
||||
add_row(5, "CC Version:", self._entry_cc_ver)
|
||||
|
||||
reasoning_css = """
|
||||
switch.reasoning-toggle {
|
||||
min-width: 56px; min-height: 28px;
|
||||
border-radius: 14px;
|
||||
background: #e67e22;
|
||||
border: 2px solid #cf6d17;
|
||||
padding: 0;
|
||||
}
|
||||
switch.reasoning-toggle:checked {
|
||||
background: #2ecc71;
|
||||
border: 2px solid #27ae60;
|
||||
}
|
||||
switch.reasoning-toggle slider {
|
||||
min-width: 24px; min-height: 24px;
|
||||
border-radius: 12px;
|
||||
background: white;
|
||||
border: 1px solid #bbb;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
|
||||
}
|
||||
"""
|
||||
css_provider = Gtk.CssProvider()
|
||||
css_provider.load_from_data(reasoning_css.encode())
|
||||
reasoning_style = Gtk.StyleContext()
|
||||
reasoning_style.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
|
||||
|
||||
reasoning_box = Gtk.Box(spacing=10)
|
||||
self._switch_reasoning = Gtk.Switch()
|
||||
self._switch_reasoning.set_name("reasoning-toggle")
|
||||
reasoning_style.add_class(self._switch_reasoning.get_style_context(), "reasoning-toggle")
|
||||
self._switch_reasoning.set_active(self._data.get("reasoning_enabled", True))
|
||||
self._switch_reasoning.connect("notify::active", lambda *a: self._on_reasoning_toggled())
|
||||
add_row(6, "Reasoning:", self._switch_reasoning)
|
||||
reasoning_box.pack_start(self._switch_reasoning, False, False, 0)
|
||||
self._lbl_reasoning = Gtk.Label()
|
||||
reasoning_box.pack_start(self._lbl_reasoning, False, False, 0)
|
||||
add_row(6, "Reasoning:", reasoning_box)
|
||||
|
||||
self._combo_effort = Gtk.ComboBoxText()
|
||||
for ev, el in [("none", "None"), ("minimal", "Minimal"), ("low", "Low"),
|
||||
@@ -1550,6 +1581,10 @@ class EditEndpointDialog(Gtk.Dialog):
|
||||
def _on_reasoning_toggled(self, *_):
|
||||
active = self._switch_reasoning.get_active()
|
||||
self._combo_effort.set_sensitive(active)
|
||||
if active:
|
||||
self._lbl_reasoning.set_markup('<span foreground="#27ae60" weight="bold">ON</span>')
|
||||
else:
|
||||
self._lbl_reasoning.set_markup('<span foreground="#e67e22" weight="bold">OFF</span>')
|
||||
|
||||
def _remove_model(self, path):
|
||||
current = self._combo_default.get_active_text()
|
||||
|
||||
Reference in New Issue
Block a user