def do_export(self, filen): try: if filen.lower().endswith(".csv"): dst_radio = generic_csv.CSVRadio(filen) elif filen.lower().endswith(".chirp"): dst_radio = generic_xml.XMLRadio(filen) else: raise Exception(_("Unsupported file type")) except Exception, e: common.log_exception() common.show_error(e) return
def do_export(self, filen): try: if filen.lower().endswith(".csv"): dst_radio = generic_csv.CSVRadio(filen) elif filen.lower().endswith(".chirp"): dst_radio = generic_xml.XMLRadio(filen) else: raise Exception(_("Unsupported file type")) except Exception as e: common.log_exception() common.show_error(e) return dst_rthread = common.RadioThread(dst_radio) dst_rthread.setDaemon(True) dst_rthread.start() try: count = self._do_import_locked(importdialog.ExportDialog, self.rthread.radio, dst_rthread) except Exception as e: common.log_exception() common.show_error(_("There was an error during " "export: {error}").format(error=e), self.parent_window) return if count <= 0: return # Wait for thread queue to complete dst_rthread._qlock_when_idle() try: dst_radio.save(filename=filen) except Exception as e: common.log_exception() common.show_error(_("There was an error during " "export: {error}").format(error=e), self)
def prepare(self): testbase = os.path.dirname(os.path.abspath(__file__)) source = os.path.join(testbase, 'images', 'Generic_CSV.csv') self._src = generic_csv.CSVRadio(source)