forked from elParaguayo/RPi-InfoScreen-Kivy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
executable file
·56 lines (43 loc) · 1.62 KB
/
main.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
56
#!/usr/bin/env python
import os
import sys
from kivy.app import App
from kivy.core.window import Window
from kivy.graphics import Rectangle, Color
from kivy.lang import Builder
from kivy.properties import ListProperty, StringProperty
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.behaviors import ButtonBehavior
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.uix.scrollview import ScrollView
from core.bglabel import BGLabel, BGLabelButton
from core.hiddenbutton import HiddenButton
from core.infoscreen import InfoScreen
from core.getplugins import getPlugins
# Set the current working directory
os.chdir(os.path.dirname(os.path.abspath(sys.argv[0])))
VERSION = "0.3.1"
class InfoScreenApp(App):
def build(self):
# Window size is hardcoded for resolution of official Raspberry Pi
# display. Can be altered but plugins may not display correctly.
Window.size = (800, 480)
self.info_screen = InfoScreen(plugins=plugins)
return self.info_screen
def on_stop(self):
self.info_screen.on_stop()
if __name__ == "__main__":
# Get a list of installed plugins
plugins = getPlugins()
# Get the base KV language file for the Info Screen app.
kv_text = "".join(open("base.kv").readlines()) + "\n"
# Loop over the plugins
for p in plugins:
# and add their custom KV files to create one master KV file
kv_text += "".join(p["kv"])
# Load the master KV file
Builder.load_string(kv_text)
# Good to go. Let's start the app.
InfoScreenApp().run()