-
Notifications
You must be signed in to change notification settings - Fork 34
/
foos.py
executable file
·55 lines (43 loc) · 1.14 KB
/
foos.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python3
__version__ = 20160814
import foos.config as config
import logging.config
import sys
import getopt
import os
from foos.platform import is_x11
from foos.ui import ui
from foos.bus import Bus
from foos.plugin_handler import PluginHandler
logging.config.dictConfig(config.log)
logger = logging.getLogger(__name__)
logger.info("Foos v%s starting", __version__)
try:
opts, args = getopt.getopt(sys.argv[1:], "s:f:")
except getopt.GetoptError:
print('usage: ./foos.py [-sf]')
print('-s: scale')
print('-f: framerate (default: 25)')
sys.exit(2)
sf = 0
frames = 25
for opt, arg in opts:
if opt == '-f':
frames = int(arg)
if opt == '-s':
sf = float(arg)
root = os.path.abspath(os.path.dirname(__file__))
ui.media_path = root + "/img"
bus = Bus()
gui = ui.Gui(sf, frames, bus, show_leds=config.onscreen_leds_enabled,
bg_change_interval=config.bg_change_secs)
if is_x11():
import plugins.io_keyboard
logger.info("Running Keyboard")
plugins.io_keyboard.Plugin(bus)
# Load plugins
PluginHandler(bus)
# Run main gui main loop
logger.info("Run GUI")
gui.run()
gui.cleanup()