1 |
#Boa:Dialog:wxModuleDialog |
#Boa:Dialog:FraggleDialogModules |
2 |
|
|
3 |
from wxPython.wx import * |
from wxPython.wx import * |
4 |
|
|
5 |
|
import FraggleCtlModules |
6 |
|
|
7 |
def create(parent): |
def create(parent): |
8 |
return wxModuleDialog(parent) |
return FraggleDialogModules(parent) |
9 |
|
|
10 |
[wxID_WXMODULEDIALOG, wxID_WXMODULEDIALOGBUTTON1, |
[wxID_FRAGGLEDIALOGMODULES, wxID_FRAGGLEDIALOGMODULESBUTTON1, |
11 |
wxID_WXMODULEDIALOGBUTTONSAVECLOSE, wxID_WXMODULEDIALOGCHECKLISTBOXMODULES, |
wxID_FRAGGLEDIALOGMODULESBUTTONSAVECLOSE, |
12 |
|
wxID_FRAGGLEDIALOGMODULESCHECKLISTBOXMODULES, |
13 |
] = map(lambda _init_ctrls: wxNewId(), range(4)) |
] = map(lambda _init_ctrls: wxNewId(), range(4)) |
14 |
|
|
15 |
class wxModuleDialog(wxDialog): |
class FraggleDialogModules(wxDialog): |
16 |
def _init_utils(self): |
|
|
# generated method, don't edit |
|
|
pass |
|
|
|
|
17 |
def _init_ctrls(self, prnt): |
def _init_ctrls(self, prnt): |
18 |
# generated method, don't edit |
# generated method, don't edit |
19 |
wxDialog.__init__(self, id=wxID_WXMODULEDIALOG, name='wxModuleDialog', |
wxDialog.__init__(self, id=wxID_FRAGGLEDIALOGMODULES, |
20 |
parent=prnt, pos=wxPoint(256, 167), size=wxSize(189, 288), |
name='FraggleDialogModules', parent=prnt, pos=wxPoint(256, 167), |
21 |
style=wxDEFAULT_DIALOG_STYLE, title='Module Setup') |
size=wxSize(197, 315), style=wxDEFAULT_DIALOG_STYLE, |
22 |
self._init_utils() |
title='Module Setup') |
23 |
self.SetClientSize(wxSize(189, 288)) |
self.SetClientSize(wxSize(189, 288)) |
24 |
|
|
25 |
self.checkListBoxModules = wxCheckListBox(choices=[], |
self.checkListBoxModules = wxCheckListBox(choices=[], |
26 |
id=wxID_WXMODULEDIALOGCHECKLISTBOXMODULES, |
id=wxID_FRAGGLEDIALOGMODULESCHECKLISTBOXMODULES, |
27 |
name='checkListBoxModules', parent=self, pos=wxPoint(8, 8), |
name='checkListBoxModules', parent=self, pos=wxPoint(8, 8), |
28 |
size=wxSize(168, 248), style=0, validator=wxDefaultValidator) |
size=wxSize(168, 248), style=0, validator=wxDefaultValidator) |
29 |
|
EVT_CHECKLISTBOX(self.checkListBoxModules, |
30 |
|
wxID_FRAGGLEDIALOGMODULESCHECKLISTBOXMODULES, |
31 |
|
self.OnCheckListBoxModulesChecklistbox) |
32 |
|
|
33 |
self.buttonSaveClose = wxButton(id=wxID_WXMODULEDIALOGBUTTONSAVECLOSE, |
self.buttonSaveClose = wxButton(id=wxID_FRAGGLEDIALOGMODULESBUTTONSAVECLOSE, |
34 |
label='Save and Close', name='buttonSaveClose', parent=self, |
label='Save and Close', name='buttonSaveClose', parent=self, |
35 |
pos=wxPoint(8, 264), size=wxSize(88, 16), style=0) |
pos=wxPoint(8, 264), size=wxSize(88, 16), style=0) |
36 |
|
EVT_BUTTON(self.buttonSaveClose, |
37 |
self.button1 = wxButton(id=wxID_WXMODULEDIALOGBUTTON1, label='Cancel', |
wxID_FRAGGLEDIALOGMODULESBUTTONSAVECLOSE, |
38 |
name='button1', parent=self, pos=wxPoint(104, 264), |
self.OnButtonSaveCloseButton) |
39 |
size=wxSize(72, 16), style=0) |
|
40 |
|
self.button1 = wxButton(id=wxID_FRAGGLEDIALOGMODULESBUTTON1, |
41 |
|
label='Cancel', name='button1', parent=self, pos=wxPoint(104, |
42 |
|
264), size=wxSize(72, 16), style=0) |
43 |
|
|
44 |
|
def __init_listbox__(self,parent): |
45 |
|
|
46 |
|
try: |
47 |
|
for i in self.modulesCtl.modules.keys(): |
48 |
|
self.checkListBoxModules.Append(i) |
49 |
|
for b in self.selections: |
50 |
|
self.checkListBoxModules.Check(self.modulesCtl.modules.keys().index(b)) |
51 |
|
except AttributeError: |
52 |
|
print "No Modules found" |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
def __init__(self, parent): |
def __init__(self, parent): |
58 |
|
self.modulesCtl = parent.engine.modules |
59 |
|
self.selections = self.modulesCtl.LoadModules() |
60 |
self._init_ctrls(parent) |
self._init_ctrls(parent) |
61 |
|
self.__init_listbox__(parent) |
62 |
|
|
63 |
|
def OnCheckListBoxModulesChecklistbox(self, event): |
64 |
|
try: |
65 |
|
if self.checkListBoxModules.IsChecked(event.GetInt()): |
66 |
|
print "Checked" |
67 |
|
self.selections.Append(self.modulesCtl.modules.keys()[event.GetInt()]) |
68 |
|
else: |
69 |
|
print "Unchecked" |
70 |
|
self.selections.pop(event.GetInt()) |
71 |
|
except AttributeError: |
72 |
|
self.selections = [self.modulesCtl.modules.keys()[event.GetInt()]] |
73 |
|
#print event.GetInt() |
74 |
|
|
75 |
|
|
76 |
|
def OnButtonSaveCloseButton(self, event): |
77 |
|
self.modulesCtl.SaveModules(self.selections) |
78 |
|
self.Hide() |
79 |
|
event.Skip() |
80 |
|
|