--- nfo/projects/netfraggle/bin/fraggleDialogPrefs.py 2004/08/25 19:52:04 1.3 +++ nfo/projects/netfraggle/bin/fraggleDialogPrefs.py 2004/08/26 23:10:11 1.5 @@ -1,10 +1,13 @@ #Boa:Dialog:fraggleDialogPrefs from wxPython.wx import * +from fraggleEngine import * def create(parent): return fraggleDialogPrefs(parent) + + [wxID_FRAGGLEDIALOGPREFS, wxID_FRAGGLEDIALOGPREFSBTSAVE, wxID_FRAGGLEDIALOGPREFSBUTTON1, wxID_FRAGGLEDIALOGPREFSSTATICLINE1, wxID_FRAGGLEDIALOGPREFSSTATICLINE2, wxID_FRAGGLEDIALOGPREFSSTATICTEXT1, @@ -30,15 +33,17 @@ self._init_utils() self.SetClientSize(wxSize(366, 188)) - self.btsave = wxButton(id=wxID_FRAGGLEDIALOGPREFSBTSAVE, label='Save', - name='btsave', parent=self, pos=wxPoint(8, 168), size=wxSize(64, - 16), style=0) + self.btsave = wxButton(id=wxID_FRAGGLEDIALOGPREFSBTSAVE, + label='Save and Close', name='btsave', parent=self, + pos=wxPoint(8, 168), size=wxSize(96, 16), style=0) EVT_BUTTON(self.btsave, wxID_FRAGGLEDIALOGPREFSBTSAVE, self.OnBtsaveButton) self.button1 = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTON1, - label='Cancel', name='button1', parent=self, pos=wxPoint(80, 168), - size=wxSize(56, 16), style=0) + label='Cancel', name='button1', parent=self, pos=wxPoint(112, + 168), size=wxSize(56, 16), style=0) + EVT_BUTTON(self.button1, wxID_FRAGGLEDIALOGPREFSBUTTON1, + self.OnButton1Button) self.staticText1 = wxStaticText(id=wxID_FRAGGLEDIALOGPREFSSTATICTEXT1, label='Username', name='staticText1', parent=self, pos=wxPoint(16, @@ -103,4 +108,22 @@ ) self.parent.preferencesCtl.saveConfig() + self.Hide() + event.Skip() + + def loadConfig(self): + engine = FraggleEngine() + prefsfile = os.path.join(engine.getDefaultDir(), 'prefs.xml') + self.parent.preferencesCtl.loadConfig(prefsfile) + + def updateConfig(self): + config = self.parent.preferencesCtl.getConfig() + self.textCtrlUsername.SetValue(config["username"]) + self.textCtrlPassword.SetValue(config["password"]) + self.textCtrlServer.SetValue(config["url"]) + self.textCtrlRetrieval.SetValue(config["retrieval"]) + + def OnButton1Button(self, event): + self.Hide() event.Skip() + \ No newline at end of file