Я пишу графический интерфейс с использованием Kivy на Raspi 3, и он отлично работает в основном, но теперь я добавил несколько «экранов», которые сбой при возврате на предыдущий экран.Kivy/Raspi Shader Exception
В основном от Mimic Я хочу иметь возможность перейти на любой из трех других экранов (TCS, EPC, CT) и иметь возможность вернуться к Mimic. Я могу добраться до Mimic, а затем впоследствии любой из этих экранов, но при нажатии на кнопку возврата к сбою программы со следующим сообщением:
Traceback (most recent call last):
File "GUI.py", line 1329, in <module>
MainApp().run()
File "/usr/local/lib/python2.7/dist-packages/kivy/app.py", line 828, in run
runTouchApp()
File "/usr/local/lib/python2.7/dist-packages/kivy/base.py", line 500, in runTouchApp
EventLoop.window.mainloop()
File "/usr/local/lib/python2.7/dist-packages/kivy/core/window/window_egl_rpi.py", line 90, in mainloop
self._mainloop()
File "/usr/local/lib/python2.7/dist-packages/kivy/core/window/window_egl_rpi.py", line 85, in _mainloop
EventLoop.idle()
File "/usr/local/lib/python2.7/dist-packages/kivy/base.py", line 339, in idle
self.dispatch_input()
File "/usr/local/lib/python2.7/dist-packages/kivy/base.py", line 324, in dispatch_input
post_dispatch_input(*pop(0))
File "/usr/local/lib/python2.7/dist-packages/kivy/base.py", line 290, in post_dispatch_input
wid.dispatch('on_touch_up', me)
File "kivy/_event.pyx", line 718, in kivy._event.EventDispatcher.dispatch (kivy/_event.c:8191)
File "/usr/local/lib/python2.7/dist-packages/kivy/uix/behaviors/button.py", line 179, in on_touch_up
self.dispatch('on_release')
File "kivy/_event.pyx", line 714, in kivy._event.EventDispatcher.dispatch (kivy/_event.c:8146)
File "kivy/_event.pyx", line 1225, in kivy._event.EventObservers.dispatch (kivy/_event.c:14035)
File "kivy/_event.pyx", line 1109, in kivy._event.EventObservers._dispatch (kivy/_event.c:12816)
File "/usr/local/lib/python2.7/dist-packages/kivy/lang/builder.py", line 64, in custom_callback
exec(__kvlang__.co_value, idmap)
File "<string>", line 540, in <module>
File "kivy/properties.pyx", line 423, in kivy.properties.Property.__set__ (kivy/properties.c:5572)
File "kivy/properties.pyx", line 461, in kivy.properties.Property.set (kivy/properties.c:6405)
File "kivy/properties.pyx", line 516, in kivy.properties.Property.dispatch (kivy/properties.c:7105)
File "kivy/_event.pyx", line 1225, in kivy._event.EventObservers.dispatch (kivy/_event.c:14035)
File "kivy/_event.pyx", line 1131, in kivy._event.EventObservers._dispatch (kivy/_event.c:13193)
File "/usr/local/lib/python2.7/dist-packages/kivy/uix/screenmanager.py", line 973, in on_current
self.transition.start(self)
File "/usr/local/lib/python2.7/dist-packages/kivy/uix/screenmanager.py", line 369, in start
self.add_screen(self.screen_in)
File "/usr/local/lib/python2.7/dist-packages/kivy/uix/screenmanager.py", line 505, in add_screen
self.fbo_out = self.make_screen_fbo(self.screen_out)
File "/usr/local/lib/python2.7/dist-packages/kivy/uix/screenmanager.py", line 469, in make_screen_fbo
fbo = Fbo(size=screen.size)
File "kivy/graphics/fbo.pyx", line 150, in kivy.graphics.fbo.Fbo.__init__ (kivy/graphics/fbo.c:3155)
File "kivy/graphics/instructions.pyx", line 754, in kivy.graphics.instructions.RenderContext.__init__ (kivy/graphics/instructions.c:11094)
File "kivy/graphics/shader.pyx", line 186, in kivy.graphics.shader.Shader.__init__ (kivy/graphics/shader.c:4152)
File "kivy/graphics/shader.pyx", line 695, in kivy.graphics.shader.Shader.vs.__set__ (kivy/graphics/shader.c:11550)
File "kivy/graphics/shader.pyx", line 557, in kivy.graphics.shader.Shader.build_vertex (kivy/graphics/shader.c:9283)
File "kivy/graphics/shader.pyx", line 587, in kivy.graphics.shader.Shader.link_program (kivy/graphics/shader.c:9736)
Exception: Shader didnt link, check info log.
Полный код здесь: https://github.com/ISS-Mimic/Mimic/blob/master/Pi/GUI.py
Соответствующие (я думаю) сниппеты :
class MainApp(App):
def build(self):
self.mimic_screen = MimicScreen(name = 'mimic')
self.fakeorbit_screen = FakeOrbitScreen(name = 'fakeorbit')
self.eps_screen = EPS_Screen(name = 'eps')
self.ct_screen = CT_Screen(name = 'ct')
self.tcs_screen = TCS_Screen(name = 'tcs')
root = MainScreenManager(transition=WipeTransition())
root.add_widget(MainScreen(name = 'main'))
root.add_widget(CalibrateScreen(name = 'calibrate'))
root.add_widget(self.mimic_screen)
root.add_widget(self.fakeorbit_screen)
root.add_widget(self.eps_screen)
root.add_widget(self.ct_screen)
root.add_widget(self.tcs_screen)
root.add_widget(ManualControlScreen(name = 'manualcontrol'))
root.current= 'main'
Clock.schedule_interval(self.update_labels, 1)
Clock.schedule_interval(self.checkAOSlong, 5)
return root
И киловольт код:
Builder.load_string('''
#:kivy 1.8
#:import kivy kivy
#:import win kivy.core.window
ScreenManager:
MainScreen:
FakeOrbitScreen:
EPS_Screen:
CT_Screen:
TCS_Screen:
ManualControlScreen:
MimicScreen:
CalibrateScreen:
<MainScreen>:
name: 'main'
FloatLayout:
orientation: 'vertical'
Image:
source: './imgs/iss.png'
allow_stretch: True
keep_ratio: True
Button:
size_hint: 0.3,0.1
pos_hint: {"center_x": 0.2, "center_y": 0.9}
text: 'Fake Orbit'
font_size: 30
width: 50
height: 20
on_release: root.manager.current = 'fakeorbit'
BoxLayout:
size_hint_y: None
Button:
text: 'Control'
font_size: 30
width: 50
height: 20
on_press: root.changeManualControlBoolean(True)
on_release: root.manager.current = 'manualcontrol'
Button:
text: 'Calibrate'
font_size: 30
width: 50
height: 20
on_release: root.manager.current = 'calibrate'
on_release: my_button.disabled = False
MyButton:
id: my_button
text: 'Mimic'
disabled: True
font_size: 30
width: 50
height: 20
on_release: app.root.current = 'mimic'
Button:
text: 'Exit'
font_size: 30
width: 50
height: 20
on_release: app.stop(*args)
<FakeOrbitScreen>:
name: 'fakeorbit'
...
<ManualControlScreen>:
name: 'manualcontrol'
...
<CalibrateScreen>:
name: 'calibrate'
...
<CT_Screen>:
name: 'ct'
FloatLayout:
Image:
source: './imgs/iss2.png'
allow_stretch: True
keep_ratio: False
Button:
size_hint: 0.3,0.1
pos_hint: {"Left": 1, "Bottom": 1}
text: 'Return'
font_size: 30
on_release: app.root.current = 'mimic'
<TCS_Screen>:
name: 'tcs'
FloatLayout:
Image:
source: './imgs/iss2.png'
allow_stretch: True
keep_ratio: False
Button:
size_hint: 0.3,0.1
pos_hint: {"Left": 1, "Bottom": 1}
text: 'Return'
font_size: 30
on_release: app.root.current = 'mimic'
<EPS_Screen>:
name: 'eps'
FloatLayout:
Image:
source: './imgs/iss2.png'
allow_stretch: True
keep_ratio: False
Button:
size_hint: 0.3,0.1
pos_hint: {"Left": 1, "Bottom": 1}
text: 'Return'
font_size: 30
on_release: app.root.current = 'mimic'
<MimicScreen>:
name: 'mimic'
FloatLayout:
id: mimicscreenlayout
Image:
source: './imgs/iss2.png'
allow_stretch: True
keep_ratio: False
Button:
size_hint: 0.3,0.1
pos_hint: {"center_x": 0.65, "center_y": 0.65}
text: 'EPS'
font_size: 30
on_release: root.manager.current = 'eps'
Button:
size_hint: 0.3,0.1
pos_hint: {"center_x": 0.65, "center_y": 0.5}
text: 'CT'
font_size: 30
on_release: root.manager.current = 'ct'
Button:
size_hint: 0.3,0.1
pos_hint: {"center_x": 0.65, "center_y": 0.35}
text: 'TCS'
font_size: 30
on_release: root.manager.current = 'tcs'
Button:
size_hint: 0.3,0.1
pos_hint: {"Left": 1, "Bottom": 1}
text: 'Return'
font_size: 30
on_release: root.changeMimicBoolean(False)
on_release: root.changeSwitchBoolean(False)
on_release: app.root.current = 'main'
''')
Фотографии из GUI для справки: каждый экран отлично кроме того, по возвращении из пенополистирола работ, ТКС или КТ (возвращаясь к основной из Mimic работает отлично)
Любая помощь будет оценена. FYI Я новичок в kivy и python, почти не знаю, что я делаю ...