def do_import(self, filen): current_editor = self.get_current_editor() if not isinstance(current_editor, memedit.MemoryEditor): # FIXME: We need a nice message to let the user know that they # need to select the appropriate memory editor tab before doing # and import so that we know which thread and editor to import # into and refresh. This will do for the moment. common.show_error("Memory editor must be selected before import") try: src_radio = directory.get_radio_by_image(filen) except Exception as e: common.show_error(e) return if isinstance(src_radio, chirp_common.NetworkSourceRadio): ww = importdialog.WaitWindow("Querying...", self.parent_window) ww.show() def status(status): ww.set(float(status.cur) / float(status.max)) try: src_radio.status_fn = status src_radio.do_fetch() except Exception as e: common.show_error(e) ww.hide() return ww.hide() try: if src_radio.get_features().has_sub_devices: src_radio = self.choose_sub_device(src_radio) except Exception as e: common.show_error(e) return if len(src_radio.errors) > 0: _filen = os.path.basename(filen) common.show_error_text( _("There were errors while opening {file}. " "The affected memories will not " "be importable!").format(file=_filen), "\r\n".join(src_radio.errors)) try: count = self._do_import_locked(importdialog.ImportDialog, src_radio, self.rthread) reporting.report_model_usage(src_radio, "importsrc", True) except Exception as e: common.log_exception() common.show_error( _("There was an error during " "import: {error}").format(error=e))
def _validate(self, _dialog, response): if response == gtk.RESPONSE_OK: all_msgs = self._features.validate_memory(self._memory) errors = [] for msg in all_msgs: if isinstance(msg, chirp_common.ValidationError): errors.append(msg) if errors: common.show_error_text(_("Memory validation failed:"), os.linesep + os.linesep.join(errors)) self.emit_stop_by_name('response')
ww.hide() return ww.hide() try: if src_radio.get_features().has_sub_devices: src_radio = self.choose_sub_device(src_radio) except Exception, e: common.show_error(e) return if len(src_radio.errors) > 0: _filen = os.path.basename(filen) common.show_error_text( _("There were errors while opening {file}. " "The affected memories will not " "be importable!").format(file=_filen), "\r\n".join(src_radio.errors)) try: count = self._do_import_locked(importdialog.ImportDialog, src_radio, self.rthread) reporting.report_model_usage(src_radio, "importsrc", True) except Exception, e: common.log_exception() common.show_error( _("There was an error during " "import: {error}").format(error=e)) def do_export(self, filen): try:
common.show_error(e) ww.hide() return ww.hide() try: if src_radio.get_features().has_sub_devices: src_radio = self.choose_sub_device(src_radio) except Exception, e: common.show_error(e) return if len(src_radio.errors) > 0: _filen = os.path.basename(filen) common.show_error_text(_("There were errors while opening {file}. " "The affected memories will not " "be importable!").format(file=_filen), "\r\n".join(src_radio.errors)) try: count = self._do_import_locked(importdialog.ImportDialog, src_radio, self.rthread) reporting.report_model_usage(src_radio, "importsrc", True) except Exception, e: common.log_exception() common.show_error(_("There was an error during " "import: {error}").format(error=e)) def do_export(self, filen): try: if filen.lower().endswith(".csv"):