Kivy / Raspi Shader例外

时间:2017-01-16 04:27:54

标签: python raspberry-pi kivy raspberry-pi3

我正在使用Kivy在Raspi 3上编写GUI,并且它一直很好用,但现在我添加了一些“屏幕”,在返回到前一个屏幕时崩溃了。

基本上来自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

和kv代码:

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的图片供参考:每个屏幕都能正常工作,除非从EPS,TCS或CT返回(从Mimic返回主要工作正常) enter image description here enter image description here

非常感谢任何帮助。仅供参考我是kivy和python的新手,几乎不知道我在做什么......

1 个答案:

答案 0 :(得分:0)

好吧看起来我通过增加我的Pi上的视频内存分割来“解决”它。