Mercurial > libervia-backend
comparison sat.tac @ 107:5ae370c71803
CS: message sending is now working
- xmltools/xmlui: buttons can now send fields of the ui when used
- xmltools/xmlui: new textbox element, to write a large text (used for messages in CS plugin)
- xmltools/xmlui: list have now an attribute multi for selecting several options
- xmltools/xmlui: window title can now be specified in the xml (attribute title)
- CS_plugin: message sending interface & management
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 28 Jun 2010 15:18:59 +0800 |
parents | 138d82f64b6f |
children | ded2431cea5a |
comparison
equal
deleted
inserted
replaced
106:138d82f64b6f | 107:5ae370c71803 |
---|---|
474 connector = reactor.connectTCP(server, port, serverRegistrer) | 474 connector = reactor.connectTCP(server, port, serverRegistrer) |
475 serverRegistrer.clientConnectionLost = lambda conn, reason: connector.disconnect() | 475 serverRegistrer.clientConnectionLost = lambda conn, reason: connector.disconnect() |
476 | 476 |
477 return next_id | 477 return next_id |
478 | 478 |
479 def registerNewAccountCB(self, id, data): | 479 def registerNewAccountCB(self, id, data, profile): |
480 #FIXME: gof: profile not managed here ! | 480 #FIXME: gof: profile not managed here ! |
481 user = jid.parse(self.memory.getParamA("JabberID", "Connection"))[0] | 481 user = jid.parse(self.memory.getParamA("JabberID", "Connection"))[0] |
482 password = self.memory.getParamA("Password", "Connection") | 482 password = self.memory.getParamA("Password", "Connection") |
483 server = self.memory.getParamA("Server", "Connection") | 483 server = self.memory.getParamA("Server", "Connection") |
484 | 484 |
556 raise Exception #TODO: raise a proper exception | 556 raise Exception #TODO: raise a proper exception |
557 if not self.profiles.has_key(profile): | 557 if not self.profiles.has_key(profile): |
558 return False | 558 return False |
559 return self.profiles[profile].isConnected() | 559 return self.profiles[profile].isConnected() |
560 | 560 |
561 def launchAction(self, type, data): | 561 def launchAction(self, type, data, profile_key='@DEFAULT@'): |
562 """Launch a specific action asked by client | 562 """Launch a specific action asked by client |
563 @param type: action type (button) | 563 @param type: action type (button) |
564 @param data: needed data to launch the action | 564 @param data: needed data to launch the action |
565 | 565 |
566 @return: action id for result, or empty string in case or error | 566 @return: action id for result, or empty string in case or error |
567 """ | 567 """ |
568 profile = self.memory.getProfileName(profile_key) | |
569 if not profile: | |
570 error (_('trying to launch action with a non-existant profile')) | |
571 raise Exception #TODO: raise a proper exception | |
568 if type=="button": | 572 if type=="button": |
569 try: | 573 try: |
570 cb_name = data['callback_id'] | 574 cb_name = data['callback_id'] |
571 except KeyError: | 575 except KeyError: |
572 error (_("Incomplete data")) | 576 error (_("Incomplete data")) |
573 return "" | 577 return "" |
574 id = sat_next_id() | 578 id = sat_next_id() |
575 self.callGeneralCB(cb_name, id, data) | 579 self.callGeneralCB(cb_name, id, data, profile = profile) |
576 return id | 580 return id |
577 else: | 581 else: |
578 error (_("Unknown action type")) | 582 error (_("Unknown action type")) |
579 return "" | 583 return "" |
580 | 584 |
739 def callGeneralCB(self, name, *args, **kwargs): | 743 def callGeneralCB(self, name, *args, **kwargs): |
740 """Call general function back""" | 744 """Call general function back""" |
741 try: | 745 try: |
742 return self.__general_cb_map[name](*args, **kwargs) | 746 return self.__general_cb_map[name](*args, **kwargs) |
743 except KeyError: | 747 except KeyError: |
744 error(_("Trying to call unknown function")) | 748 error(_("Trying to call unknown function (%s)") % name) |
745 return None | 749 return None |
746 | 750 |
747 #Menus management | 751 #Menus management |
748 | 752 |
749 def importMenu(self, category, name, callback, help_string = "", type = "NORMAL"): | 753 def importMenu(self, category, name, callback, help_string = "", type = "NORMAL"): |