|
3 | 3 | import os |
4 | 4 | print('imported os') |
5 | 5 |
|
6 | | -print('contents of ./lib/python2.7/site-packages/ etc.') |
7 | | -print(os.listdir('./lib')) |
8 | | -print(os.listdir('./lib/python2.7')) |
9 | | -print(os.listdir('./lib/python2.7/site-packages')) |
| 6 | +from kivy import platform |
10 | 7 |
|
11 | | -print('contents of this dir', os.listdir('./')) |
| 8 | +if platform == 'android': |
| 9 | + print('contents of ./lib/python2.7/site-packages/ etc.') |
| 10 | + print(os.listdir('./lib')) |
| 11 | + print(os.listdir('./lib/python2.7')) |
| 12 | + print(os.listdir('./lib/python2.7/site-packages')) |
12 | 13 |
|
13 | | -with open('./lib/python2.7/site-packages/kivy/app.pyo', 'rb') as fileh: |
14 | | - print('app.pyo size is', len(fileh.read())) |
| 14 | + print('this dir is', os.path.abspath(os.curdir)) |
| 15 | + |
| 16 | + print('contents of this dir', os.listdir('./')) |
| 17 | + |
| 18 | + with open('./lib/python2.7/site-packages/kivy/app.pyo', 'rb') as fileh: |
| 19 | + print('app.pyo size is', len(fileh.read())) |
15 | 20 |
|
16 | 21 | import sys |
17 | 22 | print('pythonpath is', sys.path) |
|
35 | 40 |
|
36 | 41 | kv = ''' |
37 | 42 | #:import Metrics kivy.metrics.Metrics |
| 43 | +#:import Window kivy.core.window.Window |
38 | 44 |
|
39 | 45 | <FixedSizeButton@Button>: |
40 | 46 | size_hint_y: None |
41 | 47 | height: dp(60) |
42 | 48 |
|
43 | 49 |
|
44 | | -ScrollView: |
45 | | - GridLayout: |
46 | | - cols: 1 |
| 50 | +BoxLayout: |
| 51 | + orientation: 'vertical' |
| 52 | + BoxLayout: |
47 | 53 | size_hint_y: None |
48 | | - height: self.minimum_height |
49 | | - FixedSizeButton: |
50 | | - text: 'test pyjnius' |
51 | | - on_press: app.test_pyjnius() |
52 | | - Image: |
53 | | - keep_ratio: False |
54 | | - allow_stretch: True |
55 | | - source: 'colours.png' |
56 | | - size_hint_y: None |
57 | | - height: dp(100) |
58 | | - Label: |
59 | | - height: self.texture_size[1] |
60 | | - size_hint_y: None |
61 | | - font_size: 100 |
62 | | - text_size: self.size[0], None |
63 | | - markup: True |
64 | | - text: '[b]Kivy[/b] on [b]SDL2[/b] on [b]Android[/b]!' |
65 | | - halign: 'center' |
66 | | - Widget: |
67 | | - size_hint_y: None |
68 | | - height: 20 |
69 | | - Label: |
70 | | - height: self.texture_size[1] |
71 | | - size_hint_y: None |
72 | | - font_size: 50 |
73 | | - text_size: self.size[0], None |
74 | | - markup: True |
75 | | - text: 'dpi: {}\\ndensity: {}\\nfontscale: {}'.format(Metrics.dpi, Metrics.density, Metrics.fontscale) |
76 | | - halign: 'center' |
77 | | - FixedSizeButton: |
78 | | - text: 'test ctypes' |
79 | | - on_press: app.test_ctypes() |
80 | | - FixedSizeButton: |
81 | | - text: 'test numpy' |
82 | | - on_press: app.test_numpy() |
83 | | - Widget: |
84 | | - size_hint_y: None |
85 | | - height: 1000 |
86 | | - on_touch_down: print 'touched at', args[-1].pos |
87 | | -
|
88 | | -<ErrorPopup>: |
89 | | - title: 'Error' |
90 | | - size_hint: 0.75, 0.75 |
91 | | - Label: |
92 | | - text: root.error_text |
| 54 | + height: dp(50) |
| 55 | + orientation: 'horizontal' |
| 56 | + Button: |
| 57 | + text: 'None' |
| 58 | + on_press: Window.softinput_mode = '' |
| 59 | + Button: |
| 60 | + text: 'pan' |
| 61 | + on_press: Window.softinput_mode = 'pan' |
| 62 | + Button: |
| 63 | + text: 'below_target' |
| 64 | + on_press: Window.softinput_mode = 'below_target' |
| 65 | + Button: |
| 66 | + text: 'resize' |
| 67 | + on_press: Window.softinput_mode = 'resize' |
| 68 | + Widget: |
| 69 | + Scatter: |
| 70 | + id: scatter |
| 71 | + size_hint: None, None |
| 72 | + size: dp(300), dp(80) |
| 73 | + on_parent: self.pos = (300, 100) |
| 74 | + BoxLayout: |
| 75 | + size: scatter.size |
| 76 | + orientation: 'horizontal' |
| 77 | + canvas: |
| 78 | + Color: |
| 79 | + rgba: 1, 0, 0, 1 |
| 80 | + Rectangle: |
| 81 | + pos: 0, 0 |
| 82 | + size: self.size |
| 83 | + Widget: |
| 84 | + size_hint_x: None |
| 85 | + width: dp(30) |
| 86 | + TextInput: |
| 87 | + text: 'type in me' |
93 | 88 | ''' |
94 | 89 |
|
95 | 90 |
|
@@ -145,6 +140,5 @@ def test_numpy(self, *args): |
145 | 140 | print(numpy.zeros(5)) |
146 | 141 | print(numpy.arange(5)) |
147 | 142 | print(numpy.random.random((3, 3))) |
148 | | - |
149 | 143 |
|
150 | 144 | TestApp().run() |
0 commit comments