1 |
#Boa:Dialog:fraggleDialogPrefs |
#Boa:Dialog:fraggleDialogPrefs |
2 |
|
|
3 |
from wxPython.wx import * |
from wxPython.wx import * |
4 |
|
from fraggleEngine import * |
5 |
|
|
6 |
def create(parent): |
def create(parent): |
7 |
return fraggleDialogPrefs(parent) |
return fraggleDialogPrefs(parent) |
8 |
|
|
9 |
|
|
10 |
|
|
11 |
[wxID_FRAGGLEDIALOGPREFS, wxID_FRAGGLEDIALOGPREFSBTSAVE, |
[wxID_FRAGGLEDIALOGPREFS, wxID_FRAGGLEDIALOGPREFSBTSAVE, |
12 |
wxID_FRAGGLEDIALOGPREFSBUTTON1, wxID_FRAGGLEDIALOGPREFSSTATICLINE1, |
wxID_FRAGGLEDIALOGPREFSBUTTON1, wxID_FRAGGLEDIALOGPREFSSTATICLINE1, |
13 |
wxID_FRAGGLEDIALOGPREFSSTATICLINE2, wxID_FRAGGLEDIALOGPREFSSTATICTEXT1, |
wxID_FRAGGLEDIALOGPREFSSTATICLINE2, wxID_FRAGGLEDIALOGPREFSSTATICTEXT1, |
33 |
self._init_utils() |
self._init_utils() |
34 |
self.SetClientSize(wxSize(366, 188)) |
self.SetClientSize(wxSize(366, 188)) |
35 |
|
|
36 |
self.btsave = wxButton(id=wxID_FRAGGLEDIALOGPREFSBTSAVE, label='Save', |
self.btsave = wxButton(id=wxID_FRAGGLEDIALOGPREFSBTSAVE, |
37 |
name='btsave', parent=self, pos=wxPoint(8, 168), size=wxSize(64, |
label='Save and Close', name='btsave', parent=self, |
38 |
16), style=0) |
pos=wxPoint(8, 168), size=wxSize(96, 16), style=0) |
39 |
EVT_BUTTON(self.btsave, wxID_FRAGGLEDIALOGPREFSBTSAVE, |
EVT_BUTTON(self.btsave, wxID_FRAGGLEDIALOGPREFSBTSAVE, |
40 |
self.OnBtsaveButton) |
self.OnBtsaveButton) |
41 |
|
|
42 |
self.button1 = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTON1, |
self.button1 = wxButton(id=wxID_FRAGGLEDIALOGPREFSBUTTON1, |
43 |
label='Cancel', name='button1', parent=self, pos=wxPoint(80, 168), |
label='Cancel', name='button1', parent=self, pos=wxPoint(112, |
44 |
size=wxSize(56, 16), style=0) |
168), size=wxSize(56, 16), style=0) |
45 |
|
EVT_BUTTON(self.button1, wxID_FRAGGLEDIALOGPREFSBUTTON1, |
46 |
|
self.OnButton1Button) |
47 |
|
|
48 |
self.staticText1 = wxStaticText(id=wxID_FRAGGLEDIALOGPREFSSTATICTEXT1, |
self.staticText1 = wxStaticText(id=wxID_FRAGGLEDIALOGPREFSSTATICTEXT1, |
49 |
label='Username', name='staticText1', parent=self, pos=wxPoint(16, |
label='Username', name='staticText1', parent=self, pos=wxPoint(16, |
108 |
) |
) |
109 |
|
|
110 |
self.parent.preferencesCtl.saveConfig() |
self.parent.preferencesCtl.saveConfig() |
111 |
|
self.Hide() |
112 |
|
event.Skip() |
113 |
|
|
114 |
|
def loadConfig(self): |
115 |
|
engine = FraggleEngine() |
116 |
|
prefsfile = os.path.join(engine.getDefaultDir(), 'prefs.xml') |
117 |
|
self.parent.preferencesCtl.loadConfig(prefsfile) |
118 |
|
|
119 |
|
def updateConfig(self): |
120 |
|
config = self.parent.preferencesCtl.getConfig() |
121 |
|
self.textCtrlUsername.SetValue(config["username"]) |
122 |
|
self.textCtrlPassword.SetValue(config["password"]) |
123 |
|
self.textCtrlServer.SetValue(config["url"]) |
124 |
|
self.textCtrlRetrieval.SetValue(config["retrieval"]) |
125 |
|
|
126 |
|
def OnButton1Button(self, event): |
127 |
|
self.Hide() |
128 |
event.Skip() |
event.Skip() |
129 |
|
|