Skip to content

Commit

Permalink
Minor Bug Fix And Feature
Browse files Browse the repository at this point in the history
-------------------------

Minor bug fix - timer wasn't resetting after pausing the break timer.
Minor feature - changed icon when "on break"
  • Loading branch information
jjmojojjmojo committed May 21, 2018
1 parent a52e286 commit 7d15688
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions TODO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ TODOs

This file contains outstanding rough edges, enhancements, and new features that are planned for future versions of the application.

On-Break Icon
=============
When on break, change the icon to something that indicates you are on break.

.. admonition:: Done

Completed in 0.2.

Logarithmic back-off For Nagging
================================
If the user doesn't respond initially to the notification to take a break,
Expand Down
6 changes: 6 additions & 0 deletions break-timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
NORMAL_ICON = os.path.join(ICON_DIR, "wind.png")
ALERT_ICON = os.path.join(ICON_DIR, "alert-circle.png")
DISABLED_ICON = os.path.join(ICON_DIR, "wind-off.png")
ON_BREAK_ICON = os.path.join(ICON_DIR, "activity.png")

class BreakTimer:
"""
Expand Down Expand Up @@ -73,6 +74,7 @@ def stop(self, _):
"""
self.paused = True
self.app.icon = DISABLED_ICON
self.checkin = datetime.datetime.now()
self.work_timer.stop()
self.time_left_timer.stop()
self.app.menu['Stop'].title = "Restart"
Expand All @@ -84,11 +86,14 @@ def restart(self, _):
"""
self.paused = False
self.app.icon = NORMAL_ICON
self.delta = self.work_delta
self.checkin = datetime.datetime.now()
self.work_timer.start()
self.time_left_timer.start()
self.app.menu['Stop'].title = "Stop"
self.app.menu['Stop'].set_callback(self.stop)


def bring_to_front(self, timer=None):
"""
Bring the application to the front.
Expand All @@ -101,6 +106,7 @@ def break_popup(self, _=None):
Popup prompting the user to let the app know when they have returned.
"""
self.bring_to_front()
self.app.icon = ON_BREAK_ICON
rumps.alert(title="Go On Break", message="Get away from the computer!", ok="Back!")
self.app.icon = NORMAL_ICON
self.checkin = datetime.datetime.now()
Expand Down
Binary file added icons/activity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7d15688

Please sign in to comment.