Mercurial > libervia-backend
comparison src/bridge/bridge_constructor/bridge_constructor.py @ 2050:046449cc2bff
core, bridge, frontends: removed deprecated bridge method askConfirmation, confirmationAnswer, actionResult, actionResultExt and getWaitingConf
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 28 Aug 2016 19:23:58 +0200 |
parents | 2daf7b4c6756 |
children | e1015a5df6f5 |
comparison
equal
deleted
inserted
replaced
2049:b67aece4a667 | 2050:046449cc2bff |
---|---|
165 yield signature[start:i] | 165 yield signature[start:i] |
166 start = i | 166 start = i |
167 | 167 |
168 def getArguments(self, signature, name=None, default=None, unicode_protect=False): | 168 def getArguments(self, signature, name=None, default=None, unicode_protect=False): |
169 """Return arguments to user given a signature | 169 """Return arguments to user given a signature |
170 | |
170 @param signature: signature in the short form (using s,a,i,b etc) | 171 @param signature: signature in the short form (using s,a,i,b etc) |
171 @param name: dictionary of arguments name like given by getArguments | 172 @param name: dictionary of arguments name like given by getArguments |
172 @param default: dictionary of default values, like given by getDefault | 173 @param default: dictionary of default values, like given by getDefault |
173 @param unicode_protect: activate unicode protection on strings (return strings as unicode(str)) | 174 @param unicode_protect: activate unicode protection on strings (return strings as unicode(str)) |
174 @return: list of arguments that correspond to a signature (e.g.: "sss" return "arg1, arg2, arg3")""" | 175 @return: list of arguments that correspond to a signature (e.g.: "sss" return "arg1, arg2, arg3") |
176 """ | |
175 idx = 0 | 177 idx = 0 |
176 attr_string = [] | 178 attr_string = [] |
177 | 179 |
178 for arg in self.argumentsParser(signature): | 180 for arg in self.argumentsParser(signature): |
179 attr_string.append(("unicode(%(name)s)%(default)s" if (unicode_protect and arg == 's') else "%(name)s%(default)s") % { | 181 attr_string.append(("unicode(%(name)s)%(default)s" if (unicode_protect and arg == 's') else "%(name)s%(default)s") % { |
274 sections = self.bridge_template.sections() | 276 sections = self.bridge_template.sections() |
275 sections.sort() | 277 sections.sort() |
276 for section in sections: | 278 for section in sections: |
277 function = self.getValues(section) | 279 function = self.getValues(section) |
278 print ("Adding %s %s" % (section, function["type"])) | 280 print ("Adding %s %s" % (section, function["type"])) |
279 default = self.getDefault(section) | |
280 async_msg = """<br />'''This method is asynchronous'''""" | 281 async_msg = """<br />'''This method is asynchronous'''""" |
281 deprecated_msg = """<br />'''<font color="#FF0000">/!\ WARNING /!\ : This method is deprecated, please don't use it !</font>'''""" | 282 deprecated_msg = """<br />'''<font color="#FF0000">/!\ WARNING /!\ : This method is deprecated, please don't use it !</font>'''""" |
282 signature_signal = \ | 283 signature_signal = \ |
283 """\ | 284 """\ |
284 ! scope=row | signature | 285 ! scope=row | signature |
514 self.default_annotation = {'a{ss}': 'StringDict', | 515 self.default_annotation = {'a{ss}': 'StringDict', |
515 'a(sa{ss}as)': 'QList<Contact>', | 516 'a(sa{ss}as)': 'QList<Contact>', |
516 'a{i(ss)}': 'HistoryT', | 517 'a{i(ss)}': 'HistoryT', |
517 'a(sss)': 'QList<MenuT>', | 518 'a(sss)': 'QList<MenuT>', |
518 'a{sa{s(sia{ss})}}': 'PresenceStatusT', | 519 'a{sa{s(sia{ss})}}': 'PresenceStatusT', |
519 'a{sa{ss}}': 'ActionResultExtDataT'} | 520 } |
520 | 521 |
521 def generateCoreSide(self): | 522 def generateCoreSide(self): |
522 try: | 523 try: |
523 doc = minidom.parse(self.template) | 524 doc = minidom.parse(self.template) |
524 interface_elt = doc.getElementsByTagName('interface')[0] | 525 interface_elt = doc.getElementsByTagName('interface')[0] |
534 for section in sections: | 535 for section in sections: |
535 function = self.getValues(section) | 536 function = self.getValues(section) |
536 print ("Adding %s %s" % (section, function["type"])) | 537 print ("Adding %s %s" % (section, function["type"])) |
537 new_elt = doc.createElement('method' if function["type"] == 'method' else 'signal') | 538 new_elt = doc.createElement('method' if function["type"] == 'method' else 'signal') |
538 new_elt.setAttribute('name', section) | 539 new_elt.setAttribute('name', section) |
539 args_in_str = self.getArguments(function['sig_in']) | |
540 | 540 |
541 idx = 0 | 541 idx = 0 |
542 args_doc = self.getArgumentsDoc(section) | 542 args_doc = self.getArgumentsDoc(section) |
543 for arg in self.argumentsParser(function['sig_in'] or ''): | 543 for arg in self.argumentsParser(function['sig_in'] or ''): |
544 arg_elt = doc.createElement('arg') | 544 arg_elt = doc.createElement('arg') |