diff options
author | Davyd Madeley <davyd@madeley.id.au> | 2009-02-17 13:42:35 +0900 |
---|---|---|
committer | Davyd Madeley <davyd@madeley.id.au> | 2009-02-17 13:42:35 +0900 |
commit | b378a19d1744462d128dc14dece48fed2fb003ce (patch) | |
tree | 96f0e1b6667b52a85ab67d109329274332378751 | |
parent | c27b8064b712420130f4626835e51751dc123868 (diff) |
Report Access for properties
-rw-r--r-- | doc/spec/style.css | 5 | ||||
-rw-r--r-- | doc/templates/interface.html | 1 | ||||
-rw-r--r-- | tools/specparser.py | 12 |
3 files changed, 16 insertions, 2 deletions
diff --git a/doc/spec/style.css b/doc/spec/style.css index 12effb47..d237b6eb 100644 --- a/doc/spec/style.css +++ b/doc/spec/style.css @@ -92,6 +92,11 @@ div.error { border: 1px solid #cc0000; } +div.access { + font-weight: bold; + margin-left: 1ex; +} + div.docstring { margin: 1ex; } diff --git a/doc/templates/interface.html b/doc/templates/interface.html index ee952435..f4f1d185 100644 --- a/doc/templates/interface.html +++ b/doc/templates/interface.html @@ -138,6 +138,7 @@ $property.short_name — $property.dbus_type #if $property.type: (<a href="$property.get_url()" title="$property.get_title()">$property.get_type().short_name</a>) </h2> + <div class="access">$property.get_access()</div> $property.get_added_html() $property.get_deprecated_html() diff --git a/tools/specparser.py b/tools/specparser.py index 26509ef9..469382b5 100644 --- a/tools/specparser.py +++ b/tools/specparser.py @@ -251,8 +251,8 @@ class Typed (base): return '%s(%s:%s)' % (self.__class__.__name__, self.name, self.dbus_type) class Property (Typed): - ACCESS_READ = 0x01 - ACCESS_WRITE = 0x10 + ACCESS_READ = 1 + ACCESS_WRITE = 2 ACCESS_READWRITE = ACCESS_READ | ACCESS_WRITE @@ -271,6 +271,14 @@ class Property (Typed): raise UnknownAccess ("Unknown access `%s' on %s" % ( access, self)) + def get_access (self): + if self.access & self.ACCESS_READ and self.access & self.ACCESS_WRITE: + return 'Read/Write' + elif self.access & self.ACCESS_READ: + return 'Read only' + elif self.access & self.ACCESS_WRITE: + return 'Write only' + class Arg (Typed): DIRECTION_IN, DIRECTION_OUT = range (2) |