用于dbus接口客户机定义的python decorator

pydbusdecorator的Python项目详细描述


定义dbu的python装饰器 接口,然后将其用作lib。

有关示例,请参见MPRIS2 (https://github.com/hugosenari/mpris2

另请参见:

dbus2any:将dbus instrospection转换为代码 (https://github.com/hugosenari/dbus2any

要求:

python dbus

示例:

导入decorators

>>> from dbusdecorator import DbusAttr, DbusInterface, DbusMethod

定义dbus接口

>>> @DbusInterface('org.mpris.MediaPlayer2', '/org/mpris/MediaPlayer2')
>>> class Player(object):
>>>    @DbusMethod
>>>    def Next(self):
>>>       pass
>>>    @DbusAttr
>>>    def Volume(self):
>>>       pass

使用您的定义

>>> mediaplayer2 = Player(
>>>    dbus_interface_info={
>>>       'dbus_uri': 'org.mpris.MediaPlayer2.gmusicbrowser'})
>>> mediaplayer2.Next()
>>> print mediaplayer2.Volume
>>> mediaplayer2.Volume = 1
>>> print mediaplayer2.Volume # integer = 1 :P

另请参见:

dbus2any是一个子项目,现在我只为此创建了一个项目 (https://github.com/hugosenari/dbus2any

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在jetty请求日志中添加milliscond字段?   java在使用Scanner类从文件读取信息时遇到问题   为什么。类不适用于泛型类型?   SQLite插入上的java空指针异常   java能告诉我们Guava缓存是在禁用统计数据的情况下构建的吗?   java在应用程序中使用常量   java无法使用AutoIT和Selenium Webdriver在所需位置/文件夹保存图像   java如何在jtable中更新jprogress栏   java是比较给定日期和当前日期(在给定时区中没有时间段)的最佳方法   安卓代码中的java错误   java无法访问实体类中的字段   java如何在tomcat中处理三个JDBC连接池?   java无法使用Spring Security保护AngularJS页面   如何在没有TCP/IP协议栈的情况下用Java发送以太帧