aline-ai 0.7.1__py3-none-any.whl → 0.7.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,7 @@ from textual.containers import Horizontal
7
7
  from textual.widgets import Button, RadioButton, RadioSet, Static
8
8
 
9
9
  from ..tmux_manager import _run_outer_tmux
10
+ from ..state import get_dashboard_state_value, set_dashboard_state_value
10
11
  from ...auth import (
11
12
  load_credentials,
12
13
  save_credentials,
@@ -113,6 +114,30 @@ class ConfigPanel(Static):
113
114
  width: auto;
114
115
  margin-right: 2;
115
116
  }
117
+
118
+ ConfigPanel .appearance-settings {
119
+ height: auto;
120
+ margin-top: 2;
121
+ }
122
+
123
+ ConfigPanel .appearance-settings .setting-row {
124
+ height: auto;
125
+ }
126
+
127
+ ConfigPanel .appearance-settings .setting-label {
128
+ width: auto;
129
+ }
130
+
131
+ ConfigPanel .appearance-settings RadioSet {
132
+ width: auto;
133
+ height: auto;
134
+ layout: horizontal;
135
+ }
136
+
137
+ ConfigPanel .appearance-settings RadioButton {
138
+ width: auto;
139
+ margin-right: 2;
140
+ }
116
141
  """
117
142
 
118
143
  def __init__(self) -> None:
@@ -131,6 +156,15 @@ class ConfigPanel(Static):
131
156
  yield Static(id="account-email", classes="account-email")
132
157
  yield Button("Login", id="auth-btn", variant="primary")
133
158
 
159
+ # Appearance settings section
160
+ with Static(classes="appearance-settings"):
161
+ yield Static("[bold]Appearance[/bold]", classes="section-title")
162
+ with Horizontal(classes="setting-row"):
163
+ yield Static("Theme:", classes="setting-label")
164
+ with RadioSet(id="theme-radio"):
165
+ yield RadioButton("Dark", id="theme-dark", value=True)
166
+ yield RadioButton("Light", id="theme-light")
167
+
134
168
  # Tmux settings section
135
169
  with Static(classes="tmux-settings"):
136
170
  yield Static("[bold]Tmux Settings[/bold]", classes="section-title")
@@ -160,6 +194,9 @@ class ConfigPanel(Static):
160
194
  # Update account status display
161
195
  self._update_account_status()
162
196
 
197
+ # Sync theme from persisted preference
198
+ self._sync_theme_radio()
199
+
163
200
  # Query and set the actual tmux border resize state
164
201
  self._sync_border_resize_radio()
165
202
 
@@ -184,7 +221,10 @@ class ConfigPanel(Static):
184
221
  """Handle radio set change events."""
185
222
  if self._syncing_radio:
186
223
  return # Ignore events during sync
187
- if event.radio_set.id == "border-resize-radio":
224
+ if event.radio_set.id == "theme-radio":
225
+ theme = "dark" if event.pressed.id == "theme-dark" else "light"
226
+ self._set_theme(theme)
227
+ elif event.radio_set.id == "border-resize-radio":
188
228
  # Check which radio button is selected
189
229
  enabled = event.pressed.id == "border-resize-enabled"
190
230
  self._toggle_border_resize(enabled)
@@ -313,6 +353,28 @@ class ConfigPanel(Static):
313
353
  else:
314
354
  self.app.notify("Failed to logout", title="Account", severity="error")
315
355
 
356
+ def _sync_theme_radio(self) -> None:
357
+ """Sync theme radio buttons with persisted dashboard preference."""
358
+ try:
359
+ theme = str(get_dashboard_state_value("theme", "dark")).strip().lower()
360
+ self._syncing_radio = True
361
+ try:
362
+ if theme == "light":
363
+ radio = self.query_one("#theme-light", RadioButton)
364
+ else:
365
+ radio = self.query_one("#theme-dark", RadioButton)
366
+ radio.value = True
367
+ finally:
368
+ self._syncing_radio = False
369
+ except Exception:
370
+ pass
371
+
372
+ def _set_theme(self, theme: str) -> None:
373
+ theme_value = "light" if theme.strip().lower() == "light" else "dark"
374
+ set_dashboard_state_value("theme", theme_value)
375
+ self.app.theme = "textual-light" if theme_value == "light" else "textual-dark"
376
+ self.app.notify(f"Theme set to {theme_value}", title="Appearance")
377
+
316
378
  def _sync_border_resize_radio(self) -> None:
317
379
  """Query tmux state and sync the radio buttons to match."""
318
380
  try: