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 |
|
|
11 |
|
|
12 |
|
|
13 |
[wxID_FRAGGLEDIALOGPREFS, wxID_FRAGGLEDIALOGPREFSBTSAVE, |
[wxID_FRAGGLEDIALOGPREFS, wxID_FRAGGLEDIALOGPREFSBTSAVE, |
14 |
wxID_FRAGGLEDIALOGPREFSBUTTON1, wxID_FRAGGLEDIALOGPREFSBUTTONPROFILEDEL, |
wxID_FRAGGLEDIALOGPREFSBUTTON1, wxID_FRAGGLEDIALOGPREFSBUTTONMODULES, |
15 |
|
wxID_FRAGGLEDIALOGPREFSBUTTONPROFILEDEL, |
16 |
wxID_FRAGGLEDIALOGPREFSBUTTONPROFILELOAD, |
wxID_FRAGGLEDIALOGPREFSBUTTONPROFILELOAD, |
17 |
wxID_FRAGGLEDIALOGPREFSBUTTONPROFILESAVE, |
wxID_FRAGGLEDIALOGPREFSBUTTONPROFILESAVE, wxID_FRAGGLEDIALOGPREFSBUTTONTEST, |
18 |
wxID_FRAGGLEDIALOGPREFSCOMBOBOXPROFILE, wxID_FRAGGLEDIALOGPREFSSTATICTEXT1, |
wxID_FRAGGLEDIALOGPREFSCOMBOBOXPROFILE, wxID_FRAGGLEDIALOGPREFSSTATICTEXT1, |
19 |
wxID_FRAGGLEDIALOGPREFSSTATICTEXT2, wxID_FRAGGLEDIALOGPREFSSTATICTEXT3, |
wxID_FRAGGLEDIALOGPREFSSTATICTEXT2, wxID_FRAGGLEDIALOGPREFSSTATICTEXT3, |
20 |
wxID_FRAGGLEDIALOGPREFSSTATICTEXT4, wxID_FRAGGLEDIALOGPREFSSTATICTEXT5, |
wxID_FRAGGLEDIALOGPREFSSTATICTEXT4, wxID_FRAGGLEDIALOGPREFSSTATICTEXT5, |
22 |
wxID_FRAGGLEDIALOGPREFSTEXTCTRLRETRIEVAL, |
wxID_FRAGGLEDIALOGPREFSTEXTCTRLRETRIEVAL, |
23 |
wxID_FRAGGLEDIALOGPREFSTEXTCTRLSERVER, |
wxID_FRAGGLEDIALOGPREFSTEXTCTRLSERVER, |
24 |
wxID_FRAGGLEDIALOGPREFSTEXTCTRLUSERNAME, |
wxID_FRAGGLEDIALOGPREFSTEXTCTRLUSERNAME, |
25 |
] = map(lambda _init_ctrls: wxNewId(), range(17)) |
] = map(lambda _init_ctrls: wxNewId(), range(19)) |
26 |
|
|
27 |
class fraggleDialogPrefs(wxDialog): |
class fraggleDialogPrefs(wxDialog): |
|
def _init_utils(self): |
|
|
# generated method, don't edit |
|
|
pass |
|
|
|
|
28 |
def _init_ctrls(self, prnt): |
def _init_ctrls(self, prnt): |
29 |
# generated method, don't edit |
# generated method, don't edit |
30 |
wxDialog.__init__(self, id=wxID_FRAGGLEDIALOGPREFS, |
wxDialog.__init__(self, id=wxID_FRAGGLEDIALOGPREFS, |
31 |
name='fraggleDialogPrefs', parent=prnt, pos=wxPoint(283, 313), |
name='fraggleDialogPrefs', parent=prnt, pos=wxPoint(482, 310), |
32 |
size=wxSize(366, 233), style=wxDEFAULT_DIALOG_STYLE, |
size=wxSize(374, 260), style=wxDEFAULT_DIALOG_STYLE, |
33 |
title='Netfraggle Preferences') |
title='Netfraggle Preferences') |
|
self._init_utils() |
|
34 |
self.SetClientSize(wxSize(366, 233)) |
self.SetClientSize(wxSize(366, 233)) |
35 |
|
|
36 |
self.btsave = wxButton(id=wxID_FRAGGLEDIALOGPREFSBTSAVE, |
self.btsave = wxButton(id=wxID_FRAGGLEDIALOGPREFSBTSAVE, |
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, |
EVT_COMBOBOX(self.comboBoxProfile, |
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 |
|
self.buttonModules = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTONMODULES, |
126 |
|
label='Modules', name='buttonModules', parent=self, |
127 |
|
pos=wxPoint(264, 184), size=wxSize(96, 16), style=0) |
128 |
|
EVT_BUTTON(self.buttonModules, wxID_FRAGGLEDIALOGPREFSBUTTONMODULES, |
129 |
|
self.OnButtonModulesButton) |
130 |
|
|
131 |
def __init_profiles(self): |
def __init_profiles(self): |
132 |
list = self.parent.preferencesCtl.getProfileList() |
list = self.parent.preferencesCtl.getProfileList() |
133 |
print list |
print list |
136 |
|
|
137 |
def __init__(self, parent): |
def __init__(self, parent): |
138 |
self.parent = parent |
self.parent = parent |
139 |
|
import __main__ |
140 |
|
self.engine = __main__.engine |
141 |
self._init_ctrls(parent) |
self._init_ctrls(parent) |
142 |
|
self.dialogModules = FraggleDialogModules.create(self) |
143 |
self.__init_profiles() |
self.__init_profiles() |
144 |
|
|
145 |
def OnBtsaveButton(self, event): |
def OnBtsaveButton(self, event): |
160 |
event.Skip() |
event.Skip() |
161 |
|
|
162 |
def loadConfig(self): |
def loadConfig(self): |
163 |
prefsfile = os.path.join(self.parent.preferencesCtl.getDefaultDir(), 'prefs.xml') |
prefsfile = os.path.join(self.parent.engine.getDefaultDir(), 'prefs.xml') |
164 |
self.parent.preferencesCtl.loadConfig(prefsfile) |
self.parent.preferencesCtl.loadConfig(prefsfile) |
165 |
|
|
166 |
def updateConfig(self): |
def updateConfig(self): |
207 |
|
|
208 |
def OnComboboxprofileCombobox(self, event): |
def OnComboboxprofileCombobox(self, event): |
209 |
event.Skip() |
event.Skip() |
|
|
|
210 |
|
|
211 |
|
def OnButtonTestButton(self, event): |
212 |
|
#event.Skip() |
213 |
|
if self.engine.authenticate(self.textCtrlServer.GetValue(), self.textCtrlUsername.GetValue(), self.textCtrlPassword.GetValue()): |
214 |
|
wxMessageBox("Authentication successful!") |
215 |
|
else: |
216 |
|
wxMessageBox("Authentication failed!") |
217 |
|
|
218 |
|
def OnButtonModulesButton(self, event): |
219 |
|
self.dialogModules.Show() |
220 |
|
#self.parent.dialogModules.Hide() |
221 |
|
event.Skip() |