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 TelepathyGLib #14
Conversation
* Embed Channel class from `scr/client/channel.py` file of telepathy sources. * Embed InterfaceFactory class from `src/client/interfacefactory.py` file of telepathy sources. * Remove some unused variables. * Remove description comments from the code.
Tested as at e130234 and toolkit as at sugarlabs/sugar-toolkit-gtk3@01cfd5f on Ubuntu 19.04 KVM virtual machines.
Function was correct. Well done. Reviewed.
|
Tested e130234 and toolkit as at sugarlabs/sugar-toolkit-gtk3@01cfd5f on Sugar live build virtual machines.
It'll be great to change e130234 to use imports once sugarlabs/sugar-toolkit-gtk3#412 is merged, but it won't be necessary if you follow James' review. |
@quozl @chimosky thanks for testing, made the changes @quozl suggested.
@chimosky sorry I am not able to understand, can you please share the full traceback.
Yes, I did had that in my mind, but I also agree with what James said in sugarlabs/sugar-toolkit-gtk3#412
|
Reviewed 75c7f78 changes. Noted the new import of The |
Thanks, fixed it. |
@quozl I merged the two classes, removing all the unused methods please have a look. Thanks! |
Yes, I did too, see 58a4ba7 ... but without a test harness, it can't be tested, so I'm working on that now. |
Thanks, reviewed. I did notice some methods which are (most probably) not used in the collabwrapper code as far as I studied |
Yes, but I wanted to prove they weren't used. ;-) Adding a send button to test activity. |
Ohh! Thanks. :-) |
So far, I've discovered that;
It isn't clear to me why I'm still working on testing. The only activity that uses this feature is ImageViewer. https://github.com/quozl/collabwrapper/commits/trim contains my work in progress for changes to the test activity. The Gio.MemoryOutputStream instance misbehaves, or the code does something wrong;
Seems unrelated, but I'd rather not merge something that can't be proven to work. |
Thanks a lot for testing.
Agreed.
I am also not sure about that, since it is something taken from the telepathy sources, I just verified whether the method is called or not. The only difference we created was to embed the classes from the sources into our code. So I expect the methods to work as they are working before, provided with correct arguments (which we are ensuring).
I reviewed the changes in your branch. This Traceback also seems unrelated to me. |
Now that InterfaceFactory is removed, the next step is to remove the Channel class, so we'll be using the TelepathyGLib API directly.
Thanks.
True, but critical to fix, otherwise we can't test what you've done. If it weren't for ImageViewer using this code, I'd remove it instead. |
I looked into the sources and found out this
I think there is something wrong in the way the code is written. Don't you think we should put this line
Please also have a look at the first answer here and also please give it a read. I also noticed that the share to my neighbourhood button for ImageViewer is also disabled. |
By your statement I understand embedding the variables in the code, so that there is no need of calling the classes. Please see my comment in sugar pull request. |
Cause of the "Stream has outstanding operation" is the Putting it another way, the sequence is;
Perhaps instead of relying on the FileTransfer state change, a |
quozl@eb69ed7 is the fix to "Stream has outstanding operation". |
Thanks, reviewed. Should I cherry pick your commit into my branch? |
* Only __getitem__ method of InterfaceFactory is used in the code. * No method of Channel is used. Remove unused methods and variables, resulting in a merged _Channel class.
You are always welcome to do that, but there are other commits in the branch to consider as well. The new file "Send" test passes with all commits in the branch. I'm next looking into how to get rid of |
Thanks!
Yes, I am working on that too. :-) |
It seems
Then it acts as a dictionary linking interface names to _dbus.Interface_a, except for the special case of the default interface. It seems unnecessarily complicated. We can't keep using it, as we are bypassing TelepathyGLib by using D-Bus directly, so any future changes to TelepathyGLib may conflict. We should be able to create a TelepathyGLib.Channel just like Chat activity does. The tests and example code in the Telepathy sources may be of use. I'm stopping now. I'll look at it briefly tomorrow morning my time, then next chance will be on Monday afternoon. Have fun! 😁 |
Thanks. So we have to remove the use of |
That's an odd way to put it.
The goal was to port from the static binding |
Thanks @quozl, got your point. The way, I am proceeding does not include use of Please guide. I tried with |
Yes. And this change is to be in sugar-toolkit-gtk3. It probably can't be done in CollabWrapper alone, otherwise the activity would have two connections; one created by the toolkit, one created by the activity. They would not share relevant state or configuration.
If by that you mean remove all use of |
Thanks. I did had a look into the toolkit source code, realising that a major code change will be involved. |
Correction; all use of |
If you like, but I'm surprised you need to ask. 😁
You'll need fairly complete knowledge of every Telepathy feature that Sugar uses. Cause of this mess is that Sugar was written a long time ago when the Telepathy API was inadequate or required use of D-Bus, and since then the Telepathy API has changed without Sugar changing enough. Until your work on this, I was unaware the problem was so large. |
I had said above;
Can I have review of this by @pro-panda and @chimosky please? Arguments for leaving the use of D-Bus in place are;
|
Wanted to add some inputs of mine 😅
Yes that might be possible in this way:-
And Yeah, one more point.
Ultimately we will have a source code using TelepathyGLib API's , having Dbus to read the Telepathy Connection. Waiting for @chimosky and @pro-panda to review. |
Thanks. I've been reading TelepathyGLib and dbus-python docs too. Also, just found the PyGObject D-Bus API, it is hiding in Gio.DBus*, and the APIs named DBus and DBusGLib are very bare. What a mess. 😁 |
Yes. Agreed. Ultimately Telepathy is a D-Bus API. TelepathyGLib is a Telepathy specific API that was designed to make Telepathy use easier. 😄 . |
See section 20.4 of the overview of Telepathy’s architecture, by Danielle Madeley. In her view,
So I think our problem is we have a code base which is mostly using the D-Bus API, but some parts have used the low-level binding instead of D-Bus. If those parts are few and far between, we might instead convert them to using D-Bus API. |
Yes. Agreed. Those includes parts having call to What about constants ? Can we continue using them through TelepathyGLib? |
Yes, I'm happy with using constants from TelepathyGLib. Acquiring them can be simpler, and more like how we acquired from telepathy-python; from gi.repository.TelepathyGLib import IFACE_CHANNEL, \
IFACE_CHANNEL_INTERFACE_GROUP, \
IFACE_CHANNEL_TYPE_TEXT, \
IFACE_CHANNEL_TYPE_FILE_TRANSFER \
... or from gi.repository.TelepathyGLib import \
IFACE_CONNECTION_INTERFACE_ALIASING as CONN_INTERFACE_ALIASING, \
... |
Thanks. I like the second way. It wil prevent us from doing the hardwork of replacing constants everywhere in the file, and will also make it easier to review. 😅 . |
Thanks, I've gone through this discussion. No comments |
Thanks. Briefly reviewed ee5f646. You still have a use of TelepathyGLib functions and classes; the call to TelepathyGLib.Connection.new, can you please replace this with calls through the Telepathy D-Bus API? I'll be back on Monday. |
Done. |
On review, 74072c8 didn't seem to implement any calls through D-Bus.
On test, CollabWrapper instances did not share state, and logs contained
```
Traceback (most recent call last):
File "/home/guest/Activities/CollabWrapperTest.activity/collabwrapper.py", line 234, in __joined_cb
self._setup_text_channel()
File "/home/guest/Activities/CollabWrapperTest.activity/collabwrapper.py", line 248, in _setup_text_channel
self.shared_activity.obj,
AttributeError: 'Activity' object has no attribute 'obj'
```
Test configuration;
* sugarlabs/sugar-toolkit-gtk3@1233eec
* sugarlabs/sugar@7a7c533
* 74072c8
|
Thanks, Activity did have an 'obj' attribute please see line https://github.com/sugarlabs/sugar-toolkit-gtk3/pull/412/files#diff-03de8f54944bb6037c70d8ec36f91c15R266.
Thanks reviewed it again, I didn't find any calls through telepathy classes, replaced them by dbus, did I miss anything? |
Thanks. Cause was /usr/local and /usr both containing different
copies of Toolkit.
In trying to remedy that, the colour and grade prompts appear, because
of "Error parsing public key", in turn because your Toolkit branch is
based on the master branch about a year ago.
Testing again, the invitee instance of CollabWrapper gets this in logs
Traceback (most recent call last):
File "/home/guest/Activities/CollabWrapperTest.activity/collabwrapper.py", line 237, in __joined_cb
self.post({'action': ACTION_INIT_REQUEST})
File "/home/guest/Activities/CollabWrapperTest.activity/collabwrapper.py", line 376, in post
self._text_channel.post(msg)
File "/home/guest/Activities/CollabWrapperTest.activity/collabwrapper.py", line 738, in post
self._send(json.dumps(msg))
File "/home/guest/Activities/CollabWrapperTest.activity/collabwrapper.py", line 744, in _send
if self._text_chan is not None:
AttributeError: '_TextChannelWrapper' object has no attribute '_text_chan'
and ping does not work.
Traceback (most recent call last):
File "/home/guest/Activities/CollabWrapperTest.activity/activity.py", line 112, in _test_clicked_cb
self._collab.post({'action': 'echo-request', 'text': now})
File "/home/guest/Activities/CollabWrapperTest.activity/collabwrapper.py", line 376, in post
self._text_channel.post(msg)
File "/home/guest/Activities/CollabWrapperTest.activity/collabwrapper.py", line 738, in post
self._send(json.dumps(msg))
File "/home/guest/Activities/CollabWrapperTest.activity/collabwrapper.py", line 744, in _send
if self._text_chan is not None:
AttributeError: '_TextChannelWrapper' object has no attribute '_text_chan'
Looking at your change to TelepathyGLib.Connection.new, you have
replaced it with a get_object call.
74072c8
I've not yet tested this part of the code; it will need the changes to
the CollabWrapperTest activity from my trim branch. So I guess you
haven't tested it either?
|
Send test uses the file transfer channel. Buddy who sent the most recent ping request is the target of the transfer. Also fix outstanding operations on Gio.OutputStream. The file transfer status change notification may arrive before the Gio.OutputStream has finished an asynchronous splice. Add a ready signal which is emitted when the splice ends. Also implement set_data and get_data. Sends and checks string constants only.
Tested c0f568f with
464538f928644a9eed8e115f57b685839a5f0450 and;
* ping did work,
* send did work.
|
Yes, as I continued my work from sugarlabs/sugar-toolkit-gtk3#401. Thanks fixed the traceback, did the changes in my local while testing, but forgot to push. 😅
No I have not tested that part. |
@quozl your changes in quozl@0da858c to master are sufficient. So should I close this pr? |
Replaced by #15. |
@quozl @chimosky, please review.
Fixes #1