| 89 |
parent=self, pos=wxPoint(80, 8), size=wxSize(124, 16), style=0, |
parent=self, pos=wxPoint(80, 8), size=wxSize(124, 16), style=0, |
| 90 |
validator=wxDefaultValidator, value='') |
validator=wxDefaultValidator, value='') |
| 91 |
self.comboBoxProfile.SetLabel('') |
self.comboBoxProfile.SetLabel('') |
| 92 |
|
EVT_COMBOBOX(self.comboBoxProfile, |
| 93 |
|
wxID_FRAGGLEDIALOGPREFSCOMBOBOXPROFILE, |
| 94 |
|
self.OnComboboxprofileCombobox) |
| 95 |
|
|
| 96 |
self.staticText6 = wxStaticText(id=wxID_FRAGGLEDIALOGPREFSSTATICTEXT6, |
self.staticText6 = wxStaticText(id=wxID_FRAGGLEDIALOGPREFSSTATICTEXT6, |
| 97 |
label='Profile', name='staticText6', parent=self, pos=wxPoint(16, |
label='Profile', name='staticText6', parent=self, pos=wxPoint(16, |
| 100 |
self.buttonProfileSave = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTONPROFILESAVE, |
self.buttonProfileSave = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTONPROFILESAVE, |
| 101 |
label='Save', name='buttonProfileSave', parent=self, |
label='Save', name='buttonProfileSave', parent=self, |
| 102 |
pos=wxPoint(272, 8), size=wxSize(40, 16), style=0) |
pos=wxPoint(272, 8), size=wxSize(40, 16), style=0) |
| 103 |
|
EVT_BUTTON(self.buttonProfileSave, |
| 104 |
|
wxID_FRAGGLEDIALOGPREFSBUTTONPROFILESAVE, |
| 105 |
|
self.OnButtonprofilesaveButton) |
| 106 |
|
|
| 107 |
self.buttonProfileDel = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTONPROFILEDEL, |
self.buttonProfileDel = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTONPROFILEDEL, |
| 108 |
label='Delete', name='buttonProfileDel', parent=self, |
label='Delete', name='buttonProfileDel', parent=self, |
| 109 |
pos=wxPoint(320, 8), size=wxSize(40, 16), style=0) |
pos=wxPoint(320, 8), size=wxSize(40, 16), style=0) |
| 110 |
|
EVT_BUTTON(self.buttonProfileDel, |
| 111 |
|
wxID_FRAGGLEDIALOGPREFSBUTTONPROFILEDEL, |
| 112 |
|
self.OnButtonprofiledelButton) |
| 113 |
|
|
| 114 |
self.buttonProfileLoad = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTONPROFILELOAD, |
self.buttonProfileLoad = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTONPROFILELOAD, |
| 115 |
label='Load', name='buttonProfileLoad', parent=self, |
label='Load', name='buttonProfileLoad', parent=self, |
| 116 |
pos=wxPoint(216, 8), size=wxSize(48, 16), style=0) |
pos=wxPoint(216, 8), size=wxSize(48, 16), style=0) |
| 117 |
|
EVT_BUTTON(self.buttonProfileLoad, |
| 118 |
|
wxID_FRAGGLEDIALOGPREFSBUTTONPROFILELOAD, |
| 119 |
|
self.OnButtonprofileloadButton) |
| 120 |
|
|
| 121 |
|
def __init_profiles(self): |
| 122 |
|
list = self.parent.preferencesCtl.getProfileList() |
| 123 |
|
print list |
| 124 |
|
for i in list: |
| 125 |
|
self.comboBoxProfile.Append(i) |
| 126 |
|
|
| 127 |
def __init__(self, parent): |
def __init__(self, parent): |
| 128 |
self.parent = parent |
self.parent = parent |
| 129 |
self._init_ctrls(parent) |
self._init_ctrls(parent) |
| 130 |
|
self.__init_profiles() |
| 131 |
|
|
| 132 |
def OnBtsaveButton(self, event): |
def OnBtsaveButton(self, event): |
| 133 |
|
|
| 134 |
# convert from utf-8: required for win32 |
# convert from utf-8: required for win32 |
| 147 |
event.Skip() |
event.Skip() |
| 148 |
|
|
| 149 |
def loadConfig(self): |
def loadConfig(self): |
| 150 |
engine = FraggleEngine() |
prefsfile = os.path.join(self.parent.preferencesCtl.getDefaultDir(), 'prefs.xml') |
|
prefsfile = os.path.join(engine.getDefaultDir(), 'prefs.xml') |
|
| 151 |
self.parent.preferencesCtl.loadConfig(prefsfile) |
self.parent.preferencesCtl.loadConfig(prefsfile) |
| 152 |
|
|
| 153 |
def updateConfig(self): |
def updateConfig(self): |
| 154 |
config = self.parent.preferencesCtl.getConfig() |
config = self.parent.preferencesCtl.getConfig() |
| 155 |
self.textCtrlUsername.SetValue(config["username"]) |
try: |
| 156 |
self.textCtrlPassword.SetValue(config["password"]) |
self.textCtrlUsername.SetValue(config["username"]) |
| 157 |
self.textCtrlServer.SetValue(config["url"]) |
self.textCtrlPassword.SetValue(config["password"]) |
| 158 |
self.textCtrlRetrieval.SetValue(config["retrieval"]) |
self.textCtrlServer.SetValue(config["url"]) |
| 159 |
|
self.textCtrlRetrieval.SetValue(config["retrieval"]) |
| 160 |
|
except TypeError: |
| 161 |
|
self.textCtrlUsername.SetValue("username") |
| 162 |
|
self.textCtrlPassword.SetValue("password") |
| 163 |
|
self.textCtrlServer.SetValue("url") |
| 164 |
|
self.textCtrlRetrieval.SetValue("retrieval") |
| 165 |
|
|
| 166 |
def OnButton1Button(self, event): |
def OnButton1Button(self, event): |
| 167 |
self.Hide() |
self.Hide() |
| 168 |
event.Skip() |
event.Skip() |
| 169 |
|
|
| 170 |
|
def OnButtonprofilesaveButton(self, event): |
| 171 |
|
username = self.textCtrlUsername.GetValue() |
| 172 |
|
password = self.textCtrlPassword.GetValue() |
| 173 |
|
url = self.textCtrlServer.GetValue() |
| 174 |
|
retrieval = self.textCtrlRetrieval.GetValue() |
| 175 |
|
self.parent.preferencesCtl.setConfig(username,password,url,retrieval) |
| 176 |
|
i = self.parent.preferencesCtl.appendProfile(self.comboBoxProfile.GetValue(),self.parent.preferencesCtl.configList) |
| 177 |
|
if i == 0: |
| 178 |
|
self.comboBoxProfile.Append(self.comboBoxProfile.GetValue()) |
| 179 |
|
|
| 180 |
|
self.parent.preferencesCtl.saveProfiles() |
| 181 |
|
event.Skip() |
| 182 |
|
|
| 183 |
|
def OnButtonprofileloadButton(self, event): |
| 184 |
|
self.parent.preferencesCtl.loadProfile(self.comboBoxProfile.GetValue()) |
| 185 |
|
self.updateConfig() |
| 186 |
|
event.Skip() |
| 187 |
|
|
| 188 |
|
def OnButtonprofiledelButton(self, event): |
| 189 |
|
self.parent.preferencesCtl.deleteProfile(self.comboBoxProfile.GetValue()) |
| 190 |
|
self.comboBoxProfile.Delete(self.comboBoxProfile.FindString(self.comboBoxProfile.GetValue())) |
| 191 |
|
self.parent.preferencesCtl.saveProfiles() |
| 192 |
|
self.updateConfig() |
| 193 |
|
event.Skip() |
| 194 |
|
|
| 195 |
|
def OnComboboxprofileCombobox(self, event): |
| 196 |
|
event.Skip() |
| 197 |
|
|