Changeset 107 for pykoticon

Show
Ignore:
Timestamp:
02/02/06 16:13:01 (18 years ago)
Author:
jerome
Message:

Now the network dialog is binary safe.

Location:
pykoticon/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykoticon/trunk/bin/pykoticon

    r106 r107  
    8484    def export_quitApplication(self) :     
    8585        """Makes the application quit.""" 
    86         self.logDebug("Remote host asked to close the application.") 
    8786        self.frame.quitEvent.set() 
    8887        wx.CallAfter(self.frame.OnClose, None) 
     
    9190    def export_askDatas(self, labels, varnames, varvalues) : 
    9291        """Asks some textual datas defined by a list of labels, a list of variables' names and a list of variables values in a mapping.""" 
    93         wx.CallAfter(self.frame.askDatas, labels, varnames, varvalues) 
     92        values = {} 
     93        for (k, v) in varvalues.items() : 
     94            values[k] = v.data 
     95        wx.CallAfter(self.frame.askDatas, [ v.data for v in labels ], \ 
     96                                          varnames, \ 
     97                                          values) 
     98        # ugly, isn't it ? 
     99        while self.frame.dialogAnswer is None : 
     100            time.sleep(0.1) 
     101        retcode = self.frame.dialogAnswer     
     102        for (k, v) in retcode.items() : 
     103            if k != "isValid" : 
     104                retcode[k] = xmlrpclib.Binary(v) 
     105        self.frame.dialogAnswer = None # prepare for next call, just in case 
     106        return retcode 
     107         
     108    def export_showDialog(self, message, yesno) : 
     109        """Opens a notification or confirmation dialog.""" 
     110        wx.CallAfter(self.frame.showDialog, message.data, yesno) 
    94111        # ugly, isn't it ? 
    95112        while self.frame.dialogAnswer is None : 
     
    99116        return retcode 
    100117         
    101     def export_showDialog(self, message, yesno) : 
    102         """Opens a notification or confirmation dialog.""" 
    103         wx.CallAfter(self.frame.showDialog, message, yesno) 
    104         # ugly, isn't it ? 
    105         while self.frame.dialogAnswer is None : 
    106             time.sleep(0.1) 
    107         retcode = self.frame.dialogAnswer     
    108         self.frame.dialogAnswer = None # prepare for next call, just in case 
    109         return retcode 
    110          
    111118    def export_nop(self) :     
    112119        """Does nothing, but allows a clean shutdown from the frame itself.""" 
    113         self.logDebug("No operation !") 
    114120        return True 
    115121         
  • pykoticon/trunk/tests/test.py

    r106 r107  
    5050 
    5151    server = xmlrpclib.ServerProxy("http://%s:%s" % (arguments[0], arguments[1])) 
    52     #result = server.showDialog(message, yesno) 
     52    #result = server.showDialog(xmlrpclib.Binary(message), yesno) 
    5353    #""" 
    54     result = server.askDatas(["Username", "Password", "Billing code"], \ 
     54    result = server.askDatas([xmlrpclib.Binary(v) for v in ["Username", "Password", "Billing code"]], \ 
    5555                             ["username", "password", "billingcode"], \ 
    56                              {"username": username, \ 
    57                               "password": "cccccc", \ 
    58                               "billingcode" : billingcode}) 
     56                             {"username": xmlrpclib.Binary(username), \ 
     57                              "password": xmlrpclib.Binary(""), \ 
     58                              "billingcode" : xmlrpclib.Binary(billingcode)}) 
    5959    #"""                           
    6060    #server.quitApplication() 
    6161    if result["isValid"] : 
    62         print result # printing OK is safe. 
     62        print "\n".join(["%s => '%s'" % (k, v.data) for (k, v) in result.items() if k != "isValid"]) 
    6363    else :     
    6464        print "the end user closed the dialog box !"