mahart-studio / kivystudio

A Software development environment for software developers
MIT License
189 stars 51 forks source link

fix bug in topmenu.kv component #37

Closed AdamMusa closed 3 years ago

AdamMusa commented 3 years ago

when we launch the application and tap on file then the application closes and here is Traceback of the error

Traceback (most recent call last): File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/lang/builder.py", line 242, in create_handler return eval(value, idmap), bound_list File "/home/amalabs/Téléchargements/kivystudio-master/kivystudio/components/topmenu/dropmenu.kv", line 72, in color: (self.parent.text_colors[0] if self.type=='text' else self.parent.text_colors[1]) if self.parent else (0,0,0,1) IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/lang/builder.py", line 695, in _apply_rule value, bound = create_handler( File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/lang/builder.py", line 245, in create_handler raise BuilderException(rule.ctx, rule.line, kivy.lang.builder.BuilderException: Parser: File "/home/amalabs/Téléchargements/kivystudio-master/kivystudio/components/topmenu/dropmenu.kv", line 72: ... 70: padding: '20dp', 0 71: type: 'text'

72: color: (self.parent.text_colors[0] if self.type=='text' else self.parent.text_colors[1]) if self.parent else (0,0,0,1) 73: 74: ... IndexError: list index out of range File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/lang/builder.py", line 242, in create_handler return eval(value, idmap), bound_list File "/home/amalabs/Téléchargements/kivystudio-master/kivystudio/components/topmenu/dropmenu.kv", line 72, in color: (self.parent.text_colors[0] if self.type=='text' else self.parent.text_colors[1]) if self.parent else (0,0,0,1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "main.py", line 43, in main() File "main.py", line 40, in main studio_app.run() File "main.py", line 34, in run super(KivyStudio, self).run() File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/app.py", line 950, in run runTouchApp() File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/base.py", line 582, in runTouchApp EventLoop.mainloop() File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/base.py", line 347, in mainloop self.idle() File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/base.py", line 391, in idle self.dispatch_input() File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/base.py", line 342, in dispatch_input post_dispatch_input(*pop(0)) File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/base.py", line 308, in post_dispatch_input wid.dispatch('on_touch_up', me) File "kivy/_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/uix/behaviors/button.py", line 179, in on_touch_up self.dispatch('on_release') File "kivy/_event.pyx", line 705, in kivy._event.EventDispatcher.dispatch File "kivy/_event.pyx", line 1248, in kivy._event.EventObservers.dispatch File "kivy/_event.pyx", line 1132, in kivy._event.EventObservers._dispatch File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/lang/builder.py", line 57, in custom_callback exec(kvlang.co_value, idmap) File "", line 17, in File "../kivystudio/components/topmenu/init.py", line 37, in drop_menu setattr(self, menu_name, getattr(dropmenu, menu_name)()) File "../kivystudio/components/topmenu/dropmenu.py", line 21, in init super(FileTopMenu, self).init(k) File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/uix/dropdown.py", line 214, in init super(DropDown, self).init(kwargs) File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/uix/scrollview.py", line 539, in init super(ScrollView, self).init(**kwargs) File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/uix/widget.py", line 359, in init self.apply_class_lang_rules( File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/uix/widget.py", line 463, in apply_class_lang_rules Builder.apply( File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/lang/builder.py", line 541, in apply self._apply_rule( File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/lang/builder.py", line 661, in _apply_rule child.apply_class_lang_rules( File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/uix/widget.py", line 463, in apply_class_lang_rules Builder.apply( File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/lang/builder.py", line 541, in apply self._apply_rule( File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/lang/builder.py", line 661, in _apply_rule child.apply_class_lang_rules( File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/uix/widget.py", line 463, in apply_class_lang_rules Builder.apply( File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/lang/builder.py", line 541, in apply self._apply_rule( File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/lang/builder.py", line 710, in _apply_rule raise BuilderException(rule.ctx, rule.line, kivy.lang.builder.BuilderException: Parser: File "/home/amalabs/Téléchargements/kivystudio-master/kivystudio/components/topmenu/dropmenu.kv", line 72: ... 70: padding: '20dp', 0 71: type: 'text'

72: color: (self.parent.text_colors[0] if self.type=='text' else self.parent.text_colors[1]) if self.parent else (0,0,0,1) 73: 74: ... BuilderException: Parser: File "/home/amalabs/Téléchargements/kivystudio-master/kivystudio/components/topmenu/dropmenu.kv", line 72: ... 70: padding: '20dp', 0 71: type: 'text' 72: color: (self.parent.text_colors[0] if self.type=='text' else self.parent.text_colors[1]) if self.parent else (0,0,0,1) 73: 74: ... IndexError: list index out of range File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/lang/builder.py", line 242, in create_handler return eval(value, idmap), bound_list File "/home/amalabs/Téléchargements/kivystudio-master/kivystudio/components/topmenu/dropmenu.kv", line 72, in color: (self.parent.text_colors[0] if self.type=='text' else self.parent.text_colors[1]) if self.parent else (0,0,0,1)

File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/lang/builder.py", line 695, in _apply_rule value, bound = create_handler( File "/home/amalabs/.local/lib/python3.8/site-packages/kivy/lang/builder.py", line 245, in create_handler raise BuilderException(rule.ctx, rule.line,

So I solved the problem now when I launch the application here it works well

Capture d’écran de 2021-04-25 15-24-57