[general] Minor refactoring
Shuffled some code around in an attempt to make it easier to read and understand.
This commit is contained in:
parent
47935942f0
commit
55474aadc3
3 changed files with 9 additions and 11 deletions
|
@ -1,16 +1,11 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import bumblebee.theme
|
|
||||||
import bumblebee.engine
|
import bumblebee.engine
|
||||||
import bumblebee.outputs.i3
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = bumblebee.engine.Arguments()
|
args = bumblebee.engine.Arguments()
|
||||||
|
|
||||||
theme = bumblebee.theme.Theme(args.args())
|
engine = bumblebee.engine.Engine(args.args())
|
||||||
output = bumblebee.outputs.i3.Output(args.args())
|
|
||||||
|
|
||||||
engine = bumblebee.engine.Engine(args.args(), theme, output)
|
|
||||||
engine.load_modules()
|
engine.load_modules()
|
||||||
engine.register_events()
|
engine.register_events()
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import textwrap
|
||||||
import argparse
|
import argparse
|
||||||
import importlib
|
import importlib
|
||||||
import bumblebee.theme
|
import bumblebee.theme
|
||||||
|
import bumblebee.output
|
||||||
|
|
||||||
class Arguments:
|
class Arguments:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -77,11 +78,11 @@ class Arguments:
|
||||||
print ""
|
print ""
|
||||||
|
|
||||||
class Engine:
|
class Engine:
|
||||||
def __init__(self, args, theme, output):
|
def __init__(self, args):
|
||||||
self._modules = []
|
self._modules = []
|
||||||
self._output = output
|
|
||||||
self._args = args
|
self._args = args
|
||||||
self._theme = theme
|
self._theme = bumblebee.theme.Theme(args)
|
||||||
|
self._output = bumblebee.output.output(args)
|
||||||
|
|
||||||
def load_module(self, modulespec):
|
def load_module(self, modulespec):
|
||||||
name = modulespec.split(self._args.split)[0]
|
name = modulespec.split(self._args.split)[0]
|
||||||
|
@ -106,11 +107,9 @@ class Engine:
|
||||||
def register_events(self):
|
def register_events(self):
|
||||||
for e in self._args.events:
|
for e in self._args.events:
|
||||||
self.register_event(e)
|
self.register_event(e)
|
||||||
pass
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
print self._output.start()
|
print self._output.start()
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
# improve this
|
# improve this
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
def output(args):
|
||||||
|
import bumblebee.outputs.i3
|
||||||
|
return bumblebee.outputs.i3.Output(args)
|
||||||
|
|
||||||
class Output(object):
|
class Output(object):
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
self._callbacks = {}
|
self._callbacks = {}
|
||||||
|
|
Loading…
Reference in a new issue