-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
55 lines (41 loc) · 1.56 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
from kivy.properties import StringProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivymd.app import MDApp
from jnius import autoclass, cast, JavaClass, MetaJavaClass
import traceback
class OutputLabel(Image):
text = StringProperty('')
def on_text(self, *_):
l = Label(text=self.text)
l.font_size = '48dp'
l.texture_update()
self.texture = l.texture
class RootWidget(BoxLayout):
pass
class hnnnng(MDApp):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def build(self):
self.theme_cls.theme_style = "Dark"
self.theme_cls.primary_palette = "BlueGray"
self.theme_cls.accent_palette = "Gray"
try:
# Get the current activity and context
# LEAVE THIS HERE
PythonActivity = autoclass('org.kivy.android.PythonActivity')
currentActivity = cast('android.app.Activity', PythonActivity.mActivity)
context = cast('android.content.Context', currentActivity.getApplicationContext())
Intent = autoclass('android.content.Intent')
# CODE TO DEBUG STARTS HERE
# Use this label to display desired debug text
label = OutputLabel(text="")
# END OF CODE, DISPLAY TRACEBACK
except Exception:
t = traceback.format_exc()
t2 = [t[i:i+50] for i in range(0, len(t), 50)]
label = OutputLabel(text="\n".join(t2))
return label
if __name__ == '__main__':
hnnnng().run()