Exemplo n.º 1
0
	def _import_file_async(self):
		path = PathManager.get_import_path()

		channels = []
		try:
			channels = self._radio_importer.run_import(radio_types.CHIRP, path)
		except Exception as e:
			logging.error(f'Failed to import {path}. Exception: {e.__class__}')

		if len(channels) > 0:
			self._radio_importer.channels_to_file(channels)
Exemplo n.º 2
0
    def select_import_file_dialog(self, event):
        dialog_content = Builder.load_string(load_dialog)
        file_chooser = dialog_content.ids[PopupIds.file_chooser]
        file_chooser.dirselect = False
        file_chooser.filters = "*.csv"
        file_chooser.path = PathManager.get_import_path()
        file_chooser.bind(selection=self._update_display_path)

        file_label = dialog_content.ids[PopupIds.file_path]
        file_label.text = file_chooser.path
        file_label.bind(on_text_validate=self._update_file_browser)

        self._popup = Popup(title="Select CHiRP file",
                            content=dialog_content,
                            size_hint=(0.9, 0.9))
        dialog_content.ids[PopupIds.cancel_button].bind(
            on_press=self._dismiss_popup)

        dialog_content.ids[PopupIds.load_button].bind(
            on_press=self._import_trigger_event)

        self._popup.open()
        return