/[cvs]/nfo/projects/netfraggle/bin/fraggleDialogPrefs.py
ViewVC logotype

Diff of /nfo/projects/netfraggle/bin/fraggleDialogPrefs.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by xabbu, Sun Aug 29 22:52:40 2004 UTC revision 1.14 by xabbu, Sun Sep 5 00:21:10 2004 UTC
# Line 3  Line 3 
3  from wxPython.wx import *  from wxPython.wx import *
4  from fraggleEngine import *  from fraggleEngine import *
5    
6    import FraggleDialogModules
7    
8  def create(parent):  def create(parent):
9      return fraggleDialogPrefs(parent)      return fraggleDialogPrefs(parent)
10    
# Line 11  def create(parent): Line 13  def create(parent):
13  [wxID_FRAGGLEDIALOGPREFS, wxID_FRAGGLEDIALOGPREFSBTSAVE,  [wxID_FRAGGLEDIALOGPREFS, wxID_FRAGGLEDIALOGPREFSBTSAVE,
14   wxID_FRAGGLEDIALOGPREFSBUTTON1, wxID_FRAGGLEDIALOGPREFSBUTTONPROFILEDEL,   wxID_FRAGGLEDIALOGPREFSBUTTON1, wxID_FRAGGLEDIALOGPREFSBUTTONPROFILEDEL,
15   wxID_FRAGGLEDIALOGPREFSBUTTONPROFILELOAD,   wxID_FRAGGLEDIALOGPREFSBUTTONPROFILELOAD,
16   wxID_FRAGGLEDIALOGPREFSBUTTONPROFILESAVE,   wxID_FRAGGLEDIALOGPREFSBUTTONPROFILESAVE, wxID_FRAGGLEDIALOGPREFSBUTTONTEST,
17   wxID_FRAGGLEDIALOGPREFSCOMBOBOXPROFILE, wxID_FRAGGLEDIALOGPREFSSTATICTEXT1,   wxID_FRAGGLEDIALOGPREFSCOMBOBOXPROFILE, wxID_FRAGGLEDIALOGPREFSSTATICTEXT1,
18   wxID_FRAGGLEDIALOGPREFSSTATICTEXT2, wxID_FRAGGLEDIALOGPREFSSTATICTEXT3,   wxID_FRAGGLEDIALOGPREFSSTATICTEXT2, wxID_FRAGGLEDIALOGPREFSSTATICTEXT3,
19   wxID_FRAGGLEDIALOGPREFSSTATICTEXT4, wxID_FRAGGLEDIALOGPREFSSTATICTEXT5,   wxID_FRAGGLEDIALOGPREFSSTATICTEXT4, wxID_FRAGGLEDIALOGPREFSSTATICTEXT5,
# Line 19  def create(parent): Line 21  def create(parent):
21   wxID_FRAGGLEDIALOGPREFSTEXTCTRLRETRIEVAL,   wxID_FRAGGLEDIALOGPREFSTEXTCTRLRETRIEVAL,
22   wxID_FRAGGLEDIALOGPREFSTEXTCTRLSERVER,   wxID_FRAGGLEDIALOGPREFSTEXTCTRLSERVER,
23   wxID_FRAGGLEDIALOGPREFSTEXTCTRLUSERNAME,   wxID_FRAGGLEDIALOGPREFSTEXTCTRLUSERNAME,
24  ] = map(lambda _init_ctrls: wxNewId(), range(17))  ] = map(lambda _init_ctrls: wxNewId(), range(18))
25    
26  class fraggleDialogPrefs(wxDialog):  class fraggleDialogPrefs(wxDialog):
     def _init_utils(self):  
         # generated method, don't edit  
         pass  
   
27      def _init_ctrls(self, prnt):      def _init_ctrls(self, prnt):
28          # generated method, don't edit          # generated method, don't edit
29          wxDialog.__init__(self, id=wxID_FRAGGLEDIALOGPREFS,          wxDialog.__init__(self, id=wxID_FRAGGLEDIALOGPREFS,
30                name='fraggleDialogPrefs', parent=prnt, pos=wxPoint(283, 313),                name='fraggleDialogPrefs', parent=prnt, pos=wxPoint(482, 310),
31                size=wxSize(366, 233), style=wxDEFAULT_DIALOG_STYLE,                size=wxSize(366, 233), style=wxDEFAULT_DIALOG_STYLE,
32                title='Netfraggle Preferences')                title='Netfraggle Preferences')
33          self._init_utils()          self._init_utils()
# Line 86  class fraggleDialogPrefs(wxDialog): Line 84  class fraggleDialogPrefs(wxDialog):
84    
85          self.comboBoxProfile = wxComboBox(choices=[],          self.comboBoxProfile = wxComboBox(choices=[],
86                id=wxID_FRAGGLEDIALOGPREFSCOMBOBOXPROFILE, name='comboBoxProfile',                id=wxID_FRAGGLEDIALOGPREFSCOMBOBOXPROFILE, name='comboBoxProfile',
87                parent=self, pos=wxPoint(80, 8), size=wxSize(124, 16), style=0,                parent=self, pos=wxPoint(80, 8), size=wxSize(124, 21), style=0,
88                validator=wxDefaultValidator, value='')                validator=wxDefaultValidator, value='')
89          self.comboBoxProfile.SetLabel('')          self.comboBoxProfile.SetLabel('')
90            EVT_COMBOBOX(self.comboBoxProfile,
91                  wxID_FRAGGLEDIALOGPREFSCOMBOBOXPROFILE,
92                  self.OnComboboxprofileCombobox)
93    
94          self.staticText6 = wxStaticText(id=wxID_FRAGGLEDIALOGPREFSSTATICTEXT6,          self.staticText6 = wxStaticText(id=wxID_FRAGGLEDIALOGPREFSSTATICTEXT6,
95                label='Profile', name='staticText6', parent=self, pos=wxPoint(16,                label='Profile', name='staticText6', parent=self, pos=wxPoint(16,
# Line 115  class fraggleDialogPrefs(wxDialog): Line 116  class fraggleDialogPrefs(wxDialog):
116                wxID_FRAGGLEDIALOGPREFSBUTTONPROFILELOAD,                wxID_FRAGGLEDIALOGPREFSBUTTONPROFILELOAD,
117                self.OnButtonprofileloadButton)                self.OnButtonprofileloadButton)
118    
119            self.buttonTest = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTONTEST,
120                  label=u'&Test Account', name=u'buttonTest', parent=self,
121                  pos=wxPoint(264, 208), size=wxSize(96, 16), style=0)
122            EVT_BUTTON(self.buttonTest, wxID_FRAGGLEDIALOGPREFSBUTTONTEST,
123                  self.OnButtonTestButton)
124    
125      def __init_profiles(self):      def __init_profiles(self):
126          list = self.parent.preferencesCtl.getProfileList()          list = self.parent.preferencesCtl.getProfileList()
127          print list          print list
128          for i in list:          for i in list:
129              self.comboBoxProfile.Append(i)              self.comboBoxProfile.Append(i)
130                
131        def _init_utils(self):
132            # generated method, don't edit
133            pass
134    
135      def __init__(self, parent):      def __init__(self, parent):
136          self.parent = parent          self.parent = parent
137            import __main__
138            self.engine = __main__.engine
139          self._init_ctrls(parent)          self._init_ctrls(parent)
140          self.__init_profiles()          self.__init_profiles()
141                    
# Line 144  class fraggleDialogPrefs(wxDialog): Line 157  class fraggleDialogPrefs(wxDialog):
157          event.Skip()          event.Skip()
158    
159      def loadConfig(self):      def loadConfig(self):
160          engine = FraggleEngine()          prefsfile = os.path.join(self.parent.engine.getDefaultDir(), 'prefs.xml')
         prefsfile = os.path.join(engine.getDefaultDir(), 'prefs.xml')  
161          self.parent.preferencesCtl.loadConfig(prefsfile)          self.parent.preferencesCtl.loadConfig(prefsfile)
162                    
163      def updateConfig(self):      def updateConfig(self):
# Line 184  class fraggleDialogPrefs(wxDialog): Line 196  class fraggleDialogPrefs(wxDialog):
196          event.Skip()          event.Skip()
197    
198      def OnButtonprofiledelButton(self, event):      def OnButtonprofiledelButton(self, event):
199          #self.parent.preferencesCtl.deleteProfile(self.comboBoxProfile.GetValue())          self.parent.preferencesCtl.deleteProfile(self.comboBoxProfile.GetValue())
200          #self.comboBoxProfile.Remove(self.comboBoxProfile.GetValue())          self.comboBoxProfile.Delete(self.comboBoxProfile.FindString(self.comboBoxProfile.GetValue()))
201            self.parent.preferencesCtl.saveProfiles()
202            self.updateConfig()
203            event.Skip()
204    
205        def OnComboboxprofileCombobox(self, event):
206            event.Skip()
207    
208        def OnButtonTestButton(self, event):
209            #event.Skip()
210            if self.engine.authenticate(self.textCtrlServer.GetValue(), self.textCtrlUsername.GetValue(), self.textCtrlPassword.GetValue()):
211                wxMessageBox("Authentication successful!")
212            else:
213                wxMessageBox("Authentication failed!")
214    
215        def OnButtonModulesButton(self, event):
216            #self.dialogModules.Show()
217            #self.parent.dialogModules.Hide()
218          event.Skip()          event.Skip()
           

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.14

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed