Remove call_start_hooks and START_HOOKS #27
This commit is contained in:
parent
2895aa44cf
commit
135915ac96
@ -5,7 +5,7 @@ from threading import Thread
|
|||||||
from i3pystatus.core.imputil import ClassFinder
|
from i3pystatus.core.imputil import ClassFinder
|
||||||
|
|
||||||
from i3pystatus.core import io, util
|
from i3pystatus.core import io, util
|
||||||
from i3pystatus.core.modules import Module, START_HOOKS
|
from i3pystatus.core.modules import Module
|
||||||
|
|
||||||
|
|
||||||
class CommandEndpoint:
|
class CommandEndpoint:
|
||||||
@ -65,13 +65,8 @@ class Status:
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def call_start_hooks(self):
|
|
||||||
for hook in START_HOOKS:
|
|
||||||
hook()
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.command_endpoint.start()
|
self.command_endpoint.start()
|
||||||
self.call_start_hooks()
|
|
||||||
for j in io.JSONIO(self.io).read():
|
for j in io.JSONIO(self.io).read():
|
||||||
for module in self.modules:
|
for module in self.modules:
|
||||||
module.inject(j)
|
module.inject(j)
|
||||||
|
@ -52,11 +52,7 @@ class IntervalModule(Module):
|
|||||||
am = Manager(self.interval)
|
am = Manager(self.interval)
|
||||||
am.append(self)
|
am.append(self)
|
||||||
IntervalModule.managers[self.interval] = am
|
IntervalModule.managers[self.interval] = am
|
||||||
|
am.start()
|
||||||
@classmethod
|
|
||||||
def _start(cls):
|
|
||||||
for manager in cls.managers.values():
|
|
||||||
manager.start()
|
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
self.run()
|
self.run()
|
||||||
@ -66,7 +62,3 @@ class IntervalModule(Module):
|
|||||||
|
|
||||||
Do not rely on this being called from the same thread at all times.
|
Do not rely on this being called from the same thread at all times.
|
||||||
If you need to always have the same thread context, subclass AsyncModule."""
|
If you need to always have the same thread context, subclass AsyncModule."""
|
||||||
|
|
||||||
START_HOOKS = (
|
|
||||||
IntervalModule._start,
|
|
||||||
)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user