--- nfo/projects/netfraggle/bin/fraggleDialogPrefs.py 2004/08/27 21:14:02 1.6 +++ nfo/projects/netfraggle/bin/fraggleDialogPrefs.py 2004/08/29 22:52:40 1.7 @@ -97,19 +97,35 @@ self.buttonProfileSave = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTONPROFILESAVE, label='Save', name='buttonProfileSave', parent=self, pos=wxPoint(272, 8), size=wxSize(40, 16), style=0) + EVT_BUTTON(self.buttonProfileSave, + wxID_FRAGGLEDIALOGPREFSBUTTONPROFILESAVE, + self.OnButtonprofilesaveButton) self.buttonProfileDel = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTONPROFILEDEL, label='Delete', name='buttonProfileDel', parent=self, pos=wxPoint(320, 8), size=wxSize(40, 16), style=0) + EVT_BUTTON(self.buttonProfileDel, + wxID_FRAGGLEDIALOGPREFSBUTTONPROFILEDEL, + self.OnButtonprofiledelButton) self.buttonProfileLoad = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTONPROFILELOAD, label='Load', name='buttonProfileLoad', parent=self, pos=wxPoint(216, 8), size=wxSize(48, 16), style=0) - + EVT_BUTTON(self.buttonProfileLoad, + wxID_FRAGGLEDIALOGPREFSBUTTONPROFILELOAD, + self.OnButtonprofileloadButton) + + def __init_profiles(self): + list = self.parent.preferencesCtl.getProfileList() + print list + for i in list: + self.comboBoxProfile.Append(i) + def __init__(self, parent): self.parent = parent self._init_ctrls(parent) - + self.__init_profiles() + def OnBtsaveButton(self, event): # convert from utf-8: required for win32 @@ -134,12 +150,41 @@ 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"]) - + try: + self.textCtrlUsername.SetValue(config["username"]) + self.textCtrlPassword.SetValue(config["password"]) + self.textCtrlServer.SetValue(config["url"]) + self.textCtrlRetrieval.SetValue(config["retrieval"]) + except TypeError: + self.textCtrlUsername.SetValue("username") + self.textCtrlPassword.SetValue("password") + self.textCtrlServer.SetValue("url") + self.textCtrlRetrieval.SetValue("retrieval") + def OnButton1Button(self, event): self.Hide() event.Skip() + + def OnButtonprofilesaveButton(self, event): + username = self.textCtrlUsername.GetValue() + password = self.textCtrlPassword.GetValue() + url = self.textCtrlServer.GetValue() + retrieval = self.textCtrlRetrieval.GetValue() + self.parent.preferencesCtl.setConfig(username,password,url,retrieval) + i = self.parent.preferencesCtl.appendProfile(self.comboBoxProfile.GetValue(),self.parent.preferencesCtl.configList) + if i == 0: + self.comboBoxProfile.Append(self.comboBoxProfile.GetValue()) + + self.parent.preferencesCtl.saveProfiles() + event.Skip() + + def OnButtonprofileloadButton(self, event): + self.parent.preferencesCtl.loadProfile(self.comboBoxProfile.GetValue()) + self.updateConfig() + event.Skip() + + def OnButtonprofiledelButton(self, event): + #self.parent.preferencesCtl.deleteProfile(self.comboBoxProfile.GetValue()) + #self.comboBoxProfile.Remove(self.comboBoxProfile.GetValue()) + event.Skip() \ No newline at end of file