fixed logic for loading icons
This commit is contained in:
parent
9d1fdfad03
commit
9987c842bb
|
|
@ -26,6 +26,11 @@ else:
|
||||||
with open(config_file) as f:
|
with open(config_file) as f:
|
||||||
config.read_file(f)
|
config.read_file(f)
|
||||||
|
|
||||||
|
icons = {icon : path.join(sys.path[0], '../icons', icon + '.png')
|
||||||
|
for icon in ['Go', 'Wait', 'Stop']}
|
||||||
|
|
||||||
|
print(icons)
|
||||||
|
|
||||||
pomo_time = config.getint('DEFAULT','pomo_time')
|
pomo_time = config.getint('DEFAULT','pomo_time')
|
||||||
break_time = config.getint('DEFAULT','break_time')
|
break_time = config.getint('DEFAULT','break_time')
|
||||||
long_break = config.getint('DEFAULT','long_break')
|
long_break = config.getint('DEFAULT','long_break')
|
||||||
|
|
@ -45,7 +50,7 @@ def end_pomo():
|
||||||
global started, counter
|
global started, counter
|
||||||
counter+=1
|
counter+=1
|
||||||
started = False
|
started = False
|
||||||
tray.setIcon(QIcon("icons/Stop.png"))
|
tray.setIcon(QIcon(icons['Stop']))
|
||||||
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')
|
||||||
|
|
@ -56,7 +61,7 @@ def end_pomo():
|
||||||
sleep(break_time * 60)
|
sleep(break_time * 60)
|
||||||
|
|
||||||
if not started:
|
if not started:
|
||||||
tray.setIcon(QIcon("icons/Wait.png"))
|
tray.setIcon(QIcon(icons['Wait']))
|
||||||
notify("You should probably get back to work")
|
notify("You should probably get back to work")
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
|
|
@ -64,7 +69,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"))
|
tray.setIcon(QIcon(icons['Go']))
|
||||||
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)
|
||||||
|
|
@ -76,7 +81,7 @@ def stop_work():
|
||||||
global pomo_timer, started
|
global pomo_timer, started
|
||||||
if pomo_timer:
|
if pomo_timer:
|
||||||
started = False
|
started = False
|
||||||
tray.setIcon(QIcon("icons/Wait.png"))
|
tray.setIcon(QIcon(icons['Wait']))
|
||||||
pomo_timer.cancel()
|
pomo_timer.cancel()
|
||||||
if started:
|
if started:
|
||||||
notify("Alright take your unscheduled break...")
|
notify("Alright take your unscheduled break...")
|
||||||
|
|
@ -88,7 +93,7 @@ def quit():
|
||||||
|
|
||||||
|
|
||||||
# Create the icon
|
# Create the icon
|
||||||
icon = QIcon("icons/Wait.png")
|
icon = QIcon(icons['Wait'])
|
||||||
|
|
||||||
# Create the tray
|
# Create the tray
|
||||||
tray = QSystemTrayIcon()
|
tray = QSystemTrayIcon()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue