--- nfo/projects/netfraggle/bin/fraggleDialogPrefs.py 2004/08/29 23:23:09 1.8 +++ nfo/projects/netfraggle/bin/fraggleDialogPrefs.py 2004/09/05 00:21:10 1.14 @@ -3,6 +3,8 @@ from wxPython.wx import * from fraggleEngine import * +import FraggleDialogModules + def create(parent): return fraggleDialogPrefs(parent) @@ -11,7 +13,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,17 +21,13 @@ 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), + name='fraggleDialogPrefs', parent=prnt, pos=wxPoint(482, 310), size=wxSize(366, 233), style=wxDEFAULT_DIALOG_STYLE, title='Netfraggle Preferences') self._init_utils() @@ -86,7 +84,7 @@ 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, @@ -118,14 +116,26 @@ 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 for i in list: self.comboBoxProfile.Append(i) - + + def _init_utils(self): + # generated method, don't edit + pass + def __init__(self, parent): self.parent = parent + import __main__ + self.engine = __main__.engine self._init_ctrls(parent) self.__init_profiles() @@ -147,8 +157,7 @@ event.Skip() def loadConfig(self): - engine = FraggleEngine() - prefsfile = os.path.join(engine.getDefaultDir(), 'prefs.xml') + prefsfile = os.path.join(self.parent.engine.getDefaultDir(), 'prefs.xml') self.parent.preferencesCtl.loadConfig(prefsfile) def updateConfig(self): @@ -195,4 +204,15 @@ 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!") + + def OnButtonModulesButton(self, event): + #self.dialogModules.Show() + #self.parent.dialogModules.Hide() + event.Skip()