Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

rafalgajda-silvair
Copy link
Contributor

This patch adds org.freedesktop.DBus.ObjectManager interface to the default interfaces of the Node.

The interface implements GetManagedObjects method and it exposes InterfacesAdded and InterfacesRemoved although it doesn't implement automatic signal emission.

In addition this patch adds option to select the way introspection is presented. If expanded_intr option is True (False by default) the interface tree in introspection will be expanded i.e:

/
/com
/com/example
/com/example/sample0

else introspection is presented as before:

/com/example/sample0

result = {}

for node in self._path_exports:
if not node.startswith(msg.path):
Copy link
Member

Choose a reason for hiding this comment

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

From the spec:

their object paths start with the ObjectManager's object path plus '/'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I wasn't sure about this.

So as it is at the moment, having interfaces like

/com/example/sample0
/com/example/sample0/ex0

ObjectManager on sample0 returns:

{'/com/example/sample0': {
'com.example.SampleInterface0': {'Bar': 105, 'Foo': 42},
'com.example.SampleInterface1': {'Bar': 105, 'Foo': 42}},
'/com/example/sample0/ex0': {
'com.example.OtherInterface0': {'Bar': 105, 'Foo': 42}}}

while that on ex0:

{'/com/example/sample0/ex0': {
'com.example.OtherInterface0': {'Bar': 105,'Foo': 42}}}

Is it then suppose to be:

{'/com/example/sample0/ex0': {
'com.example.OtherInterface0': {'Bar': 105,'Foo': 42}}}

{}

?

I tried to find some real life examples but not many programs implement this interface and each seam to do their own thing.
Alternatively I cold also just restrict ObjectManager to be available only on '/' however I don't think that's according to spec either.

Copy link
Member

Choose a reason for hiding this comment

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

Is it then suppose to be:

Yeah the spec says it's that second thing how I read it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the behavior to work like in spec and added test in test_standard_interfaces

@@ -28,14 +28,19 @@ class MessageBus(BaseMessageBus):
:type bus_type: :class:`BusType <dbus_next.BusType>`
:param bus_address: A specific bus address to connect to. Should not be
used under normal circumstances.
:param expanded_intr: An option to select expanded interface tree in introspection or just
exported interfaces.
:type expanded_intr: bool
Copy link
Member

Choose a reason for hiding this comment

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

What's the use case for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just an effect of some experimentation. Some dbus libraries return 'expanded' while others 'collapsed' Introspection. I thought this could be, at no great cost, an option left to developer to choose.
I don't have very strong feelings toward this however.

Copy link
Member

Choose a reason for hiding this comment

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

Complexity of the api is a big concern for me because it's already way too complicated. So maybe we should put this off until someone needs it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Option removed

@acrisci
Copy link
Member

acrisci commented Oct 14, 2019

Thanks for the contribution. It needs tests.

@acrisci
Copy link
Member

acrisci commented Oct 16, 2019

Cool, looks ok. Run the linter and formatter with make lint and make format. I saw a lint error.

Any plans to do the signals?

@rafalgajda-silvair
Copy link
Contributor Author

I run the cleanup and committed the files. I don't currently have a lot of time to spare on this but will try to come up with something for the signals in the (hopefully not too distant) future.

@acrisci
Copy link
Member

acrisci commented Oct 17, 2019

👍

@acrisci acrisci merged commit 7a20ba7 into altdesktop:master Oct 17, 2019
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