Skip to content

Commit 33d6ad9

Browse files
[pomodoro] Interface v2.0
1 parent c409e3f commit 33d6ad9

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

Diff for: pomodoro/__init__.py

+17-24
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
https://en.wikipedia.org/wiki/Pomodoro_Technique
66
"""
77

8-
from albert import *
98
import subprocess
109
import threading
1110
import time
12-
import os
11+
from pathlib import Path
12+
13+
from albert import *
1314

14-
md_iid = '1.0'
15-
md_version = "1.2"
15+
md_iid = '2.0'
16+
md_version = "1.3"
1617
md_name = "Pomodoro"
1718
md_description = "Set up a Pomodoro timer"
1819
md_license = "BSD-3"
@@ -66,36 +67,28 @@ def isActive(self):
6667
return self.timer is not None
6768

6869

69-
class Plugin(TriggerQueryHandler):
70+
class Plugin(PluginInstance, TriggerQueryHandler):
7071

71-
icon = [os.path.dirname(__file__) + "/pomodoro.svg"]
7272
default_pomodoro_duration = 25
7373
default_break_duration = 5
7474
default_longbreak_duration = 15
7575
default_pomodoro_count = 4
7676

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])
9085
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"]
9487

9588
def handleTriggerQuery(self, query):
96-
item = Item(
89+
item = StandardItem(
9790
id=md_id,
98-
icon=self.icon,
91+
iconUrls=self.iconUrls,
9992
text=md_name
10093
)
10194

0 commit comments

Comments
 (0)