prevents start of command_endpoint thread when click_events are disabled

This commit is contained in:
Arvedui 2014-08-15 00:16:50 +02:00
parent de3db6fb19
commit cee58e495c

View File

@ -45,8 +45,10 @@ class Status:
def __init__(self, standalone=False, interval=1, input_stream=sys.stdin, click_events=True): def __init__(self, standalone=False, interval=1, input_stream=sys.stdin, click_events=True):
self.modules = util.ModuleList(self, ClassFinder(Module)) self.modules = util.ModuleList(self, ClassFinder(Module))
self.standalone = standalone self.standalone = standalone
self.click_events = click_events
if standalone: if standalone:
self.io = io.StandaloneIO(click_events, interval) self.io = io.StandaloneIO(self.click_events, interval)
if self.click_events:
self.command_endpoint = CommandEndpoint( self.command_endpoint = CommandEndpoint(
self.modules, self.modules,
lambda: io.JSONIO(io=io.IOHandler(sys.stdin, open(os.devnull, "w")), skiplines=1)) lambda: io.JSONIO(io=io.IOHandler(sys.stdin, open(os.devnull, "w")), skiplines=1))
@ -78,6 +80,7 @@ class Status:
text=configuration_error.message)) text=configuration_error.message))
def run(self): def run(self):
if self.click_events:
self.command_endpoint.start() self.command_endpoint.start()
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: