Changeset 103 for pykoticon/trunk/bin/pykoticon
- Timestamp:
- 01/30/06 19:27:57 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykoticon/trunk/bin/pykoticon
r102 r103 90 90 return True 91 91 92 def export_askDatas(self, labels, varnames ) :93 """Asks some textual datas defined by a list of labels and a list of variables' names."""94 wx.CallAfter(self.frame.askDatas, labels, varnames )92 def export_askDatas(self, labels, varnames, varvalues) : 93 """Asks some textual datas defined by a list of labels, a list of variables' names and a list of variables values in a mapping.""" 94 wx.CallAfter(self.frame.askDatas, labels, varnames, varvalues) 95 95 # ugly, isn't it ? 96 while self.frame.dialogAnswer is None :97 time.sleep(0.1)96 #while self.frame.dialogAnswer is None : 97 # time.sleep(0.1) 98 98 # TODO : add value extraction and return a mapping 99 99 self.frame.dialogAnswer = None # prepare for next call, just in case … … 245 245 dialog.Destroy() 246 246 247 def askDatas(self, labels, varnames ) :247 def askDatas(self, labels, varnames, varvalues) : 248 248 """Opens a dialog box asking for data entry.""" 249 249 # use it this way : self.askDatas(["Username", "Password", "Billing code"], ["username", "password", "billingcode"]) 250 frame = wx.Frame(self, wx.ID_ANY, \ 251 _("Enter PyKota information"), \ 252 size = (-1, -1), \ 253 style = wxPython.wx.wxDEFAULT_FRAME_STYLE \ 254 | wxPython.wx.wxSIZE_AUTO_HEIGHT \ 255 | wxPython.wx.wxSIZE_AUTO_WIDTH \ 256 | wxPython.wx.wxNO_FULL_REPAINT_ON_RESIZE) 250 257 self.dialogAnswer = None 251 panel = wx.Panel(self, wx.ID_ANY)252 258 values = {} 253 sizer = wx.BoxSizer(wx.VERTICAL)259 vsizer = wx.BoxSizer(wx.VERTICAL) 254 260 for i in range(len(varnames)) : 255 261 varname = varnames[i] … … 261 267 labelid = wx.NewId() 262 268 varid = wx.NewId() 263 label = wx.StaticText(panel, labelid, label) 264 variable = wx.TextCtrl(panel, varid, "Blah !") 265 sizer.Add(label, flag=wx.ALIGN_CENTER | wx.ALL) 266 sizer.Add(variable, flag=wx.ALIGN_CENTER | wx.ALL) 267 okbutton = wx.Button(panel, wx.ID_ANY, "OK") 268 sizer.Add(okbutton, flag=wx.ALIGN_CENTER | wx.ALL) 269 self.SetAutoLayout(True) 270 self.SetSizerAndFit(sizer) 271 self.Layout() 272 #panel.Destroy() 269 label = wx.StaticText(frame, labelid, label) 270 variable = wx.TextCtrl(frame, varid, varvalues.get(varname, "")) 271 hsizer = wx.BoxSizer(wx.HORIZONTAL) 272 hsizer.Add(label, 0, wx.ALIGN_CENTER | wx.ALIGN_RIGHT | wx.ALL, 5) 273 hsizer.Add(variable, 0, wx.ALIGN_CENTER | wx.ALIGN_LEFT | wx.ALL, 5) 274 vsizer.Add(hsizer, 0, wx.ALIGN_CENTER | wx.ALL, 5) 275 okbutton = wx.Button(frame, wx.ID_ANY, "OK") 276 vsizer.Add(okbutton, 0, wx.ALIGN_CENTER | wx.ALL, 5) 277 frame.SetAutoLayout(True) 278 frame.SetSizerAndFit(vsizer) 279 frame.Layout() 280 frame.Show(True) 273 281 274 282 class PyKotIconApp(wx.PySimpleApp):