--- nfo/projects/netfraggle/bin/fraggleDialogPrefs.py 2004/08/29 22:52:40 1.7 +++ nfo/projects/netfraggle/bin/fraggleDialogPrefs.py 2004/08/31 16:47:03 1.10 @@ -11,7 +11,7 @@ [wxID_FRAGGLEDIALOGPREFS, wxID_FRAGGLEDIALOGPREFSBTSAVE, wxID_FRAGGLEDIALOGPREFSBUTTON1, wxID_FRAGGLEDIALOGPREFSBUTTONPROFILEDEL, wxID_FRAGGLEDIALOGPREFSBUTTONPROFILELOAD, - wxID_FRAGGLEDIALOGPREFSBUTTONPROFILESAVE, + wxID_FRAGGLEDIALOGPREFSBUTTONPROFILESAVE, wxID_FRAGGLEDIALOGPREFSBUTTONTEST, wxID_FRAGGLEDIALOGPREFSCOMBOBOXPROFILE, wxID_FRAGGLEDIALOGPREFSSTATICTEXT1, wxID_FRAGGLEDIALOGPREFSSTATICTEXT2, wxID_FRAGGLEDIALOGPREFSSTATICTEXT3, wxID_FRAGGLEDIALOGPREFSSTATICTEXT4, wxID_FRAGGLEDIALOGPREFSSTATICTEXT5, @@ -19,20 +19,15 @@ wxID_FRAGGLEDIALOGPREFSTEXTCTRLRETRIEVAL, wxID_FRAGGLEDIALOGPREFSTEXTCTRLSERVER, wxID_FRAGGLEDIALOGPREFSTEXTCTRLUSERNAME, -] = map(lambda _init_ctrls: wxNewId(), range(17)) +] = map(lambda _init_ctrls: wxNewId(), range(18)) 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_FRAGGLEDIALOGPREFS, name='fraggleDialogPrefs', parent=prnt, pos=wxPoint(283, 313), - size=wxSize(366, 233), style=wxDEFAULT_DIALOG_STYLE, + size=wxSize(374, 260), style=wxDEFAULT_DIALOG_STYLE, title='Netfraggle Preferences') - self._init_utils() self.SetClientSize(wxSize(366, 233)) self.btsave = wxButton(id=wxID_FRAGGLEDIALOGPREFSBTSAVE, @@ -86,9 +81,12 @@ self.comboBoxProfile = wxComboBox(choices=[], id=wxID_FRAGGLEDIALOGPREFSCOMBOBOXPROFILE, name='comboBoxProfile', - parent=self, pos=wxPoint(80, 8), size=wxSize(124, 16), style=0, + parent=self, pos=wxPoint(80, 8), size=wxSize(124, 21), style=0, validator=wxDefaultValidator, value='') self.comboBoxProfile.SetLabel('') + EVT_COMBOBOX(self.comboBoxProfile, + wxID_FRAGGLEDIALOGPREFSCOMBOBOXPROFILE, + self.OnComboboxprofileCombobox) self.staticText6 = wxStaticText(id=wxID_FRAGGLEDIALOGPREFSSTATICTEXT6, label='Profile', name='staticText6', parent=self, pos=wxPoint(16, @@ -115,6 +113,12 @@ wxID_FRAGGLEDIALOGPREFSBUTTONPROFILELOAD, self.OnButtonprofileloadButton) + self.buttonTest = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTONTEST, + label=u'&Test Account', name=u'buttonTest', parent=self, + pos=wxPoint(264, 208), size=wxSize(96, 16), style=0) + EVT_BUTTON(self.buttonTest, wxID_FRAGGLEDIALOGPREFSBUTTONTEST, + self.OnButtonTestButton) + def __init_profiles(self): list = self.parent.preferencesCtl.getProfileList() print list @@ -123,6 +127,8 @@ def __init__(self, parent): self.parent = parent + import __main__ + self.engine = __main__.engine self._init_ctrls(parent) self.__init_profiles() @@ -144,8 +150,7 @@ event.Skip() def loadConfig(self): - engine = FraggleEngine() - prefsfile = os.path.join(engine.getDefaultDir(), 'prefs.xml') + prefsfile = os.path.join(self.parent.preferencesCtl.getDefaultDir(), 'prefs.xml') self.parent.preferencesCtl.loadConfig(prefsfile) def updateConfig(self): @@ -184,7 +189,18 @@ event.Skip() def OnButtonprofiledelButton(self, event): - #self.parent.preferencesCtl.deleteProfile(self.comboBoxProfile.GetValue()) - #self.comboBoxProfile.Remove(self.comboBoxProfile.GetValue()) + self.parent.preferencesCtl.deleteProfile(self.comboBoxProfile.GetValue()) + self.comboBoxProfile.Delete(self.comboBoxProfile.FindString(self.comboBoxProfile.GetValue())) + self.parent.preferencesCtl.saveProfiles() + self.updateConfig() + event.Skip() + + def OnComboboxprofileCombobox(self, event): event.Skip() - \ No newline at end of file + + def OnButtonTestButton(self, event): + #event.Skip() + if self.engine.authenticate(self.textCtrlServer.GetValue(), self.textCtrlUsername.GetValue(), self.textCtrlPassword.GetValue()): + wxMessageBox("Authentication successful!") + else: + wxMessageBox("Authentication failed!")