|
5 | 5 | https://en.wikipedia.org/wiki/Pomodoro_Technique
|
6 | 6 | """
|
7 | 7 |
|
8 |
| -from albert import * |
9 | 8 | import subprocess
|
10 | 9 | import threading
|
11 | 10 | import time
|
12 |
| -import os |
| 11 | +from pathlib import Path |
| 12 | + |
| 13 | +from albert import * |
13 | 14 |
|
14 |
| -md_iid = '1.0' |
15 |
| -md_version = "1.2" |
| 15 | +md_iid = '2.0' |
| 16 | +md_version = "1.3" |
16 | 17 | md_name = "Pomodoro"
|
17 | 18 | md_description = "Set up a Pomodoro timer"
|
18 | 19 | md_license = "BSD-3"
|
@@ -66,36 +67,28 @@ def isActive(self):
|
66 | 67 | return self.timer is not None
|
67 | 68 |
|
68 | 69 |
|
69 |
| -class Plugin(TriggerQueryHandler): |
| 70 | +class Plugin(PluginInstance, TriggerQueryHandler): |
70 | 71 |
|
71 |
| - icon = [os.path.dirname(__file__) + "/pomodoro.svg"] |
72 | 72 | default_pomodoro_duration = 25
|
73 | 73 | default_break_duration = 5
|
74 | 74 | default_longbreak_duration = 15
|
75 | 75 | default_pomodoro_count = 4
|
76 | 76 |
|
77 |
| - def id(self): |
78 |
| - return md_id |
79 |
| - |
80 |
| - def name(self): |
81 |
| - return md_name |
82 |
| - |
83 |
| - def description(self): |
84 |
| - return md_description |
85 |
| - |
86 |
| - def defaultTrigger(self): |
87 |
| - return "pomo " |
88 |
| - |
89 |
| - def initialize(self): |
| 77 | + def __init__(self): |
| 78 | + TriggerQueryHandler.__init__(self, |
| 79 | + id=md_id, |
| 80 | + name=md_name, |
| 81 | + description=md_description, |
| 82 | + synopsis='[duration [break duration [long break duration [count]]]]', |
| 83 | + defaultTrigger='pomo ') |
| 84 | + PluginInstance.__init__(self, extensions=[self]) |
90 | 85 | self.pomodoro = PomodoroTimer()
|
91 |
| - |
92 |
| - def synopsis(self): |
93 |
| - return "[duration [break duration [long break duration [count]]]]" |
| 86 | + self.iconUrls = [f"file:{Path(__file__).parent}/pomodoro.svg"] |
94 | 87 |
|
95 | 88 | def handleTriggerQuery(self, query):
|
96 |
| - item = Item( |
| 89 | + item = StandardItem( |
97 | 90 | id=md_id,
|
98 |
| - icon=self.icon, |
| 91 | + iconUrls=self.iconUrls, |
99 | 92 | text=md_name
|
100 | 93 | )
|
101 | 94 |
|
|
0 commit comments