Changeset 106

Show
Ignore:
Timestamp:
02/02/06 14:36:58 (18 years ago)
Author:
jerome
Message:

Data retrieval now is correct.
Password input box now hides what is typed.
Looks good !

Location:
pykoticon/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykoticon/trunk/bin/pykoticon

    r105 r106  
    9595        while self.frame.dialogAnswer is None : 
    9696            time.sleep(0.1) 
    97         # TODO : add value extraction and return a mapping 
    9897        retcode = self.frame.dialogAnswer     
    9998        self.frame.dialogAnswer = None # prepare for next call, just in case 
     
    151150                     | wx.DIALOG_MODAL) 
    152151 
     152        self.variables = [] 
    153153        vsizer = wx.BoxSizer(wx.VERTICAL) 
    154154        for i in range(len(varnames)) : 
     
    161161            varid = wx.NewId() 
    162162            label = wx.StaticText(self, labelid, label) 
    163             variable = wx.TextCtrl(self, varid, varvalues.get(varname, "")) 
     163            if varname.lower().find("password") != -1 : 
     164                variable = wx.TextCtrl(self, varid, varvalues.get(varname, ""), style=wx.TE_PASSWORD) 
     165            else : 
     166                variable = wx.TextCtrl(self, varid, varvalues.get(varname, "")) 
     167            self.variables.append(variable)     
    164168            hsizer = wx.BoxSizer(wx.HORIZONTAL) 
    165169            hsizer.Add(label, 0, wx.ALIGN_CENTER | wx.ALIGN_RIGHT | wx.ALL, 5) 
     
    263267        self.dialogAnswer = None 
    264268        dialog = GenericInputDialog(self, wx.ID_ANY, labels, varnames, varvalues) 
    265         self.dialogAnswer = ((dialog.ShowModal() == wx.ID_OK) and "OK") or "CANCEL" 
    266         print "Result ===> %s" % self.dialogAnswer 
     269        retvalues = {} 
     270        if dialog.ShowModal() == wx.ID_OK : 
     271            retvalues["isValid"] = True 
     272            for i in range(len(varnames)) : 
     273                retvalues[varnames[i]] = dialog.variables[i].GetValue() 
     274        else :         
     275            retvalues["isValid"] = False 
     276            for k in varvalues.keys() : 
     277                retvalues[k] = "" 
     278        self.dialogAnswer = retvalues 
    267279        dialog.Destroy() 
    268280         
  • pykoticon/trunk/tests/test.py

    r104 r106  
    5050 
    5151    server = xmlrpclib.ServerProxy("http://%s:%s" % (arguments[0], arguments[1])) 
    52     result = server.showDialog(message, yesno) 
    53     """ 
     52    #result = server.showDialog(message, yesno) 
     53    #""" 
    5454    result = server.askDatas(["Username", "Password", "Billing code"], \ 
    5555                             ["username", "password", "billingcode"], \ 
    5656                             {"username": username, \ 
    57                               "password": "******", \ 
     57                              "password": "cccccc", \ 
    5858                              "billingcode" : billingcode}) 
    59     """                           
     59    #"""                           
    6060    #server.quitApplication() 
    61     print result # printing OK is safe. 
     61    if result["isValid"] : 
     62        print result # printing OK is safe. 
     63    else :     
     64        print "the end user closed the dialog box !" 
    6265         
    6366if __name__ == "__main__" :