def show_dialog_bad_name(parent, name, *expected_names): msg = u"Bad name: '%s'" % name if len(expected_names) > 0: msg += LINESEP + 'Expected names like:' + LINESEP + LINESEP.join( expected_names) caption = u'Bad name' return show_dialog(parent, msg, caption)
def _get_fields_as_code(self): single_line = u" {name} = ({by_as_code}, u'{selector}') # {comment}" lines = [] for field in self.fields: lines.append(single_line.format(**{ 'name': field.name, 'by_as_code': get_by_as_code_str(field.by), 'selector': field.selector.replace("'", "\\'"), 'comment': u'location: %s dimensions: %s' % (field.location, field.dimensions) })) return LINESEP.join(lines)
def __on_btn(self, evt): errors = [] obj = evt.GetEventObject() if obj == self.btn_ok: self.values = {} for txt_ctrl in self.txt_ctrls: label_ctrl = self.labels[self.txt_ctrls.index(txt_ctrl)] label = label_ctrl.GetLabel() value = txt_ctrl.GetValue() self.values[label] = value if len(value) == 0: errors.append(u"Variable '%s' has empty value '%s'" % (label, value)) return_code = ID_OK else: self.values = None return_code = ID_CANCEL if len(errors) > 0: show_dialog(self, LINESEP.join(errors), 'Bad entered data') else: self.EndModal(return_code)
def show_dialog_bad_name(parent, name, *expected_names): msg = u"Bad name: '%s'" % name if len(expected_names) > 0: msg += LINESEP + 'Expected names like:' + LINESEP + LINESEP.join(expected_names) caption = u'Bad name' return show_dialog(parent, msg, caption)