--- nfo/projects/netfraggle/bin/fraggleDialogPrefs.py 2004/08/29 22:52:40 1.7 +++ nfo/projects/netfraggle/bin/fraggleDialogPrefs.py 2004/09/04 20:26:01 1.13 @@ -3,15 +3,18 @@ from wxPython.wx import * from fraggleEngine import * +import FraggleDialogModules + def create(parent): return fraggleDialogPrefs(parent) [wxID_FRAGGLEDIALOGPREFS, wxID_FRAGGLEDIALOGPREFSBTSAVE, - wxID_FRAGGLEDIALOGPREFSBUTTON1, wxID_FRAGGLEDIALOGPREFSBUTTONPROFILEDEL, + wxID_FRAGGLEDIALOGPREFSBUTTON1, wxID_FRAGGLEDIALOGPREFSBUTTONMODULES, + wxID_FRAGGLEDIALOGPREFSBUTTONPROFILEDEL, wxID_FRAGGLEDIALOGPREFSBUTTONPROFILELOAD, - wxID_FRAGGLEDIALOGPREFSBUTTONPROFILESAVE, + wxID_FRAGGLEDIALOGPREFSBUTTONPROFILESAVE, wxID_FRAGGLEDIALOGPREFSBUTTONTEST, wxID_FRAGGLEDIALOGPREFSCOMBOBOXPROFILE, wxID_FRAGGLEDIALOGPREFSSTATICTEXT1, wxID_FRAGGLEDIALOGPREFSSTATICTEXT2, wxID_FRAGGLEDIALOGPREFSSTATICTEXT3, wxID_FRAGGLEDIALOGPREFSSTATICTEXT4, wxID_FRAGGLEDIALOGPREFSSTATICTEXT5, @@ -19,20 +22,15 @@ wxID_FRAGGLEDIALOGPREFSTEXTCTRLRETRIEVAL, wxID_FRAGGLEDIALOGPREFSTEXTCTRLSERVER, wxID_FRAGGLEDIALOGPREFSTEXTCTRLUSERNAME, -] = map(lambda _init_ctrls: wxNewId(), range(17)) +] = map(lambda _init_ctrls: wxNewId(), range(19)) 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, + name='fraggleDialogPrefs', parent=prnt, pos=wxPoint(482, 310), + 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 +84,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 +116,18 @@ 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) + + self.buttonModules = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTONMODULES, + label='Modules', name='buttonModules', parent=self, + pos=wxPoint(264, 184), size=wxSize(96, 16), style=0) + EVT_BUTTON(self.buttonModules, wxID_FRAGGLEDIALOGPREFSBUTTONMODULES, + self.OnButtonModulesButton) + def __init_profiles(self): list = self.parent.preferencesCtl.getProfileList() print list @@ -123,7 +136,10 @@ def __init__(self, parent): self.parent = parent + import __main__ + self.engine = __main__.engine self._init_ctrls(parent) + self.dialogModules = FraggleDialogModules.create(self) self.__init_profiles() def OnBtsaveButton(self, event): @@ -144,8 +160,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): @@ -184,7 +199,23 @@ 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() + + 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() - \ No newline at end of file