refactor: enhance TimerPage layout and functionality; update theme and tokens for improved design consistency
- Refactored TimerPage component to improve layout and user experience. - Updated theme configuration to utilize design tokens for better maintainability. - Introduced new tokens for colors and typography to align with design principles. - Simplified state management and improved timer functionality. - Enhanced accessibility and responsiveness of UI elements.
This commit is contained in:
84 files changed
+4501
-2682
No files matched your search
@@ -82,6 +82,9 @@ class Tray(QObject):
|
||||
controller.stateChanged.connect(self.refresh)
|
||||
controller.connectionChanged.connect(self.refresh)
|
||||
controller.blockerChanged.connect(self.refresh)
|
||||
controller.miniChanged.connect(self.refresh)
|
||||
controller.settingsChanged.connect(self.refresh)
|
||||
controller.configChanged.connect(self.refresh)
|
||||
self.refresh()
|
||||
|
||||
def show(self) -> None:
|
||||
@@ -140,6 +143,18 @@ class Tray(QObject):
|
||||
self._menu.addAction(refresh)
|
||||
|
||||
self._menu.addSeparator()
|
||||
self._action_mini = QAction("Mini timer", self._menu)
|
||||
self._action_mini.setCheckable(True)
|
||||
self._action_mini.triggered.connect(lambda: controller.toggleMini())
|
||||
self._menu.addAction(self._action_mini)
|
||||
|
||||
self._action_view_mode = QAction("View-only mode (timer off)", self._menu)
|
||||
self._action_view_mode.setCheckable(True)
|
||||
self._action_view_mode.triggered.connect(
|
||||
lambda: controller.setTimerEnabled(not controller.timerEnabled)
|
||||
)
|
||||
self._menu.addAction(self._action_view_mode)
|
||||
|
||||
show = QAction("Open Kadence", self._menu)
|
||||
show.triggered.connect(self.showRequested.emit)
|
||||
self._menu.addAction(show)
|
||||
@@ -157,22 +172,32 @@ class Tray(QObject):
|
||||
controller = self._controller
|
||||
running = controller.running
|
||||
paused = controller.status == "paused"
|
||||
timer_enabled = controller.timerEnabled
|
||||
|
||||
self._icon.setIcon(
|
||||
render_icon(controller.progress, controller.kind, running, controller.connected, paused)
|
||||
render_icon(
|
||||
controller.progress,
|
||||
controller.kind,
|
||||
running if timer_enabled else False,
|
||||
controller.connected,
|
||||
paused if timer_enabled else False,
|
||||
)
|
||||
)
|
||||
status = controller.statusLine()
|
||||
blocker = " · 🛡 blocking" if controller.blockerActive else ""
|
||||
self._icon.setToolTip(f"{status}{blocker}")
|
||||
self._action_status.setText(status)
|
||||
|
||||
self._action_start.setVisible(not running)
|
||||
self._action_break.setVisible(not running)
|
||||
self._action_pause.setVisible(running and not paused)
|
||||
self._action_resume.setVisible(running and paused)
|
||||
self._action_done.setVisible(running)
|
||||
self._action_extend.setVisible(running)
|
||||
self._action_abandon.setVisible(running)
|
||||
self._action_start.setVisible(timer_enabled and not running)
|
||||
self._action_break.setVisible(timer_enabled and not running)
|
||||
self._action_pause.setVisible(timer_enabled and running and not paused)
|
||||
self._action_resume.setVisible(timer_enabled and running and paused)
|
||||
self._action_done.setVisible(timer_enabled and running)
|
||||
self._action_extend.setVisible(timer_enabled and running)
|
||||
self._action_abandon.setVisible(timer_enabled and running)
|
||||
self._action_mini.setVisible(timer_enabled)
|
||||
self._action_mini.setChecked(controller.miniVisible)
|
||||
self._action_view_mode.setChecked(not timer_enabled)
|
||||
|
||||
def _on_activated(self, reason: QSystemTrayIcon.ActivationReason) -> None:
|
||||
# Left click toggles the window; middle click toggles the timer, which is
|
||||
|
||||
Reference in new issue
Block a user