1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| class FormDialog(sc.SizedDialog):
def __init__(self, parent, id):
sc.SizedDialog.__init__(self, None, -1, "Configuration FTP Home",
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,size=wx.Size(600, 400))
cPane = self.GetContentsPane()
pane = sc.SizedScrolledPanel(cPane, wx.ID_ANY)
pane.SetSizerProps(expand=True, proportion=1)
pane.SetSizerType("form")
wx.StaticText(pane, -1, "Recuperation fichiers")
radioPane = sc.SizedPanel(pane, -1)
radioPane.SetSizerType("horizontal")
radioPane.SetSizerProps(expand=True)
# make these children of the radioPane to have them use
# the horizontal layout
self.button_ftp= wx.RadioButton(radioPane, -1, "FTP")
button_file=wx.RadioButton(radioPane, -1, "Fichier.")
self.button_ftp.Bind(wx.EVT_RADIOBUTTON, self.EvtRadioBox)
button_file.Bind(wx.EVT_RADIOBUTTON, self.EvtRadioBox)
#self.Bind(wx.EVT_RADIOBUTTON, self.EvtRadioBox, wx.RadioBu tton)
#pane.Bind(wx.EVT_RADIOBUTTON,button_ftp,self.EvtRadioBox)
#pane.Bind(wx.EVT_RADIOBUTTON, self.EvtRadioBox, id=button_ftp.GetId())
#self.Bind(wx.EVT_RADIOBUTTON,button_ftp,self.EvtRadioBox)
self.buttonDir = wx.Button(pane, 20, "Browse Folder!", (20, 25))
self.Bind(wx.EVT_BUTTON, self.opendir, self.buttonDir)
wx.StaticText(pane, -1, "Adresse")
textCtrl = wx.TextCtrl(pane, -1, "")
textCtrl.SetSizerProps(expand=True)
#wx.StaticText(pane, -1, "Port")
textCtrl = wx.TextCtrl(pane, -1, "",name="Port:")#,validator = MyValidator(DIGIT_ONLY))
textCtrl.SetSizerProps(expand=True)
wx.StaticText(pane, -1, "Utilisateur")
textCtrl = wx.TextCtrl(pane, -1, "")
textCtrl.SetSizerProps(expand=True)
wx.StaticText(pane, -1, "Mot de passe")
textCtrl = wx.TextCtrl(pane, -1, "",style=wx.TE_PASSWORD)
textCtrl.SetSizerProps(expand=True)
# The dialog is not in the screen anymore, but it's still in memory
#for you to access it's values. remove it from there.
#dd.Destroy()
self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL))
def opendir(self, event):
dlg = wx.DirDialog(self, "Choose a directory:", style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON)
if dlg.ShowModal() == wx.ID_OK:
self.SetStatusText('You selected: %s\n' % dlg.GetPath())
dlg.Destroy()
def EvtRadioBox(self, event):
baudRate1 = str(self.button_ftp.GetValue())
print 'EvtRadioBox:',baudRate1
if self.button_ftp.GetValue():
self.buttonDir.Hide()
else:
self.buttonDir.Show()
#print 'baudRate1: %d\n' % event.GetInt()
return True
def OnCloseWindow(self, event):
self.Destroy()
exit()
def OnClick(self, event):
dlg = BrowseFolder(self)
dlg.Destroy() |
Partager