From c1156d29ad00c0c264b2962348fb3561113d0bbf Mon Sep 17 00:00:00 2001 From: Glyph Date: Thu, 11 Jul 2024 14:58:23 -0700 Subject: [PATCH] finish implementation of left-circle overlay view fixes #60 fixes #61 This commit was sponsored by Jason Mills, James C Abel, Steven S., and my other patrons. If you want to join them, you can support my work at https://glyph.im/patrons/. --- src/pomodouroboros/macos/progress_hud.py | 30 +++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/pomodouroboros/macos/progress_hud.py b/src/pomodouroboros/macos/progress_hud.py index fb60dd2..8bafdfd 100644 --- a/src/pomodouroboros/macos/progress_hud.py +++ b/src/pomodouroboros/macos/progress_hud.py @@ -100,6 +100,8 @@ class AbstractProgressView(NSView): _bonusPercentage2: float = 0.0 _leftColor = NSColor.greenColor() _rightColor = NSColor.redColor() + _bonus1Color: NSColor = NSColor.blueColor() + _bonus2Color: NSColor = NSColor.yellowColor() _alphaValue: float = 1 / 4 _textAlpha: float = 0.0 @@ -625,11 +627,11 @@ def drawRect_(self, dirtyRect: NSRect) -> None: self._alphaValue ) - bonus1Color = NSColor.blueColor().colorWithAlphaComponent_( - self._alphaValue + bonus1Color = self._bonus1Color.colorWithAlphaComponent_( + self._alphaValue + 0.2 ) - bonus2Color = NSColor.yellowColor().colorWithAlphaComponent_( - self._alphaValue + bonus2Color = self._bonus2Color.colorWithAlphaComponent_( + self._alphaValue + 0.2 ) super().drawRect_(dirtyRect) @@ -649,25 +651,19 @@ def drawRect_(self, dirtyRect: NSRect) -> None: leftArc = maker.makeArc(endDegrees, startDegrees) rightArc = maker.makeArc(startDegrees, endDegrees) - bonusMaker = ArcMaker(center, radius * 1.1) + bonusMaker = ArcMaker(center, radius * 1.05) bonus1start = pct2deg(self._bonusPercentage1) - bonus2start = pct2deg(self._bonusPercentage2) + bonus2start = pct2deg(self._bonusPercentage2 + self._bonusPercentage1) - bonus1Arc = maker.makeArc(endDegrees, bonus1start) - bonus2Arc = maker.makeArc(bonus1start, bonus2start + bonus1start) + bonus1Arc = bonusMaker.makeArc(endDegrees, bonus1start) + bonus2Arc = bonusMaker.makeArc(bonus1start, bonus2start) leftWithAlpha.setFill() leftArc.fill() rightWithAlpha.setFill() rightArc.fill() - bonus1Color.setFill() - bonus1Arc.fill() - - bonus2Color.setFill() - bonus2Arc.fill() - lineAlpha = (self._alphaValue - DEFAULT_BASE_ALPHA) * 4 if lineAlpha > 0: @@ -685,6 +681,12 @@ def drawRect_(self, dirtyRect: NSRect) -> None: center, self._reticleText, self._textAlpha, self._leftColor ) + bonus1Color.setFill() + bonus1Arc.fill() + + bonus2Color.setFill() + bonus2Arc.fill() + def _removeWindows(self: ProgressController) -> None: """