D-Bus constructor: add Constructors specific flags (--flags argument)
dbus-xml constructor now as annotation flag to add Qt annotation usefull for the Qt frontend (bellaciao)
This commit is contained in:
parent
85f6723867
commit
7d396ee3e4
2 changed files with 26 additions and 3 deletions
|
|
@ -482,7 +482,14 @@ class DbusXmlConstructor(Constructor):
|
|||
Constructor.__init__(self, bridge_template, options)
|
||||
|
||||
self.template="dbus_xml_template.xml"
|
||||
self.core_dest="org.goffi.sat.xml"
|
||||
self.core_dest="org.goffi.sat.xml"
|
||||
self.default_annotation = { 'a{ss}': 'StringDict',
|
||||
'a(sa{ss}as)': 'QList<ContactT>',
|
||||
'a{i(ss)}': 'HistoryT',
|
||||
'a(sss)': 'QList<MenuT>',
|
||||
'a{sa{s(sia{ss})}}': 'PresenceStatusT',
|
||||
'a{sa{ss}}': 'ActionResultExtDataT',
|
||||
}
|
||||
|
||||
def generateCoreSide(self):
|
||||
try:
|
||||
|
|
@ -510,8 +517,15 @@ class DbusXmlConstructor(Constructor):
|
|||
arg_elt = doc.createElement('arg')
|
||||
arg_elt.setAttribute('name', args_doc[idx][0] if args_doc.has_key(idx) else "arg_%i" % idx)
|
||||
arg_elt.setAttribute('type', arg)
|
||||
arg_elt.setAttribute('direction', 'in' if function["type"]=='method' else 'out')
|
||||
_direction = 'in' if function["type"]=='method' else 'out'
|
||||
arg_elt.setAttribute('direction', _direction)
|
||||
new_elt.appendChild(arg_elt)
|
||||
if "annotation" in self.options.flags:
|
||||
if arg in self.default_annotation:
|
||||
annot_elt = doc.createElement("annotation")
|
||||
annot_elt.setAttribute('name', "com.trolltech.QtDBus.QtTypeName.In%d" % idx)
|
||||
annot_elt.setAttribute('value', self.default_annotation[arg])
|
||||
new_elt.appendChild(annot_elt)
|
||||
idx+=1
|
||||
|
||||
if function['sig_out']:
|
||||
|
|
@ -519,6 +533,12 @@ class DbusXmlConstructor(Constructor):
|
|||
arg_elt.setAttribute('type', function['sig_out'])
|
||||
arg_elt.setAttribute('direction', 'out')
|
||||
new_elt.appendChild(arg_elt)
|
||||
if "annotation" in self.options.flags:
|
||||
if function['sig_out'] in self.default_annotation:
|
||||
annot_elt = doc.createElement("annotation")
|
||||
annot_elt.setAttribute('name', "com.trolltech.QtDBus.QtTypeName.Out0")
|
||||
annot_elt.setAttribute('value', self.default_annotation[function['sig_out']])
|
||||
new_elt.appendChild(annot_elt)
|
||||
|
||||
interface_elt.appendChild(new_elt)
|
||||
|
||||
|
|
@ -564,9 +584,12 @@ class BridgeConstructor:
|
|||
help=("Add debug information printing"))
|
||||
parser.add_option("--no_unicode", action="store_false", dest="unicode", default=True,
|
||||
help=("Remove unicode type protection from string results"))
|
||||
parser.add_option("--flags", action="store", type="string",
|
||||
help=("Constructors' specific flags, comma separated"))
|
||||
|
||||
|
||||
(self.options, args) = parser.parse_args()
|
||||
self.options.flags = self.options.flags.split(',') if self.options.flags else []
|
||||
return args
|
||||
|
||||
def go(self):
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ doc=Get history of a communication between two entities
|
|||
doc_param_0=from_jid: source JID
|
||||
doc_param_1=to_jid: dest JID
|
||||
doc_param_2=size: size of the history (0 for the whole history)
|
||||
doc_return=Dict where key is timestamp (seconds this the Epoch), and value is a tuple (from_jid, to_jid)
|
||||
doc_return=Dict where key is timestamp (seconds this the Epoch), and value is a tuple (from_jid, message)
|
||||
|
||||
[addContact]
|
||||
type=method
|
||||
|
|
|
|||
Loading…
Reference in a new issue