blob: 1a467713f36cbba7744918ae824e2fe4adcb7533 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import threading
import time
PLUGIN_DEFAULTS = {'freq': 1, 'hide_ok': True}
class PluginThreadCommon:
def __init__(self, config, defaults=None):
self.status = dict()
self.conf = dict()
self.conf.update(PLUGIN_DEFAULTS)
if defaults:
self.conf.update(defaults)
self.conf.update(config)
self.hide = False
self.thread = threading.Thread(target=self.run)
self.thread.daemon = True
def start(self):
self.thread.start()
def main(self):
self.status['full_text'] = 'placeholder'
def run(self):
while True:
self.main()
time.sleep(self.conf['freq'])
|