Skip to content

Port to GTK 3 and Python 3 #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

Saumya-Mishra9129
Copy link
Member

No description provided.

Using namespace prefix sodipodi:cx,sodipodi:cy,sodipodi:rx and sodipodi:ry without namespace declaration 'xlmns:sodipodi' makes it difficult to read svg with Ubuntu 20.04 and with later versions
leads to following error : gi.repository.GLib.Error: rsvg-error-quark: XML parse error: error code=201 (3) in (null):31:50: Namespace prefix sodipodi for ry on circle is not defined (0)

Fix by adding namespace declaration 'xlmns:sodipodi'
Suggested by - Srevin Saju <[email protected]>
@quozl
Copy link
Contributor

quozl commented Jun 29, 2020

In b6e31c0 we would eventually Port to GLib.

In 1700469 it would be simpler to change the import and leave the references unchanged.

@Saumya-Mishra9129 Saumya-Mishra9129 force-pushed the port-to-GTK3 branch 2 times, most recently from 8cf610c to 78c196d Compare July 26, 2020 08:35
@quozl
Copy link
Contributor

quozl commented Jul 28, 2020

@quozl There is one thing I need to know, who is responsible for managing dobject submodule. I actually tried to push my changes of dobject from this port-to-GTK3 branch to dobject master branch (as I cloned by git clone repo --recursive) . I am getting permission denied error. Why so??

I don't know. I was able to clone, then git submodule init and git submodule update. I've not tried recursive. The submodule is maintained at laptop.org.

We have tended to avoid submodules because git releases (used against our advice by some people) don't include the content of submodules. You're welcome to merge the submodule into the repository.

cloned copy of git://dev.laptop.org/projects/dobject
@Saumya-Mishra9129
Copy link
Member Author

I don't know. I was able to clone, then git submodule init and git submodule update. I've not tried recursive. The submodule is maintained at laptop.org.

We have tended to avoid submodules because git releases (used against our advice by some people) don't include the content of submodules. You're welcome to merge the submodule into the repository.

Thanks , Merged submodule and working on Testing.

…ricTreeModel'

Gtk3 doesn't provide GenericTreeModel, Add compatibility in generictreemodel.py
Attribute UTF8String is for the support of Python2 in dbus
cmp has been removed in python3 and can be replaced with None
TypeError: Gtk.Box.pack_start() takes exactly 5 arguments (2 given)
TypeError: Gtk.Box.pack_start() takes exactly 5 arguments (2 given)
@quozl
Copy link
Contributor

quozl commented Jul 30, 2020

For your interest, dobject/groupthink tree is also in Butialo, and groupthink_base.py is also in StopWatch as dobject.py.

============

Mandatory dependencies:
- Python 2.5 or later
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly this should change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@quozl quozl changed the title Port to Gtk3 and Python3 Port to GTK 3 and Python 3 Jul 30, 2020
@Saumya-Mishra9129
Copy link
Member Author

Saumya-Mishra9129 commented Jul 31, 2020

For your interest, dobject/groupthink tree is also in Butialo, and groupthink_base.py is also in StopWatch as dobject.py.

Thanks but code in Butialo is also not updated from years. It is really a hard task to fix this activity . Till now I have made 30 changes after the above commits , and I am only able to open the activity , and still it has many errors. I will update changes here soon.

@quozl
Copy link
Contributor

quozl commented Jul 31, 2020

Only 30 changes? There's 6582 lines of code here, so I expect you'll be doing this for a while. 😀

has_key, iteritems, iterkeys and itervalues has been removed from dictionaries in Python 3
@Saumya-Mishra9129
Copy link
Member Author

Only 30 changes? There's 6582 lines of code here, so I expect you'll be doing this for a while.

Thanks I have started working again here 😄 .

I couln't get the cause of this error. Any suggestions?

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/gi/_propertyhelper.py", line 404, in obj_set_property
    prop.fset(self, value)
  File "/usr/lib/python3/dist-packages/sugar3/graphics/toolbarbox.py", line 188, in set_padding
    self._toolbar_alignment.set_padding(0, 0, pad, pad)
TypeError: Must be number, not ArithmeticActivity

@quozl
Copy link
Contributor

quozl commented Aug 22, 2020

Reproduced on Ubuntu 20.04. It may mean pad was corrupted in memory; the referenced object should be a number, but is an instance of the activity instead. It may be something about the source code that causes it. You might use pdb to examine the pad object at the point of the traceback, or to step through the code as the toolbar is created. You might try a later Python release.

@Saumya-Mishra9129
Copy link
Member Author

Reproduced on Ubuntu 20.04. It may mean pad was corrupted in memory; the referenced object should be a number, but is an instance of the activity instead. It may be something about the source code that causes it. You might use pdb to examine the pad object at the point of the traceback, or to step through the code as the toolbar is created. You might try a later Python release.

Thanks I am trying to look into it. Currently PR is stuck here

Traceback (most recent call last):
  File "/usr/share/sugar/activities/arithmetic/arithmetic.py", line 412, in onesecond_cb
    self.model.append(None, (person, score.last_score, score.cumulative_score, score.last_time))
AttributeError: 'dict' object has no attribute 'last_score'

@Saumya-Mishra9129 Saumya-Mishra9129 marked this pull request as ready for review August 23, 2020 20:30
@quozl
Copy link
Contributor

quozl commented Aug 25, 2020

Use pdb or static analysis (with eyes) to find out why the score object is a dict instead of an instance of ImmutableScore.

@Saumya-Mishra9129
Copy link
Member Author

Use pdb or static analysis (with eyes) to find out why the score object is a dict instead of an instance of ImmutableScore.

Thanks @quozl , It is fixed. Activity is now working fine.

@quozl
Copy link
Contributor

quozl commented Sep 7, 2020

I tried it. I didn't know how to make the activity work.

@Saumya-Mishra9129
Copy link
Member Author

I tried it. I didn't know how to make the activity work.

Thanks, To test the activity :

  • Select difficulty level
  • Select type of puzzle you want to play
  • You will get a question on your screen and you will have to solve it in given time( default 10 seconds) . We can edit time period also.
  • If you type answer and press enter, your answer will be evaluated and you will get scores according to correct or incorrect answers.
    The activity's basic functionality works fine , just display is messy and doesn't look good to me. I will try to get back to it when I get time.

@quozl
Copy link
Contributor

quozl commented Sep 21, 2020

Thanks. Nothing happens after a correct answer. I got this in logs;

guest@uff:/usr/share/sugar/activities/Arithmetic.activity$ sugar-activity3
TypeError
Python 3.8.2: /usr/bin/python3
Mon Sep 21 10:09:15 2020

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 /usr/lib/python3/dist-packages/gi/_propertyhelper.py in obj_set_property(self=<toolbarbox.ToolbarBox object at 0x7fcc286b1c00 (SugarToolbarBox at 0x2148410)>, pspec=<GParamBoxed 'padding'>, value=<arithmetic.ArithmeticActivity object at 0x7fcc2...fc0 (arithmetic+ArithmeticActivity at 0x2058260)>)
  401         name = pspec.name.replace('-', '_')
  402         prop = getattr(cls, name, None)
  403         if prop:
  404             prop.fset(self, value)
  405     cls.do_set_property = obj_set_property
prop = <GObject Property padding (PyObject)>
prop.fset = <function ToolbarBox.set_padding>
self = <toolbarbox.ToolbarBox object at 0x7fcc286b1c00 (SugarToolbarBox at 0x2148410)>
value = <arithmetic.ArithmeticActivity object at 0x7fcc2...fc0 (arithmetic+ArithmeticActivity at 0x2058260)>

 /usr/lib/python3/dist-packages/sugar3/graphics/toolbarbox.py in set_padding(self=<toolbarbox.ToolbarBox object at 0x7fcc286b1c00 (SugarToolbarBox at 0x2148410)>, pad=<arithmetic.ArithmeticActivity object at 0x7fcc2...fc0 (arithmetic+ArithmeticActivity at 0x2058260)>)
  186 
  187     def set_padding(self, pad):
  188         self._toolbar_alignment.set_padding(0, 0, pad, pad)
  189 
  190     padding = GObject.Property(type=object,
self = <toolbarbox.ToolbarBox object at 0x7fcc286b1c00 (SugarToolbarBox at 0x2148410)>
self._toolbar_alignment = <Gtk.Alignment object at 0x7fcc26ccfa00 (GtkAlignment at 0x2228140)>
self._toolbar_alignment.set_padding = gi.FunctionInfo(set_padding)
pad = <arithmetic.ArithmeticActivity object at 0x7fcc2...fc0 (arithmetic+ArithmeticActivity at 0x2058260)>
TypeError: Must be number, not ArithmeticActivity
    __cause__ = None
    __class__ = <class 'TypeError'>
    __context__ = None
    __delattr__ = <method-wrapper '__delattr__' of TypeError object>
    __dict__ = {}
    __dir__ = <built-in method __dir__ of TypeError object>
    __doc__ = 'Inappropriate argument type.'
    __eq__ = <method-wrapper '__eq__' of TypeError object>
    __format__ = <built-in method __format__ of TypeError object>
    __ge__ = <method-wrapper '__ge__' of TypeError object>
    __getattribute__ = <method-wrapper '__getattribute__' of TypeError object>
    __gt__ = <method-wrapper '__gt__' of TypeError object>
    __hash__ = <method-wrapper '__hash__' of TypeError object>
    __init__ = <method-wrapper '__init__' of TypeError object>
    __init_subclass__ = <built-in method __init_subclass__ of type object>
    __le__ = <method-wrapper '__le__' of TypeError object>
    __lt__ = <method-wrapper '__lt__' of TypeError object>
    __ne__ = <method-wrapper '__ne__' of TypeError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of TypeError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of TypeError object>
    __repr__ = <method-wrapper '__repr__' of TypeError object>
    __setattr__ = <method-wrapper '__setattr__' of TypeError object>
    __setstate__ = <built-in method __setstate__ of TypeError object>
    __sizeof__ = <built-in method __sizeof__ of TypeError object>
    __str__ = <method-wrapper '__str__' of TypeError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __suppress_context__ = False
    __traceback__ = <traceback object>
    args = ('Must be number, not ArithmeticActivity',)
    with_traceback = <built-in method with_traceback of TypeError object>

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/gi/_propertyhelper.py", line 404, in obj_set_property
    prop.fset(self, value)
  File "/usr/lib/python3/dist-packages/sugar3/graphics/toolbarbox.py", line 188, in set_padding
    self._toolbar_alignment.set_padding(0, 0, pad, pad)
TypeError: Must be number, not ArithmeticActivity



(sugar-activity3:2250): Gtk-CRITICAL **: 10:09:15.327: gtk_box_pack: assertion '_gtk_widget_get_parent (child) == NULL' failed
AttributeError
Python 3.8.2: /usr/bin/python3
Mon Sep 21 10:09:16 2020

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 /usr/share/sugar/activities/Arithmetic.activity/arithmetic.py in onesecond_cb(self=<arithmetic.ArithmeticActivity object at 0x7fcc2...fc0 (arithmetic+ArithmeticActivity at 0x2058260)>)
  411 
  412         for person in self.scoreboard:
  413             self.model.append(None, (person, self.scoreboard[person].last_score, self.scoreboard[person].cumulative_score, self.scoreboard[person].last_time))
  414 
  415         self.treeview.set_model(self.model)
self = <arithmetic.ArithmeticActivity object at 0x7fcc2...fc0 (arithmetic+ArithmeticActivity at 0x2058260)>
self.model = <Gtk.TreeStore object at 0x7fcc2866cf00 (GtkTreeStore at 0x227b380)>
self.model.append = <bound method TreeStore.append of <Gtk.TreeStore...t at 0x7fcc2866cf00 (GtkTreeStore at 0x227b380)>>
person = '_dict'
self.scoreboard = {'__contains__': <built-in method __contains__ of dict object>, '__eq__': <method-wrapper '__eq__' of dict object>, '__ge__': <method-wrapper '__ge__' of dict object>, '__getitem__': <built-in method __getitem__ of dict object>, '__gt__': <method-wrapper '__gt__' of dict object>, '__le__': <method-wrapper '__le__' of dict object>, '__len__': <method-wrapper '__len__' of dict object>, '__lt__': <method-wrapper '__lt__' of dict object>, '__ne__': <method-wrapper '__ne__' of dict object>, '_clear': (1, 12674677046145236782), ...}
].last_score undefined
].cumulative_score undefined
].last_time undefined
AttributeError: 'dict' object has no attribute 'last_score'
    __cause__ = None
    __class__ = <class 'AttributeError'>
    __context__ = None
    __delattr__ = <method-wrapper '__delattr__' of AttributeError object>
    __dict__ = {}
    __dir__ = <built-in method __dir__ of AttributeError object>
    __doc__ = 'Attribute not found.'
    __eq__ = <method-wrapper '__eq__' of AttributeError object>
    __format__ = <built-in method __format__ of AttributeError object>
    __ge__ = <method-wrapper '__ge__' of AttributeError object>
    __getattribute__ = <method-wrapper '__getattribute__' of AttributeError object>
    __gt__ = <method-wrapper '__gt__' of AttributeError object>
    __hash__ = <method-wrapper '__hash__' of AttributeError object>
    __init__ = <method-wrapper '__init__' of AttributeError object>
    __init_subclass__ = <built-in method __init_subclass__ of type object>
    __le__ = <method-wrapper '__le__' of AttributeError object>
    __lt__ = <method-wrapper '__lt__' of AttributeError object>
    __ne__ = <method-wrapper '__ne__' of AttributeError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of AttributeError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of AttributeError object>
    __repr__ = <method-wrapper '__repr__' of AttributeError object>
    __setattr__ = <method-wrapper '__setattr__' of AttributeError object>
    __setstate__ = <built-in method __setstate__ of AttributeError object>
    __sizeof__ = <built-in method __sizeof__ of AttributeError object>
    __str__ = <method-wrapper '__str__' of AttributeError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __suppress_context__ = False
    __traceback__ = <traceback object>
    args = ("'dict' object has no attribute 'last_score'",)
    with_traceback = <built-in method with_traceback of AttributeError object>

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
  File "/usr/share/sugar/activities/Arithmetic.activity/arithmetic.py", line 413, in onesecond_cb
    self.model.append(None, (person, self.scoreboard[person].last_score, self.scoreboard[person].cumulative_score, self.scoreboard[person].last_time))
AttributeError: 'dict' object has no attribute 'last_score'


AttributeError
Python 3.8.2: /usr/bin/python3
Mon Sep 21 10:09:16 2020

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 /usr/share/sugar/activities/Arithmetic.activity/arithmetic.py in onesecond_cb(self=<arithmetic.ArithmeticActivity object at 0x7fcc2...fc0 (arithmetic+ArithmeticActivity at 0x2058260)>)
  411 
  412         for person in self.scoreboard:
  413             self.model.append(None, (person, self.scoreboard[person].last_score, self.scoreboard[person].cumulative_score, self.scoreboard[person].last_time))
  414 
  415         self.treeview.set_model(self.model)
self = <arithmetic.ArithmeticActivity object at 0x7fcc2...fc0 (arithmetic+ArithmeticActivity at 0x2058260)>
self.model = <Gtk.TreeStore object at 0x7fcc2886df40 (GtkTreeStore at 0x227b230)>
self.model.append = <bound method TreeStore.append of <Gtk.TreeStore...t at 0x7fcc2886df40 (GtkTreeStore at 0x227b230)>>
person = '_dict'
self.scoreboard = {'__contains__': <built-in method __contains__ of dict object>, '__eq__': <method-wrapper '__eq__' of dict object>, '__ge__': <method-wrapper '__ge__' of dict object>, '__getitem__': <built-in method __getitem__ of dict object>, '__gt__': <method-wrapper '__gt__' of dict object>, '__le__': <method-wrapper '__le__' of dict object>, '__len__': <method-wrapper '__len__' of dict object>, '__lt__': <method-wrapper '__lt__' of dict object>, '__ne__': <method-wrapper '__ne__' of dict object>, '_clear': (1, 12674677046145236782), ...}
].last_score undefined
].cumulative_score undefined
].last_time undefined
AttributeError: 'dict' object has no attribute 'last_score'
    __cause__ = None
    __class__ = <class 'AttributeError'>
    __context__ = None
    __delattr__ = <method-wrapper '__delattr__' of AttributeError object>
    __dict__ = {}
    __dir__ = <built-in method __dir__ of AttributeError object>
    __doc__ = 'Attribute not found.'
    __eq__ = <method-wrapper '__eq__' of AttributeError object>
    __format__ = <built-in method __format__ of AttributeError object>
    __ge__ = <method-wrapper '__ge__' of AttributeError object>
    __getattribute__ = <method-wrapper '__getattribute__' of AttributeError object>
    __gt__ = <method-wrapper '__gt__' of AttributeError object>
    __hash__ = <method-wrapper '__hash__' of AttributeError object>
    __init__ = <method-wrapper '__init__' of AttributeError object>
    __init_subclass__ = <built-in method __init_subclass__ of type object>
    __le__ = <method-wrapper '__le__' of AttributeError object>
    __lt__ = <method-wrapper '__lt__' of AttributeError object>
    __ne__ = <method-wrapper '__ne__' of AttributeError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of AttributeError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of AttributeError object>
    __repr__ = <method-wrapper '__repr__' of AttributeError object>
    __setattr__ = <method-wrapper '__setattr__' of AttributeError object>
    __setstate__ = <built-in method __setstate__ of AttributeError object>
    __sizeof__ = <built-in method __sizeof__ of AttributeError object>
    __str__ = <method-wrapper '__str__' of AttributeError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __suppress_context__ = False
    __traceback__ = <traceback object>
    args = ("'dict' object has no attribute 'last_score'",)
    with_traceback = <built-in method with_traceback of AttributeError object>

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
  File "/usr/share/sugar/activities/Arithmetic.activity/arithmetic.py", line 413, in onesecond_cb
    self.model.append(None, (person, self.scoreboard[person].last_score, self.scoreboard[person].cumulative_score, self.scoreboard[person].last_time))
AttributeError: 'dict' object has no attribute 'last_score'



(sugar-activity3:2250): Gtk-CRITICAL **: 10:09:41.659: gtk_tree_store_set_value: assertion 'VALID_ITER (iter, tree_store)' failed

(sugar-activity3:2250): Gtk-CRITICAL **: 10:10:14.559: gtk_tree_store_set_value: assertion 'VALID_ITER (iter, tree_store)' failed


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants