[general] Refactoring
* remove (hopefully) unnecessary import statements * make some code a bit more compact * remove dead code ... again: hopefully so
This commit is contained in:
parent
e889098c77
commit
3af8ee771d
4 changed files with 2 additions and 35 deletions
|
@ -9,7 +9,6 @@ def main():
|
||||||
|
|
||||||
engine = bumblebee.engine.Engine(config)
|
engine = bumblebee.engine.Engine(config)
|
||||||
engine.load_modules()
|
engine.load_modules()
|
||||||
engine.register_events()
|
|
||||||
|
|
||||||
engine.run()
|
engine.run()
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@ class ModuleConfig(object):
|
||||||
|
|
||||||
class Config(object):
|
class Config(object):
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
self._raw = args
|
|
||||||
self._parser = self._parser()
|
self._parser = self._parser()
|
||||||
self._store = {}
|
self._store = {}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import glob
|
|
||||||
import pkgutil
|
|
||||||
import textwrap
|
|
||||||
import argparse
|
|
||||||
import importlib
|
import importlib
|
||||||
import bumblebee.theme
|
import bumblebee.theme
|
||||||
import bumblebee.output
|
import bumblebee.output
|
||||||
|
@ -25,24 +19,6 @@ class Engine:
|
||||||
for m in self._config.modules():
|
for m in self._config.modules():
|
||||||
self._modules.append(self.load_module(m))
|
self._modules.append(self.load_module(m))
|
||||||
|
|
||||||
def register_event(self, eventspec):
|
|
||||||
return
|
|
||||||
# TODO
|
|
||||||
event = eventspec.split(self._args.split)
|
|
||||||
if len(event) < 3:
|
|
||||||
raise Exception("invalid click event format, expected 3 parameters")
|
|
||||||
self._output.add_callback(
|
|
||||||
module = event[0],
|
|
||||||
button = int(event[1]),
|
|
||||||
cmd = event[2],
|
|
||||||
)
|
|
||||||
|
|
||||||
def register_events(self):
|
|
||||||
return
|
|
||||||
# TODO
|
|
||||||
for e in self._args.events:
|
|
||||||
self.register_event(e)
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self._output.start()
|
self._output.start()
|
||||||
|
|
||||||
|
|
|
@ -71,18 +71,11 @@ class Output(object):
|
||||||
)] = cmd
|
)] = cmd
|
||||||
|
|
||||||
def callback(self, event):
|
def callback(self, event):
|
||||||
|
module = event.get("instance", event.get("name", None))
|
||||||
cb = self._callbacks.get((
|
cb = self._callbacks.get((
|
||||||
event.get("button", -1),
|
event.get("button", -1),
|
||||||
None,
|
module,
|
||||||
), None)
|
), None)
|
||||||
cb = self._callbacks.get((
|
|
||||||
event.get("button", -1),
|
|
||||||
event.get("name", None),
|
|
||||||
), cb)
|
|
||||||
cb = self._callbacks.get((
|
|
||||||
event.get("button", -1),
|
|
||||||
event.get("instance", None),
|
|
||||||
), cb)
|
|
||||||
if inspect.isfunction(cb) or cb is None: return cb
|
if inspect.isfunction(cb) or cb is None: return cb
|
||||||
|
|
||||||
return Command(cb)
|
return Command(cb)
|
||||||
|
|
Loading…
Reference in a new issue