python类PARAM_READWRITE的实例源码

dbus_props.py 文件源码 项目:oacids 作者: openaps 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def _reflect_on_gproperty(cls, prop):
        gname = prop.name.replace('-', '_')
        type_sig = cls.PROP_SIGS.get(gname, 'v')
        access_map = {
          gobject.PARAM_READWRITE: 'readwrite'
        , gobject.PARAM_READABLE: 'read'
        , gobject.PARAM_WRITABLE: 'write'
        }
        access = 'read'
        if getattr(cls.__class__, gname, None):
          access = access_map.get(getattr(cls.__class__, gname).flags, 'read')
        reflection_data = '    <property name="%s" type="%s" access="%s">\n' % (gname, type_sig, access)
        for annotation in getattr(prop, '_dbus_annotations', [ ]):
            reflection_data += '      <annotation name="%s" value="true" />\n' % pair
            # reflection_data += '      <arg direction="in"  type="%s" name="%s" />\n' % pair

        reflection_data += '    </property>\n'

        return reflection_data
dbus_props.py 文件源码 项目:oacids 作者: openaps 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def _reflect_on_dict(cls, props):
        reflection_data = ''
        for name, prop in props.items( ):
          value = prop
          type_sig = cls.PROP_SIGS.get(name, 'v')
          access_map = {
            gobject.PARAM_READWRITE: 'readwrite'
          , gobject.PARAM_READABLE: 'read'
          , gobject.PARAM_WRITABLE: 'write'
          }
          access = 'readwrite'
          reflection_data += '    <property name="%s" type="%s" access="%s">\n' % (name, type_sig, access)
          for annotation in getattr(prop, '_dbus_annotations', [ ]):
              reflection_data += '      <annotation name="%s" value="true" />\n' % pair
              # reflection_data += '      <arg direction="in"  type="%s" name="%s" />\n' % pair

          reflection_data += '    </property>\n'

        return reflection_data


问题


面经


文章

微信
公众号

扫码关注公众号