55Wiki: [Pomodoro_Technique](https://en.wikipedia.org/wiki/Pomodoro_Technique).
66"""
77
8- import subprocess
98import threading
109import time
1110from pathlib import Path
1211
1312from albert import *
1413
15- md_iid = '2.3'
16- md_version = "1.7 "
14+ md_iid = "3.0"
15+ md_version = "2.0 "
1716md_name = "Pomodoro"
1817md_description = "Set up a Pomodoro timer"
1918md_license = "MIT"
@@ -27,6 +26,12 @@ def __init__(self):
2726 self .isBreak = True
2827 self .timer = None
2928 self .notification = None
29+ self .remainingTillLongBreak = 0
30+ self .endTime = 0
31+ self .pomodoroDuration = 0
32+ self .breakDuration = 0
33+ self .longBreakDuration = 0
34+ self .count = 0
3035
3136 def timeout (self ):
3237 if self .isBreak :
@@ -77,14 +82,16 @@ class Plugin(PluginInstance, TriggerQueryHandler):
7782
7883 def __init__ (self ):
7984 PluginInstance .__init__ (self )
80- TriggerQueryHandler .__init__ (
81- self , self .id , self .name , self .description ,
82- synopsis = '[duration [break duration [long break duration [count]]]]' ,
83- defaultTrigger = 'pomo '
84- )
85+ TriggerQueryHandler .__init__ (self )
8586 self .pomodoro = PomodoroTimer ()
8687 self .iconUrls = [f"file:{ Path (__file__ ).parent } /pomodoro.svg" ]
8788
89+ def defaultTrigger (self ):
90+ return 'pomo '
91+
92+ def synopsis (self , query ):
93+ return '[duration [break duration [long break duration [count]]]]'
94+
8895 def configWidget (self ):
8996 return [
9097 {
@@ -96,13 +103,13 @@ def configWidget(self):
96103
97104 def handleTriggerQuery (self , query ):
98105 item = StandardItem (
99- id = self .id ,
106+ id = self .id () ,
100107 iconUrls = self .iconUrls ,
101108 )
102109
103110 if self .pomodoro .isActive ():
104111 item .text = "Stop Pomodoro"
105- item .actions = [Action ("stop" , "Stop" , lambda p = self .pomodoro : p .stop ())]
112+ item .actions = [Action ("stop" , "Stop" , lambda pomo = self .pomodoro : pomo .stop ())]
106113 if self .pomodoro .isBreak :
107114 whatsNext = "Pomodoro"
108115 else :
@@ -125,5 +132,5 @@ def handleTriggerQuery(self, query):
125132 item .text = "Start Pomodoro"
126133 item .subtext = f"{ p } min, break { b } min, long break { lb } min, count { c } "
127134 item .actions = [Action ("start" , "Start" ,
128- lambda p = p , b = b , lb = lb , c = c : self .pomodoro .start (p , b , lb , c ))]
135+ lambda _p = p , _b = b , _lb = lb , _c = c : self .pomodoro .start (_p , _b , _lb , _c ))]
129136 query .add (item )
0 commit comments