-
Notifications
You must be signed in to change notification settings - Fork 12
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
Port to Python3|TelepathyGlib #21
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
How did you test collaboration?
Can you work toward making sprites.py consistent with sprites.py in other activities that have been ported? There's no reason to make this one different, and some good reasons to make it the same.
Thanks @Saumya-Mishra9129 You can have a look at As @quozl pointed out, you have used old_div, in spite of this you could have simply used You can test collaboration by setting up two sugar environments and confirm that you can collaborate Also, there is already a pull request #20 with the title |
Thanks for comments.
It is best to test to find the type of the arguments given to the division. Use
It is nice to have more than one person working on a problem, but I do expect more cooperation and sharing of the patches. Unless patches are shared between the pull requests, then whichever pull request is ready to merge will merge first, then the other pull request will be considered as additional and may need to rebase. That's why it is very helpful for the two developers who began the two pull requests to review and merge each other's work into their own branches, rather than try to work apart. |
I will take care of cooperation next time. Is there any other activity rather than Sugar Toolkit which needs compatibility with both python 2 and 3? I was using old_div so that division operator work fine with python3 as with python2. I was using futurize as a tool for conversion from python 2 to python 3. I guess I should use 2to3 tool only. |
In my opinion, No. Sugar Toolkit needs compatibility with both python 2 and 3 because some activities are running on python3 and some are still on python2( like this activity). So in order to support both the type of activities, the sugar toolkit is made compatible for both 2 and 3.
I don't know much about futurize and it's advantages over Have a look at Porting Guide (in case you haven't 😁 ) Thanks |
No, not that I know of. I did consider it when planning the port for all of Sugar, because I'm to maintain Python 2 branches for use on the OLPC XO laptops which are stuck on Python 2 (not your problem). But the amount of change in activities has not been sufficient to justify the effort. Instead I backport patches as needed from master to python2 branch. |
Don't want to be that dude, but the // operator works the same way
on Python 2 and Python 3.
Well said, Sanjay, thanks.
(Aside; a trouble with discussing style and porting in pull requests
is that not everyone who has an opinion is present. Best in future if
challenges to our style are discussed on sugar-devel@).
|
@quozl @sanjay237 thanks for suggestions. |
Almost every output of |
I have tried to fix Collaboration of activity as I am trying to port the activity to Collabwrapper , the port is still under process but yet I have made some changes. A review is requested here to proceed further as I am still getting some D-Bus connection related errors. |
In general it looks kinda right, but you need to get it working before it is worth doing a detailed review. If you face an error you cannot resolve, do ask about it. |
I agree with @quozl above, I took a look and made some comments. |
This comment has been minimized.
This comment has been minimized.
add len argument in Gtk.Clipboard set_text method set len=-1 Fixes Error: TypeError: Gtk.Clipboard.set_text() takes exactly 3 arguments (2 given)
5b0f80e
to
d88651f
Compare
I am making new commits here as previous commits and port was based on futurize tool , and It makes difficult in reviewing as well as it creates a lot of confusion. I am done with Port to Python3 and TelepathyGLib , and will work on fixing collaboration now. |
write method here used to take unicode in python2 use encoded bytes in place of unicode in python3
7cec31e
to
9b742ad
Compare
Tested Collaboration, working i.e. game state is shared. However when a player wins and goes to new level, until second player doesn't reach to same level as first, game state is not shared. |
So to paraphrase, you're not sure how to implement shared game state after the first round? I think the game state should be the same; perhaps the new level should only occur once both players have won it once. If a wider discussion is needed, use the issue #18. |
No that is not the case. The way I have implemented collaboration , works only when both players plays on same levels. If one player wins first, collaboration stops and resumes when second player comes on same level as first. however as you said level upgradation should only be possible when both players win. I was saying about perhaps it can be the case that author who have designed the activity , wanted collaboration this way. I am not sure, but it can be possible. |
I haven't tested collaboration, but is it possible to start a new game when either player wins? This way you can ensure that the game state will always be shared. |
|
||
self._collab = CollabWrapper(self) | ||
self._collab.connect('message', self._message_cb) | ||
self._collab.connect('joined', self._joined_cb) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll be better to have the joined signal connected from one API to one callback, not having one from two different APIs to same callback.
SearchActivity.py
Outdated
self._game.remote_button_press(dot, color) | ||
|
||
def send_event(self, entry): | ||
def send_event(self, command, payload): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also get rid of this method and simply have collab.post
calls where you need them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
@Saumya-Mishra9129 said
Collaboration should work when players are on the same level and when one wins, the other player's game state should be automatically updated and the player should be on the same level as the previous winner. |
I agree. Thanks for expressing it this way. |
a5cf0cd
to
6ba39c5
Compare
6ba39c5
to
695b73f
Compare
@quozl I have tested the activity it is working properly . The shell.log contains
Normal Successfull completion, pid 1026 activity_id
7d2d4f14a8afe2e95921ba35e602ec40c6bfc7a2`. Kindly review it.