--- nfo/projects/netfraggle/bin/fraggleDialogPrefs.py 2004/08/25 13:53:48 1.1.1.1 +++ nfo/projects/netfraggle/bin/fraggleDialogPrefs.py 2004/08/25 16:56:59 1.2 @@ -1,84 +1,96 @@ -#Boa:Dialog:wxDialog1 +#Boa:Dialog:fraggleDialogPrefs from wxPython.wx import * def create(parent): - return wxDialog1(parent) + return fraggleDialogPrefs(parent) -[wxID_WXDIALOG1, wxID_WXDIALOG1BTSAVE, wxID_WXDIALOG1BUTTON1, - wxID_WXDIALOG1STATICLINE1, wxID_WXDIALOG1STATICLINE2, - wxID_WXDIALOG1STATICTEXT1, wxID_WXDIALOG1STATICTEXT2, - wxID_WXDIALOG1STATICTEXT3, wxID_WXDIALOG1STATICTEXT4, - wxID_WXDIALOG1STATICTEXT5, wxID_WXDIALOG1TEXTCTRLPASSWORD, - wxID_WXDIALOG1TEXTCTRLRETRIEVAL, wxID_WXDIALOG1TEXTCTRLSERVER, - wxID_WXDIALOG1TEXTCTRLUSERNAME, +[wxID_FRAGGLEDIALOGPREFS, wxID_FRAGGLEDIALOGPREFSBTSAVE, + wxID_FRAGGLEDIALOGPREFSBUTTON1, wxID_FRAGGLEDIALOGPREFSSTATICLINE1, + wxID_FRAGGLEDIALOGPREFSSTATICLINE2, wxID_FRAGGLEDIALOGPREFSSTATICTEXT1, + wxID_FRAGGLEDIALOGPREFSSTATICTEXT2, wxID_FRAGGLEDIALOGPREFSSTATICTEXT3, + wxID_FRAGGLEDIALOGPREFSSTATICTEXT4, wxID_FRAGGLEDIALOGPREFSSTATICTEXT5, + wxID_FRAGGLEDIALOGPREFSTEXTCTRLPASSWORD, + wxID_FRAGGLEDIALOGPREFSTEXTCTRLRETRIEVAL, + wxID_FRAGGLEDIALOGPREFSTEXTCTRLSERVER, + wxID_FRAGGLEDIALOGPREFSTEXTCTRLUSERNAME, ] = map(lambda _init_ctrls: wxNewId(), range(14)) -class wxDialog1(wxDialog): +class fraggleDialogPrefs(wxDialog): def _init_utils(self): # generated method, don't edit pass def _init_ctrls(self, prnt): # generated method, don't edit - wxDialog.__init__(self, id=wxID_WXDIALOG1, name='', parent=prnt, - pos=wxPoint(344, 319), size=wxSize(366, 188), - style=wxDEFAULT_DIALOG_STYLE, title='Netfraggle Preferences') + wxDialog.__init__(self, id=wxID_FRAGGLEDIALOGPREFS, + name='fraggleDialogPrefs', parent=prnt, pos=wxPoint(283, 313), + size=wxSize(366, 188), style=wxDEFAULT_DIALOG_STYLE, + title='Netfraggle Preferences') self._init_utils() self.SetClientSize(wxSize(366, 188)) - self.btsave = wxButton(id=wxID_WXDIALOG1BTSAVE, label='Save', + self.btsave = wxButton(id=wxID_FRAGGLEDIALOGPREFSBTSAVE, label='Save', name='btsave', parent=self, pos=wxPoint(8, 168), size=wxSize(64, 16), style=0) + EVT_BUTTON(self.btsave, wxID_FRAGGLEDIALOGPREFSBTSAVE, + self.OnBtsaveButton) - self.button1 = wxButton(id=wxID_WXDIALOG1BUTTON1, label='Cancel', - name='button1', parent=self, pos=wxPoint(80, 168), size=wxSize(56, - 16), style=0) + self.button1 = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTON1, + label='Cancel', name='button1', parent=self, pos=wxPoint(80, 168), + size=wxSize(56, 16), style=0) - self.staticText1 = wxStaticText(id=wxID_WXDIALOG1STATICTEXT1, + self.staticText1 = wxStaticText(id=wxID_FRAGGLEDIALOGPREFSSTATICTEXT1, label='Username', name='staticText1', parent=self, pos=wxPoint(16, 16), size=wxSize(47, 13), style=0) - self.staticText2 = wxStaticText(id=wxID_WXDIALOG1STATICTEXT2, + self.staticText2 = wxStaticText(id=wxID_FRAGGLEDIALOGPREFSSTATICTEXT2, label='Password', name='staticText2', parent=self, pos=wxPoint(16, 40), size=wxSize(53, 16), style=0) - self.textCtrlUsername = wxTextCtrl(id=wxID_WXDIALOG1TEXTCTRLUSERNAME, + self.textCtrlUsername = wxTextCtrl(id=wxID_FRAGGLEDIALOGPREFSTEXTCTRLUSERNAME, name='textCtrlUsername', parent=self, pos=wxPoint(80, 16), size=wxSize(80, 16), style=0, value='') - self.textCtrlPassword = wxTextCtrl(id=wxID_WXDIALOG1TEXTCTRLPASSWORD, + self.textCtrlPassword = wxTextCtrl(id=wxID_FRAGGLEDIALOGPREFSTEXTCTRLPASSWORD, name='textCtrlPassword', parent=self, pos=wxPoint(80, 40), size=wxSize(80, 16), style=0, value='') - self.staticText3 = wxStaticText(id=wxID_WXDIALOG1STATICTEXT3, + self.staticText3 = wxStaticText(id=wxID_FRAGGLEDIALOGPREFSSTATICTEXT3, label='Server URL', name='staticText3', parent=self, pos=wxPoint(16, 64), size=wxSize(58, 16), style=0) - self.textCtrlServer = wxTextCtrl(id=wxID_WXDIALOG1TEXTCTRLSERVER, + self.textCtrlServer = wxTextCtrl(id=wxID_FRAGGLEDIALOGPREFSTEXTCTRLSERVER, name='textCtrlServer', parent=self, pos=wxPoint(80, 64), size=wxSize(272, 16), style=0, value='http://your.server.com/netfraggle.php') - self.staticText4 = wxStaticText(id=wxID_WXDIALOG1STATICTEXT4, + self.staticText4 = wxStaticText(id=wxID_FRAGGLEDIALOGPREFSSTATICTEXT4, label='Topic Retrieval Interval', name='staticText4', parent=self, pos=wxPoint(16, 144), size=wxSize(120, 16), style=0) - self.textCtrlRetrieval = wxTextCtrl(id=wxID_WXDIALOG1TEXTCTRLRETRIEVAL, + self.textCtrlRetrieval = wxTextCtrl(id=wxID_FRAGGLEDIALOGPREFSTEXTCTRLRETRIEVAL, name='textCtrlRetrieval', parent=self, pos=wxPoint(128, 144), size=wxSize(40, 16), style=0, value='') - self.staticText5 = wxStaticText(id=wxID_WXDIALOG1STATICTEXT5, + self.staticText5 = wxStaticText(id=wxID_FRAGGLEDIALOGPREFSSTATICTEXT5, label='Seconds', name='staticText5', parent=self, pos=wxPoint(176, 144), size=wxSize(56, 16), style=0) - self.staticLine1 = wxStaticLine(id=wxID_WXDIALOG1STATICLINE1, + self.staticLine1 = wxStaticLine(id=wxID_FRAGGLEDIALOGPREFSSTATICLINE1, name='staticLine1', parent=self, pos=wxPoint(0, 144), size=wxSize(368, 0), style=0) - self.staticLine2 = wxStaticLine(id=wxID_WXDIALOG1STATICLINE2, + self.staticLine2 = wxStaticLine(id=wxID_FRAGGLEDIALOGPREFSSTATICLINE2, name='staticLine2', parent=self, pos=wxPoint(0, 56), size=wxSize(368, 8), style=0) def __init__(self, parent): + self.parent = parent self._init_ctrls(parent) + + def OnBtsaveButton(self, event): + self.parent.preferencesCtl.setConfig(self.textCtrlUsername.GetValue(),self.textCtrlPassword.GetValue(), + self.textCtrlServer.GetValue(),self.textCtrlRetrieval.GetValue()) + self.parent.preferencesCtl.saveConfig() + event.Skip()