added icons to show current status

This commit is contained in:
Andrei Stoica 2020-02-02 14:14:03 -05:00
parent f82ffc3163
commit 9d1fdfad03
5 changed files with 8 additions and 2 deletions

View File

@ -6,6 +6,7 @@ Theoreticaly this should work on all platforms. Although currently it only uses
Currently tested on: Currently tested on:
- Ubuntu MATE 18.04 - Ubuntu MATE 18.04
- Arch Linux
### Depenancies ### Depenancies
- [python3](https://docs.python.org/3/) - [python3](https://docs.python.org/3/)

BIN
icons/Go.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
icons/Stop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
icons/Wait.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -45,6 +45,7 @@ def end_pomo():
global started, counter global started, counter
counter+=1 counter+=1
started = False started = False
tray.setIcon(QIcon("icons/Stop.png"))
if counter % long_break == 0: if counter % long_break == 0:
notify(f"Take a break for {long_break_time} minutes.", notify(f"Take a break for {long_break_time} minutes.",
title='LONG BREAK') title='LONG BREAK')
@ -55,6 +56,7 @@ def end_pomo():
sleep(break_time * 60) sleep(break_time * 60)
if not started: if not started:
tray.setIcon(QIcon("icons/Wait.png"))
notify("You should probably get back to work") notify("You should probably get back to work")
def start(): def start():
@ -62,6 +64,7 @@ def start():
if not started: if not started:
if pomo_timer: if pomo_timer:
pomo_timer.cancel() pomo_timer.cancel()
tray.setIcon(QIcon("icons/Go.png"))
started = True started = True
notify(f"You got {pomo_time} minutes to work.", title='WORK') notify(f"You got {pomo_time} minutes to work.", title='WORK')
pomo_timer = threading.Timer(pomo_time * 60, end_pomo) pomo_timer = threading.Timer(pomo_time * 60, end_pomo)
@ -70,8 +73,10 @@ def start():
notify("Already in the middle of a pomodoro.") notify("Already in the middle of a pomodoro.")
def stop_work(): def stop_work():
global pomo_timer global pomo_timer, started
if pomo_timer: if pomo_timer:
started = False
tray.setIcon(QIcon("icons/Wait.png"))
pomo_timer.cancel() pomo_timer.cancel()
if started: if started:
notify("Alright take your unscheduled break...") notify("Alright take your unscheduled break...")
@ -83,7 +88,7 @@ def quit():
# Create the icon # Create the icon
icon = QIcon("") icon = QIcon("icons/Wait.png")
# Create the tray # Create the tray
tray = QSystemTrayIcon() tray = QSystemTrayIcon()