How to access methods at different object path levels sharing the same interface name? #66
seahawk1986
started this conversation in
General
Replies: 1 comment 2 replies
-
Hello @seahawk1986 Having the two different interfaces share the name is a very bad practice. For example, introspection XML under
There is nothing that prohibits it directly but I want to enforce good practices. As a workaround you can merge those two interfaces in a single class: from __future__ import annotations
from typing import Any, Dict, List, Tuple
from sdbus import (
DbusDeprecatedFlag,
DbusInterfaceCommonAsync,
DbusNoReplyFlag,
DbusPropertyConstFlag,
DbusPropertyEmitsChangeFlag,
DbusPropertyEmitsInvalidationFlag,
DbusPropertyExplicitFlag,
DbusUnprivilegedFlag,
dbus_method_async,
dbus_property_async,
dbus_signal_async,
)
class DeTvdrVdrPluginInterface(
DbusInterfaceCommonAsync,
interface_name="de.tvdr.vdr.plugin",
):
@dbus_method_async(
input_signature="ss",
result_signature="is",
)
async def svdrpcommand(
self,
command: str,
option: str,
) -> Tuple[int, str]:
raise NotImplementedError
@dbus_method_async(
input_signature="ss",
result_signature="b",
)
async def service(
self,
id: str,
data: str,
) -> bool:
raise NotImplementedError
@dbus_method_async(
result_signature="a(ss)",
)
async def list(
self,
) -> List[Tuple[str, str]]:
raise NotImplementedError |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,

I am currently evaluating sdbus for a hobby project and stumbled on an problem with the DBus interface of https://github.com/flensrocker/vdr-plugin-dbus2vdr/ - the structure according to d-feet looks like this (all the
/Plugins/{plugin_name}
objects share the same methods and signatures):sdbus generates those code snippets for the interfaces:
This is written to a file
plugins.py
.This is written to a file
plugin_interface.py
.Now I want to import those Interfaces - this causes an ValueError:
List
on bothde.tvdr.vdr.plugin
andde.tvdr.pluginmanager
does the same thing, so I can remove the collidingDeTvdrVdrPluginInterface
class fromplugins.py
for my purposes, but since this was never a problem with other Python dbus libraries (python-dbus, pydbus, dasbus) I am wondering if there is a way around it (or does this interface something not allowed by the DBus specification?).Beta Was this translation helpful? Give feedback.
All reactions