Changeset 106
- Timestamp:
- 02/02/06 14:36:58 (19 years ago)
- Location:
- pykoticon/trunk
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykoticon/trunk/bin/pykoticon
r105 r106 95 95 while self.frame.dialogAnswer is None : 96 96 time.sleep(0.1) 97 # TODO : add value extraction and return a mapping98 97 retcode = self.frame.dialogAnswer 99 98 self.frame.dialogAnswer = None # prepare for next call, just in case … … 151 150 | wx.DIALOG_MODAL) 152 151 152 self.variables = [] 153 153 vsizer = wx.BoxSizer(wx.VERTICAL) 154 154 for i in range(len(varnames)) : … … 161 161 varid = wx.NewId() 162 162 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) 164 168 hsizer = wx.BoxSizer(wx.HORIZONTAL) 165 169 hsizer.Add(label, 0, wx.ALIGN_CENTER | wx.ALIGN_RIGHT | wx.ALL, 5) … … 263 267 self.dialogAnswer = None 264 268 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 267 279 dialog.Destroy() 268 280 -
pykoticon/trunk/tests/test.py
r104 r106 50 50 51 51 server = xmlrpclib.ServerProxy("http://%s:%s" % (arguments[0], arguments[1])) 52 result = server.showDialog(message, yesno)53 """52 #result = server.showDialog(message, yesno) 53 #""" 54 54 result = server.askDatas(["Username", "Password", "Billing code"], \ 55 55 ["username", "password", "billingcode"], \ 56 56 {"username": username, \ 57 "password": " ******", \57 "password": "cccccc", \ 58 58 "billingcode" : billingcode}) 59 """59 #""" 60 60 #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 !" 62 65 63 66 if __name__ == "__main__" :