def OnClose(self, event): """ Event handler activated when this dialog is closed""" if event.GetId() == wx.ID_OK: type_wizard = cdml.iif('Cost' in self.cb_type.GetValue(), 0, 1) ival = self.ed_ival.GetValue() coef, val = [], [] item_num = self.lc_vector.GetItemCount() for i in range(item_num): coef.append(str(self.lc_vector.GetItem(i, 0).GetText())) val.append(str(self.lc_vector.GetItem(i, 1).GetText())) wizard_output = [type_wizard, ival, coef, val] try: CostWizardOutput = DB.ConstructCostWizardString(wizard_output) cdml.SetRefreshInfo(self, '', CostWizardOutput) except: CostWizardOutput = None ans = cdml.dlgErrorMsg(0, True, Parent=self) if ans == wx.ID_YES: return cdml.CloseForm(self, True, '', CostWizardOutput) else: cdml.CloseForm(self, False)