sugarlabs / Pippy

Pippy allows the student to examine, execute, and modify simple Python programs. In addition it is possible to write Python statements to play sounds, calculate expressions, or make simple text based interactive games.
GNU General Public License v2.0
11 stars 35 forks source link

Fix AttributeError on missing 'leader' attribute #43

Closed City-busz closed 7 years ago

City-busz commented 7 years ago

Without this change, I get the following crash when I try to launch Pippy outside from Sugar shell:

Traceback (most recent call last):
  File "/usr/bin/sugar-activity", line 220, in <module>
    main()
  File "/usr/bin/sugar-activity", line 215, in main
    instance = create_activity_instance(activity_constructor, activity_handle)
  File "/usr/bin/sugar-activity", line 48, in create_activity_instance
    activity = constructor(handle)
  File "/usr/share/sugar/activities/Pippy-70/pippy_app.py", line 160, in __init__
    self.set_canvas(self.initialize_display())
  File "/usr/share/sugar/activities/Pippy-70/pippy_app.py", line 387, in initialize_display
    self._source_tabs.add_tab()  # New instance, ergo empty tab
  File "/usr/share/sugar/activities/Pippy-70/notebook.py", line 209, in add_tab
    buffer_text, editor_id, self._collab)
  File "/usr/share/sugar/activities/Pippy-70/notebook.py", line 151, in __init__
    text_buffer, editor_id, collab)
  File "/usr/share/sugar/activities/Pippy-70/texteditor.py", line 80, in __init__
    if not self._collab.props.leader:
AttributeError: 'gi._gobject.GProps' object has no attribute 'leader'
quozl commented 7 years ago

Thanks. Should your change to texteditor.py be also upstream in https://github.com/samdroid-apps/collabwrapper and other projects (Browse) that have used the same file?

quozl commented 7 years ago

Packaged and tested.