--- nfo/projects/netfraggle/bin/FraggleDialogModules.py 2004/09/01 21:43:30 1.2 +++ nfo/projects/netfraggle/bin/FraggleDialogModules.py 2004/09/05 12:17:20 1.5 @@ -2,6 +2,8 @@ from wxPython.wx import * +import FraggleCtlModules + def create(parent): return FraggleDialogModules(parent) @@ -12,32 +14,66 @@ class FraggleDialogModules(wxDialog): - def _init_utils(self): - # generated method, don't edit - pass - def _init_ctrls(self, prnt): # generated method, don't edit wxDialog.__init__(self, id=wxID_FRAGGLEDIALOGMODULES, name='FraggleDialogModules', parent=prnt, pos=wxPoint(256, 167), - size=wxSize(189, 288), style=wxDEFAULT_DIALOG_STYLE, + size=wxSize(197, 315), style=wxDEFAULT_DIALOG_STYLE, title='Module Setup') - self._init_utils() self.SetClientSize(wxSize(189, 288)) self.checkListBoxModules = wxCheckListBox(choices=[], id=wxID_FRAGGLEDIALOGMODULESCHECKLISTBOXMODULES, name='checkListBoxModules', parent=self, pos=wxPoint(8, 8), size=wxSize(168, 248), style=0, validator=wxDefaultValidator) + EVT_CHECKLISTBOX(self.checkListBoxModules, + wxID_FRAGGLEDIALOGMODULESCHECKLISTBOXMODULES, + self.OnCheckListBoxModulesChecklistbox) self.buttonSaveClose = wxButton(id=wxID_FRAGGLEDIALOGMODULESBUTTONSAVECLOSE, label='Save and Close', name='buttonSaveClose', parent=self, pos=wxPoint(8, 264), size=wxSize(88, 16), style=0) + EVT_BUTTON(self.buttonSaveClose, + wxID_FRAGGLEDIALOGMODULESBUTTONSAVECLOSE, + self.OnButtonSaveCloseButton) self.button1 = wxButton(id=wxID_FRAGGLEDIALOGMODULESBUTTON1, label='Cancel', name='button1', parent=self, pos=wxPoint(104, 264), size=wxSize(72, 16), style=0) + def __init_listbox__(self,parent): + + try: + for i in self.modulesCtl.modules.keys(): + self.checkListBoxModules.Append(i) + except AttributeError: + print "No Modules found" + + for b in self.selections: + self.checkListBoxModules.Check(self.modulesCtl.modules.keys().index(b)) + + def __init__(self, parent): + self.modulesCtl = parent.engine.modules + self.selections = self.modulesCtl.LoadModules() self._init_ctrls(parent) - \ No newline at end of file + self.__init_listbox__(parent) + + def OnCheckListBoxModulesChecklistbox(self, event): + try: + if self.checkListBoxModules.IsChecked(event.GetInt()): + print "Checked" + self.selections.Append(self.modulesCtl.modules.keys()[event.GetInt()]) + else: + print "Unchecked" + self.selections.pop(event.GetInt()) + except AttributeError: + self.selections = [self.modulesCtl.modules.keys()[event.GetInt()]] + #print event.GetInt() + + + def OnButtonSaveCloseButton(self, event): + self.modulesCtl.SaveModules(self.selections) + self.Hide() + event.Skip() +