Skip to content

Commit

Permalink
finish implementation of left-circle overlay view
Browse files Browse the repository at this point in the history
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/.
  • Loading branch information
glyph committed Jul 11, 2024
1 parent 0f8be22 commit c1156d2
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/pomodouroboros/macos/progress_hud.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand All @@ -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:
"""
Expand Down

0 comments on commit c1156d2

Please sign in to comment.