2016-10-18 20:00:43 +03:00
|
|
|
import time
|
2016-10-22 05:50:11 +03:00
|
|
|
import threading
|
2016-10-18 20:00:43 +03:00
|
|
|
|
|
|
|
|
2016-10-22 05:50:11 +03:00
|
|
|
class PluginThread(threading.Thread):
|
|
|
|
def __init__(self, section, config, thread_id):
|
|
|
|
threading.Thread.__init__(self)
|
|
|
|
self.threadID = thread_id
|
2016-10-22 19:27:28 +03:00
|
|
|
self.date_format = config.get(section, 'format', fallback='%c')
|
2016-10-22 05:50:11 +03:00
|
|
|
self.status = dict()
|
|
|
|
if config.has_option(section, 'color'):
|
|
|
|
self.status['color'] = config.get(section, 'color')
|
|
|
|
self.freq = 1
|
|
|
|
|
2016-10-22 19:27:28 +03:00
|
|
|
def main(self):
|
|
|
|
self.status['full_text'] = time.strftime(self.date_format)
|
|
|
|
|
2016-10-22 05:50:11 +03:00
|
|
|
def run(self):
|
|
|
|
while True:
|
2016-10-22 19:27:28 +03:00
|
|
|
self.main()
|
2016-10-22 05:50:11 +03:00
|
|
|
time.sleep(self.freq)
|