...
This commit is contained in:
parent
db94df07a3
commit
807eb937fd
@ -11,7 +11,7 @@ class Module(object):
|
|||||||
def registered(self, status_handler):
|
def registered(self, status_handler):
|
||||||
"""Called when this module is registered with a status handler"""
|
"""Called when this module is registered with a status handler"""
|
||||||
|
|
||||||
def run(self):
|
def tick(self):
|
||||||
"""Only called if self.async == False. Called once per tick"""
|
"""Only called if self.async == False. Called once per tick"""
|
||||||
|
|
||||||
class I3statusHandler(object):
|
class I3statusHandler(object):
|
||||||
|
@ -11,6 +11,7 @@ import dbus, gobject
|
|||||||
from dbus.mainloop.glib import DBusGMainLoop
|
from dbus.mainloop.glib import DBusGMainLoop
|
||||||
import json
|
import json
|
||||||
import threading
|
import threading
|
||||||
|
import time
|
||||||
|
|
||||||
class ThunderbirdMailChecker(object):
|
class ThunderbirdMailChecker(object):
|
||||||
"""
|
"""
|
||||||
@ -18,7 +19,7 @@ class ThunderbirdMailChecker(object):
|
|||||||
the dbus-sender extension for thunderbird.
|
the dbus-sender extension for thunderbird.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
async = False
|
async = True
|
||||||
output = None
|
output = None
|
||||||
|
|
||||||
unread = set()
|
unread = set()
|
||||||
@ -36,8 +37,14 @@ class ThunderbirdMailChecker(object):
|
|||||||
dbus.mainloop.glib.threads_init()
|
dbus.mainloop.glib.threads_init()
|
||||||
self.context = loop.get_context()
|
self.context = loop.get_context()
|
||||||
|
|
||||||
def tick(self):
|
self.thread = threading.Thread(target=self.mainloop)
|
||||||
self.context.iteration(False)
|
self.thread.daemon = True
|
||||||
|
self.thread.start()
|
||||||
|
|
||||||
|
def mainloop(self):
|
||||||
|
while True:
|
||||||
|
self.context.iteration(False)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
def new_msg(self, id, author, subject):
|
def new_msg(self, id, author, subject):
|
||||||
if id not in self.unread:
|
if id not in self.unread:
|
||||||
|
Loading…
Reference in New Issue
Block a user