Exemplo n.º 1
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setWindowTitle('Overwrite Navigation')
        layout = QtWidgets.QVBoxLayout()

        self.input_msg = QtWidgets.QLabel('Apply to the following:')

        self.hlayout_zero = QtWidgets.QHBoxLayout()
        self.input_fqpr = BrowseListWidget(self)
        self.input_fqpr.sizeHint()
        self.input_fqpr.setup(mode='directory',
                              registry_key='kluster',
                              app_name='klusterbrowse',
                              filebrowse_title='Select input processed folder')
        self.hlayout_zero.addWidget(self.input_fqpr)

        self.posmv_msg = QtWidgets.QLabel('POSMV Files')

        self.hlayout_two = QtWidgets.QHBoxLayout()
        self.posmvfiles = BrowseListWidget(self)
        self.posmvfiles.setup(registry_key='kluster',
                              app_name='klusterbrowse',
                              multiselect=True,
                              filebrowse_title='Select POS MV files')
        self.hlayout_two.addWidget(self.posmvfiles)

        self.override_check = QtWidgets.QGroupBox('Manually set metadata')
        self.override_check.setCheckable(False)
        self.override_check.setChecked(True)
        self.overrideopts = QtWidgets.QVBoxLayout()
        self.hlayout_four_one = QtWidgets.QHBoxLayout()
        self.caltext = QtWidgets.QLabel('Date of POS MV File')
        self.hlayout_four_one.addWidget(self.caltext)
        self.calendar_widget = QtWidgets.QDateEdit()
        self.calendar_widget.setMaximumWidth(100)
        self.calendar_widget.setCalendarPopup(True)
        currdate = datetime.now()
        self.calendar_widget.setDate(
            QtCore.QDate(currdate.year, currdate.month, currdate.day))
        self.hlayout_four_one.addWidget(self.calendar_widget)
        self.hlayout_four_two = QtWidgets.QHBoxLayout()
        self.overrideopts.addLayout(self.hlayout_four_one)
        self.overrideopts.addLayout(self.hlayout_four_two)
        self.override_check.setLayout(self.overrideopts)

        self.status_msg = QtWidgets.QLabel('')
        self.status_msg.setStyleSheet("QLabel { " +
                                      kluster_variables.error_color + "; }")

        self.hlayout_five = QtWidgets.QHBoxLayout()
        self.hlayout_five.addStretch(1)
        self.ok_button = QtWidgets.QPushButton('OK', self)
        self.hlayout_five.addWidget(self.ok_button)
        self.hlayout_five.addStretch(1)
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        self.hlayout_five.addWidget(self.cancel_button)
        self.hlayout_five.addStretch(1)

        layout.addWidget(self.input_msg)
        layout.addLayout(self.hlayout_zero)
        layout.addWidget(self.posmv_msg)
        layout.addLayout(self.hlayout_two)
        layout.addWidget(self.override_check)
        layout.addWidget(self.status_msg)
        layout.addLayout(self.hlayout_five)
        self.setLayout(layout)

        self.pos_files = []
        self.fqpr_inst = []
        self.canceled = False

        self.input_fqpr.files_updated.connect(
            self._event_update_fqpr_instances)
        self.posmvfiles.files_updated.connect(self.update_posmv_files)
        self.ok_button.clicked.connect(self.start_processing)
        self.cancel_button.clicked.connect(self.cancel_processing)

        self.resize(600, 500)
Exemplo n.º 2
0
class OverwriteNavigationDialog(QtWidgets.QDialog):
    """
    Dialog contains all the options related to overwriting the navigation with POSMV files.  Use
    return_processing_options to get the kwargs to feed the fqpr_convenience.process_multibeam function.

    fqpr = fully qualified ping record, the term for the datastore in kluster
    """
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setWindowTitle('Overwrite Navigation')
        layout = QtWidgets.QVBoxLayout()

        self.input_msg = QtWidgets.QLabel('Apply to the following:')

        self.hlayout_zero = QtWidgets.QHBoxLayout()
        self.input_fqpr = BrowseListWidget(self)
        self.input_fqpr.sizeHint()
        self.input_fqpr.setup(mode='directory',
                              registry_key='kluster',
                              app_name='klusterbrowse',
                              filebrowse_title='Select input processed folder')
        self.hlayout_zero.addWidget(self.input_fqpr)

        self.posmv_msg = QtWidgets.QLabel('POSMV Files')

        self.hlayout_two = QtWidgets.QHBoxLayout()
        self.posmvfiles = BrowseListWidget(self)
        self.posmvfiles.setup(registry_key='kluster',
                              app_name='klusterbrowse',
                              multiselect=True,
                              filebrowse_title='Select POS MV files')
        self.hlayout_two.addWidget(self.posmvfiles)

        self.override_check = QtWidgets.QGroupBox('Manually set metadata')
        self.override_check.setCheckable(False)
        self.override_check.setChecked(True)
        self.overrideopts = QtWidgets.QVBoxLayout()
        self.hlayout_four_one = QtWidgets.QHBoxLayout()
        self.caltext = QtWidgets.QLabel('Date of POS MV File')
        self.hlayout_four_one.addWidget(self.caltext)
        self.calendar_widget = QtWidgets.QDateEdit()
        self.calendar_widget.setMaximumWidth(100)
        self.calendar_widget.setCalendarPopup(True)
        currdate = datetime.now()
        self.calendar_widget.setDate(
            QtCore.QDate(currdate.year, currdate.month, currdate.day))
        self.hlayout_four_one.addWidget(self.calendar_widget)
        self.hlayout_four_two = QtWidgets.QHBoxLayout()
        self.overrideopts.addLayout(self.hlayout_four_one)
        self.overrideopts.addLayout(self.hlayout_four_two)
        self.override_check.setLayout(self.overrideopts)

        self.status_msg = QtWidgets.QLabel('')
        self.status_msg.setStyleSheet("QLabel { " +
                                      kluster_variables.error_color + "; }")

        self.hlayout_five = QtWidgets.QHBoxLayout()
        self.hlayout_five.addStretch(1)
        self.ok_button = QtWidgets.QPushButton('OK', self)
        self.hlayout_five.addWidget(self.ok_button)
        self.hlayout_five.addStretch(1)
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        self.hlayout_five.addWidget(self.cancel_button)
        self.hlayout_five.addStretch(1)

        layout.addWidget(self.input_msg)
        layout.addLayout(self.hlayout_zero)
        layout.addWidget(self.posmv_msg)
        layout.addLayout(self.hlayout_two)
        layout.addWidget(self.override_check)
        layout.addWidget(self.status_msg)
        layout.addLayout(self.hlayout_five)
        self.setLayout(layout)

        self.pos_files = []
        self.fqpr_inst = []
        self.canceled = False

        self.input_fqpr.files_updated.connect(
            self._event_update_fqpr_instances)
        self.posmvfiles.files_updated.connect(self.update_posmv_files)
        self.ok_button.clicked.connect(self.start_processing)
        self.cancel_button.clicked.connect(self.cancel_processing)

        self.resize(600, 500)

    def _event_update_fqpr_instances(self):
        """
        Method for connecting the input_fqpr signal with the update_fqpr_instances
        """

        self.update_fqpr_instances()

    def update_fqpr_instances(self, addtl_files=None):
        """
        Used through kluster_main to update the list_widget with new multibeam files to process

        Parameters
        ----------
        addtl_files: optional, list, list of multibeam files (string file paths)

        """
        if addtl_files is not None:
            self.input_fqpr.add_new_files(addtl_files)
        self.fqpr_inst = self.input_fqpr.return_all_items()

    def update_posmv_files(self):
        """
        Populate self.pos_files with new pos files from the list widget
        """
        self.pos_files = self.posmvfiles.return_all_items()

    def return_processing_options(self):
        """
        Return a dict of processing options to feed to fqpr_convenience.process_multibeam

        """

        weekstart_year, weekstart_week, dy = datetime.strptime(
            self.calendar_widget.text(), '%m/%d/%Y').isocalendar()

        # always overwrite when the user uses the manual import with this dialog
        if not self.canceled:
            opts = {
                'fqpr_inst': self.fqpr_inst,
                'navfiles': self.pos_files,
                'weekstart_year': weekstart_year,
                'weekstart_week': weekstart_week,
                'overwrite': True
            }
        else:
            opts = None
        return opts

    def start_processing(self):
        """
        Dialog completes if the specified widgets are populated, use return_processing_options to get access to the
        settings the user entered into the dialog.
        """
        if not self.fqpr_inst and not self.pos_files:
            self.status_msg.setText(
                'Error: You must select source data and pos mv files to continue'
            )
        else:
            self.canceled = False
            self.accept()

    def cancel_processing(self):
        """
        Dialog completes, use self.canceled to get the fact that it cancelled
        """
        self.canceled = True
        self.accept()
Exemplo n.º 3
0
class ConversionDialog(QtWidgets.QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setWindowTitle('Multibeam Conversion')
        layout = QtWidgets.QVBoxLayout()

        self.start_msg = QtWidgets.QLabel('Select the output directory for the converted data:')

        self.hlayout_one = QtWidgets.QHBoxLayout()
        self.fil_text = QtWidgets.QLineEdit('', self)
        self.fil_text.setMinimumWidth(400)
        self.fil_text.setReadOnly(True)
        self.hlayout_one.addWidget(self.fil_text)
        self.browse_button = QtWidgets.QPushButton("Browse", self)
        self.hlayout_one.addWidget(self.browse_button)

        self.tree_msg = QtWidgets.QLabel('Output will look like this:')

        self.hlayout_two = QtWidgets.QHBoxLayout()
        self.output_tree = QtWidgets.QTextEdit('', self)
        self.output_tree.setReadOnly(True)
        self.output_tree.setMinimumHeight(110)
        self.output_tree.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.hlayout_two.addWidget(self.output_tree)

        self.infiles_msg = QtWidgets.QLabel('Input Files include:')

        self.hlayout_three = QtWidgets.QHBoxLayout()
        self.mbesfiles = BrowseListWidget(self)
        self.mbesfiles.setup(registry_key='kluster', app_name='klusterbrowse', supported_file_extension=['.kmall', '.all'],
                             multiselect=True, filebrowse_title='Select multibeam files',
                             filebrowse_filter='Kongsberg (*.kmall *.all)')
        self.hlayout_three.addWidget(self.mbesfiles)

        self.status_msg = QtWidgets.QLabel('')
        self.status_msg.setStyleSheet("QLabel { " + kluster_variables.error_color + "; }")

        self.hlayout_four = QtWidgets.QHBoxLayout()
        self.hlayout_four.addStretch(1)
        self.ok_button = QtWidgets.QPushButton('OK', self)
        self.hlayout_four.addWidget(self.ok_button)
        self.hlayout_four.addStretch(1)
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        self.hlayout_four.addWidget(self.cancel_button)
        self.hlayout_four.addStretch(1)

        layout.addWidget(self.start_msg)
        layout.addLayout(self.hlayout_one)
        layout.addWidget(self.tree_msg)
        layout.addLayout(self.hlayout_two)
        layout.addWidget(self.infiles_msg)
        layout.addLayout(self.hlayout_three)
        layout.addWidget(self.status_msg)
        layout.addLayout(self.hlayout_four)
        self.setLayout(layout)

        self.output_pth = None
        self.cancelled = False

        self.update_output_structure_view()

        self.multibeam_files = []

        self.mbesfiles.files_updated.connect(self._event_update_multibeam_files)
        self.browse_button.clicked.connect(self.file_browse)
        self.ok_button.clicked.connect(self.return_path)
        self.cancel_button.clicked.connect(self.return_without_path)

    def _event_update_multibeam_files(self, e):
        self.update_multibeam_files()

    def update_multibeam_files(self, addtl_files=None):
        if addtl_files is not None:
            self.mbesfiles.add_new_files(addtl_files)
        self.multibeam_files = [self.mbesfiles.list_widget.item(i).text() for i in range(self.mbesfiles.list_widget.count())]

    def file_browse(self):
        # dirpath will be None or a string
        msg, self.output_pth = RegistryHelpers.GetDirFromUserQT(self, RegistryKey='Kluster',
                                                                Title='Select output directory', AppName='\\reghelp')
        if self.output_pth is not None:
            self.fil_text.setText(self.output_pth)
        self.update_output_structure_view()

    def update_output_structure_view(self):
        if (self.output_pth is None) or (not self.output_pth):
            self.output_tree.setText('')
        else:
            # if the folder exists but is not empty, we are going to be adding a timestamp so that we never convert
            #   into an existing storage folder, illustrate this below with suffix
            suffix = ''
            if os.path.exists(self.output_pth) and os.listdir(self.output_pth):
                suffix = '_XXXXXX'
            file_structure = '{}\n'.format(self.output_pth + suffix)
            file_structure += r' - {}\attitude.zarr'.format(self.output_pth + suffix) + '\n'
            file_structure += r' - {}\navigation.zarr'.format(self.output_pth + suffix) + '\n'
            file_structure += r' - {}\ping_xxxx.zarr'.format(self.output_pth + suffix) + '\n'
            file_structure += r' - {}\logfile_XXXX.txt'.format(self.output_pth + suffix) + '\n'
            self.output_tree.setText(file_structure)
            self.status_msg.setText('')

    def return_path(self):
        if self.output_pth is not None:
            self.accept()
        else:
            self.status_msg.setText('Error: You must either Browse to a directory or hit Cancel')

    def return_without_path(self):
        self.cancelled = True
        self.accept()
Exemplo n.º 4
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setWindowTitle('Multibeam Conversion')
        layout = QtWidgets.QVBoxLayout()

        self.start_msg = QtWidgets.QLabel('Select the output directory for the converted data:')

        self.hlayout_one = QtWidgets.QHBoxLayout()
        self.fil_text = QtWidgets.QLineEdit('', self)
        self.fil_text.setMinimumWidth(400)
        self.fil_text.setReadOnly(True)
        self.hlayout_one.addWidget(self.fil_text)
        self.browse_button = QtWidgets.QPushButton("Browse", self)
        self.hlayout_one.addWidget(self.browse_button)

        self.tree_msg = QtWidgets.QLabel('Output will look like this:')

        self.hlayout_two = QtWidgets.QHBoxLayout()
        self.output_tree = QtWidgets.QTextEdit('', self)
        self.output_tree.setReadOnly(True)
        self.output_tree.setMinimumHeight(110)
        self.output_tree.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.hlayout_two.addWidget(self.output_tree)

        self.infiles_msg = QtWidgets.QLabel('Input Files include:')

        self.hlayout_three = QtWidgets.QHBoxLayout()
        self.mbesfiles = BrowseListWidget(self)
        self.mbesfiles.setup(registry_key='kluster', app_name='klusterbrowse', supported_file_extension=['.kmall', '.all'],
                             multiselect=True, filebrowse_title='Select multibeam files',
                             filebrowse_filter='Kongsberg (*.kmall *.all)')
        self.hlayout_three.addWidget(self.mbesfiles)

        self.status_msg = QtWidgets.QLabel('')
        self.status_msg.setStyleSheet("QLabel { " + kluster_variables.error_color + "; }")

        self.hlayout_four = QtWidgets.QHBoxLayout()
        self.hlayout_four.addStretch(1)
        self.ok_button = QtWidgets.QPushButton('OK', self)
        self.hlayout_four.addWidget(self.ok_button)
        self.hlayout_four.addStretch(1)
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        self.hlayout_four.addWidget(self.cancel_button)
        self.hlayout_four.addStretch(1)

        layout.addWidget(self.start_msg)
        layout.addLayout(self.hlayout_one)
        layout.addWidget(self.tree_msg)
        layout.addLayout(self.hlayout_two)
        layout.addWidget(self.infiles_msg)
        layout.addLayout(self.hlayout_three)
        layout.addWidget(self.status_msg)
        layout.addLayout(self.hlayout_four)
        self.setLayout(layout)

        self.output_pth = None
        self.cancelled = False

        self.update_output_structure_view()

        self.multibeam_files = []

        self.mbesfiles.files_updated.connect(self._event_update_multibeam_files)
        self.browse_button.clicked.connect(self.file_browse)
        self.ok_button.clicked.connect(self.return_path)
        self.cancel_button.clicked.connect(self.return_without_path)
    def __init__(self, parent=None, title='', settings=None):
        super().__init__(parent, settings, widgetname='export_tracklines')

        self.setWindowTitle('Export Tracklines')
        layout = QtWidgets.QVBoxLayout()

        self.basic_export_group = QtWidgets.QGroupBox(
            'Export from the following datasets:')
        self.basic_export_group.setCheckable(True)
        self.basic_export_group.setChecked(True)
        self.hlayout_zero = QtWidgets.QHBoxLayout()
        self.input_fqpr = BrowseListWidget(self)
        self.input_fqpr.sizeHint()
        self.input_fqpr.setup(mode='directory',
                              registry_key='kluster',
                              app_name='klusterbrowse',
                              filebrowse_title='Select input processed folder')
        self.input_fqpr.setMinimumWidth(600)
        self.hlayout_zero.addWidget(self.input_fqpr)
        self.basic_export_group.setLayout(self.hlayout_zero)

        self.line_export = QtWidgets.QCheckBox('Export selected lines')
        self.line_export.setChecked(False)

        self.hlayout_one = QtWidgets.QHBoxLayout()
        self.start_msg = QtWidgets.QLabel('Export to: ')
        self.hlayout_one.addWidget(self.start_msg)
        self.export_opts = QtWidgets.QComboBox()
        self.export_opts.addItems(['geopackage'])
        self.hlayout_one.addWidget(self.export_opts)
        self.hlayout_one.addStretch()

        self.output_msg = QtWidgets.QLabel('Export to the following:')

        self.hlayout_one_one = QtWidgets.QHBoxLayout()
        self.output_text = QtWidgets.QLineEdit('', self)
        self.output_text.setMinimumWidth(400)
        self.output_text.setReadOnly(True)
        self.hlayout_one_one.addWidget(self.output_text)
        self.output_button = QtWidgets.QPushButton("Browse", self)
        self.hlayout_one_one.addWidget(self.output_button)

        self.status_msg = QtWidgets.QLabel('')
        self.status_msg.setStyleSheet("QLabel { color : " +
                                      kluster_variables.error_color + "; }")

        self.hlayout_two = QtWidgets.QHBoxLayout()
        self.hlayout_two.addStretch(1)
        self.ok_button = QtWidgets.QPushButton('OK', self)
        self.hlayout_two.addWidget(self.ok_button)
        self.hlayout_two.addStretch(1)
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        self.hlayout_two.addWidget(self.cancel_button)
        self.hlayout_two.addStretch(1)

        layout.addWidget(self.basic_export_group)
        layout.addWidget(self.line_export)
        layout.addWidget(QtWidgets.QLabel(' '))
        layout.addLayout(self.hlayout_one)
        layout.addWidget(self.output_msg)
        layout.addLayout(self.hlayout_one_one)
        layout.addWidget(self.status_msg)
        layout.addLayout(self.hlayout_two)
        self.setLayout(layout)

        self.fqpr_inst = []
        self.canceled = False

        self.basic_export_group.toggled.connect(self._handle_basic_checked)
        self.line_export.toggled.connect(self._handle_line_checked)
        self.output_button.clicked.connect(self.output_file_browse)
        self.input_fqpr.files_updated.connect(
            self._event_update_fqpr_instances)
        self.ok_button.clicked.connect(self.start_export)
        self.cancel_button.clicked.connect(self.cancel_export)

        self.text_controls = [['export_ops', self.export_opts],
                              ['output_text', self.output_text]]
        self.checkbox_controls = [[
            'basic_export_group', self.basic_export_group
        ], ['line_export', self.line_export]]
        self.read_settings()
class ExportTracklinesDialog(SaveStateDialog):
    """
    Dialog allows for providing fqpr data for exporting and the desired export type, in self.export_opts.

    fqpr = fully qualified ping record, the term for the datastore in kluster
    """
    def __init__(self, parent=None, title='', settings=None):
        super().__init__(parent, settings, widgetname='export_tracklines')

        self.setWindowTitle('Export Tracklines')
        layout = QtWidgets.QVBoxLayout()

        self.basic_export_group = QtWidgets.QGroupBox(
            'Export from the following datasets:')
        self.basic_export_group.setCheckable(True)
        self.basic_export_group.setChecked(True)
        self.hlayout_zero = QtWidgets.QHBoxLayout()
        self.input_fqpr = BrowseListWidget(self)
        self.input_fqpr.sizeHint()
        self.input_fqpr.setup(mode='directory',
                              registry_key='kluster',
                              app_name='klusterbrowse',
                              filebrowse_title='Select input processed folder')
        self.input_fqpr.setMinimumWidth(600)
        self.hlayout_zero.addWidget(self.input_fqpr)
        self.basic_export_group.setLayout(self.hlayout_zero)

        self.line_export = QtWidgets.QCheckBox('Export selected lines')
        self.line_export.setChecked(False)

        self.hlayout_one = QtWidgets.QHBoxLayout()
        self.start_msg = QtWidgets.QLabel('Export to: ')
        self.hlayout_one.addWidget(self.start_msg)
        self.export_opts = QtWidgets.QComboBox()
        self.export_opts.addItems(['geopackage'])
        self.hlayout_one.addWidget(self.export_opts)
        self.hlayout_one.addStretch()

        self.output_msg = QtWidgets.QLabel('Export to the following:')

        self.hlayout_one_one = QtWidgets.QHBoxLayout()
        self.output_text = QtWidgets.QLineEdit('', self)
        self.output_text.setMinimumWidth(400)
        self.output_text.setReadOnly(True)
        self.hlayout_one_one.addWidget(self.output_text)
        self.output_button = QtWidgets.QPushButton("Browse", self)
        self.hlayout_one_one.addWidget(self.output_button)

        self.status_msg = QtWidgets.QLabel('')
        self.status_msg.setStyleSheet("QLabel { color : " +
                                      kluster_variables.error_color + "; }")

        self.hlayout_two = QtWidgets.QHBoxLayout()
        self.hlayout_two.addStretch(1)
        self.ok_button = QtWidgets.QPushButton('OK', self)
        self.hlayout_two.addWidget(self.ok_button)
        self.hlayout_two.addStretch(1)
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        self.hlayout_two.addWidget(self.cancel_button)
        self.hlayout_two.addStretch(1)

        layout.addWidget(self.basic_export_group)
        layout.addWidget(self.line_export)
        layout.addWidget(QtWidgets.QLabel(' '))
        layout.addLayout(self.hlayout_one)
        layout.addWidget(self.output_msg)
        layout.addLayout(self.hlayout_one_one)
        layout.addWidget(self.status_msg)
        layout.addLayout(self.hlayout_two)
        self.setLayout(layout)

        self.fqpr_inst = []
        self.canceled = False

        self.basic_export_group.toggled.connect(self._handle_basic_checked)
        self.line_export.toggled.connect(self._handle_line_checked)
        self.output_button.clicked.connect(self.output_file_browse)
        self.input_fqpr.files_updated.connect(
            self._event_update_fqpr_instances)
        self.ok_button.clicked.connect(self.start_export)
        self.cancel_button.clicked.connect(self.cancel_export)

        self.text_controls = [['export_ops', self.export_opts],
                              ['output_text', self.output_text]]
        self.checkbox_controls = [[
            'basic_export_group', self.basic_export_group
        ], ['line_export', self.line_export]]
        self.read_settings()

    @property
    def export_format(self):
        if self.export_opts.currentText() == 'geopackage':
            return 'GPKG'

    def _handle_basic_checked(self, evt):
        """
        Ensure only one group at a time is selected
        """

        if evt:
            self.line_export.setChecked(False)
            self.status_msg.setStyleSheet("QLabel { color: " +
                                          kluster_variables.pass_color + "; }")
            self.status_msg.setText('')

    def _handle_line_checked(self, evt):
        """
        Ensure only one group at a time is selected
        """

        if evt:
            self.basic_export_group.setChecked(False)
            self.status_msg.setStyleSheet("QLabel { color : " +
                                          kluster_variables.pass_color + "; }")
            self.status_msg.setText('')

    def output_file_browse(self):
        curr_opts = self.export_opts.currentText().lower()
        if curr_opts == 'geopackage':
            titl = 'Select output geopackage file'
            ffilter = "gpkg file|*.gpkg"
        else:
            raise ValueError(
                'dialog_export_tracklines: unrecognized method: {}'.format(
                    curr_opts))

        # dirpath will be None or a string
        msg, outpth = RegistryHelpers.GetFilenameFromUserQT(
            self,
            RegistryKey='Kluster',
            DefaultFile=self.output_text.text(),
            Title=titl,
            fFilter=ffilter,
            AppName='\\reghelp')
        if outpth:
            self.output_text.setText(outpth)

    def _event_update_fqpr_instances(self):
        """
        Method for connecting the input_fqpr signal with the update_fqpr_instances
        """

        self.update_fqpr_instances()

    def update_fqpr_instances(self, addtl_files=None):
        """
        Used through kluster_main to update the list_widget with new multibeam files to process

        Parameters
        ----------
        addtl_files: optional, list, list of multibeam files (string file paths)

        """
        if addtl_files is not None:
            self.input_fqpr.add_new_files(addtl_files)
        self.fqpr_inst = [
            self.input_fqpr.list_widget.item(i).text()
            for i in range(self.input_fqpr.list_widget.count())
        ]
        self.status_msg.setText('')

    def start_export(self):
        """
        Dialog completes if the specified widgets are populated
        """
        if self.basic_export_group.isChecked() and not self.fqpr_inst:
            self.status_msg.setStyleSheet("QLabel { color : " +
                                          kluster_variables.error_color +
                                          "; }")
            self.status_msg.setText('Error: No data provided')
        elif not self.basic_export_group.isChecked(
        ) and not self.line_export.isChecked():
            self.status_msg.setStyleSheet("QLabel { color : " +
                                          kluster_variables.error_color +
                                          "; }")
            self.status_msg.setText(
                'Error: You must select one of the three export modes (export datasets, export lines, export points)'
            )
        else:
            self.canceled = False
            self.save_settings()
            self.accept()

    def cancel_export(self):
        """
        Dialog completes, use self.canceled to get the fact that it cancelled
        """
        self.canceled = True
        self.accept()
Exemplo n.º 7
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setWindowTitle('Import Post Processed Navigation')
        layout = QtWidgets.QVBoxLayout()

        self.input_msg = QtWidgets.QLabel('Apply to the following:')

        self.hlayout_zero = QtWidgets.QHBoxLayout()
        self.input_fqpr = BrowseListWidget(self)
        self.input_fqpr.sizeHint()
        self.input_fqpr.setup(mode='directory', registry_key='kluster', app_name='klusterbrowse',
                              filebrowse_title='Select input processed folder')
        self.hlayout_zero.addWidget(self.input_fqpr)

        self.sbet_msg = QtWidgets.QLabel('POSPac SBET Files')

        self.hlayout_two = QtWidgets.QHBoxLayout()
        self.sbetfiles = BrowseListWidget(self)
        self.sbetfiles.setup(registry_key='kluster', app_name='klusterbrowse', supported_file_extension=['.out', '.sbet'],
                             multiselect=True, filebrowse_title='Select SBET files',
                             filebrowse_filter='POSPac SBET files (*.out;*.sbet)')
        self.hlayout_two.addWidget(self.sbetfiles)

        self.smrmsg_msg = QtWidgets.QLabel('POSPac SMRMSG Files')

        self.hlayout_three = QtWidgets.QHBoxLayout()
        self.smrmsgfiles = BrowseListWidget(self)
        self.smrmsgfiles.setup(registry_key='kluster', app_name='klusterbrowse', supported_file_extension=['.out', '.smrmsg'],
                               multiselect=True, filebrowse_title='Select SMRMSG files',
                               filebrowse_filter='POSPac SMRMSG files (*.out;*.smrmsg)')
        self.hlayout_three.addWidget(self.smrmsgfiles)

        self.log_check = QtWidgets.QGroupBox('Load from POSPac export log')
        self.log_check.setCheckable(True)
        self.log_check.setChecked(True)
        self.logopts = QtWidgets.QVBoxLayout()
        self.hlayout_one = QtWidgets.QHBoxLayout()
        self.log_file = QtWidgets.QLineEdit('', self)
        self.log_file.setMinimumWidth(400)
        self.log_file.setReadOnly(True)
        self.hlayout_one.addWidget(self.log_file)
        self.browse_button = QtWidgets.QPushButton("Browse", self)
        self.hlayout_one.addWidget(self.browse_button)
        self.logopts.addLayout(self.hlayout_one)
        self.log_check.setLayout(self.logopts)

        self.override_check = QtWidgets.QGroupBox('Manually set metadata')
        self.override_check.setCheckable(True)
        self.override_check.setChecked(False)
        self.overrideopts = QtWidgets.QVBoxLayout()
        self.hlayout_four_one = QtWidgets.QHBoxLayout()
        self.caltext = QtWidgets.QLabel('Date of SBET')
        self.hlayout_four_one.addWidget(self.caltext)
        self.calendar_widget = QtWidgets.QDateEdit()
        self.calendar_widget.setMaximumWidth(100)
        self.calendar_widget.setCalendarPopup(True)
        currdate = datetime.now()
        self.calendar_widget.setDate(QtCore.QDate(currdate.year, currdate.month, currdate.day))
        self.hlayout_four_one.addWidget(self.calendar_widget)
        self.hlayout_four_two = QtWidgets.QHBoxLayout()
        self.datumtext = QtWidgets.QLabel('Coordinate System')
        self.hlayout_four_two.addWidget(self.datumtext)
        self.datum_val = QtWidgets.QComboBox()
        self.datum_val.addItems(['NAD83', 'WGS84'])
        self.datum_val.setMaximumWidth(100)
        self.hlayout_four_two.addWidget(self.datum_val)
        self.overrideopts.addLayout(self.hlayout_four_one)
        self.overrideopts.addLayout(self.hlayout_four_two)
        self.override_check.setLayout(self.overrideopts)

        self.status_msg = QtWidgets.QLabel('')
        self.status_msg.setStyleSheet("QLabel { " + kluster_variables.error_color + "; }")

        self.hlayout_five = QtWidgets.QHBoxLayout()
        self.hlayout_five.addStretch(1)
        self.ok_button = QtWidgets.QPushButton('OK', self)
        self.hlayout_five.addWidget(self.ok_button)
        self.hlayout_five.addStretch(1)
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        self.hlayout_five.addWidget(self.cancel_button)
        self.hlayout_five.addStretch(1)

        layout.addWidget(self.input_msg)
        layout.addLayout(self.hlayout_zero)
        layout.addWidget(self.sbet_msg)
        layout.addLayout(self.hlayout_two)
        layout.addWidget(self.smrmsg_msg)
        layout.addLayout(self.hlayout_three)
        layout.addWidget(self.log_check)
        layout.addWidget(self.override_check)
        layout.addWidget(self.status_msg)
        layout.addLayout(self.hlayout_five)
        self.setLayout(layout)

        self.log_file_path = ''
        self.sbet_files = []
        self.smrmsg_files = []
        self.fqpr_inst = []
        self.canceled = False

        self.browse_button.clicked.connect(self.file_browse)
        self.log_check.clicked.connect(self.log_override_checked)
        self.override_check.clicked.connect(self.log_override_checked)
        self.input_fqpr.files_updated.connect(self._event_update_fqpr_instances)
        self.sbetfiles.files_updated.connect(self.update_sbet_files)
        self.smrmsgfiles.files_updated.connect(self.update_smrmsg_files)
        self.ok_button.clicked.connect(self.start_processing)
        self.cancel_button.clicked.connect(self.cancel_processing)

        self.resize(600, 500)
Exemplo n.º 8
0
class ImportPostProcNavigationDialog(QtWidgets.QDialog):
    """
    Dialog contains all the options related to importing post processed navigation (POSPac SBET).  Use
    return_processing_options to get the kwargs to feed the fqpr_convenience.process_multibeam function.

    fqpr = fully qualified ping record, the term for the datastore in kluster
    """
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setWindowTitle('Import Post Processed Navigation')
        layout = QtWidgets.QVBoxLayout()

        self.input_msg = QtWidgets.QLabel('Apply to the following:')

        self.hlayout_zero = QtWidgets.QHBoxLayout()
        self.input_fqpr = BrowseListWidget(self)
        self.input_fqpr.sizeHint()
        self.input_fqpr.setup(mode='directory', registry_key='kluster', app_name='klusterbrowse',
                              filebrowse_title='Select input processed folder')
        self.hlayout_zero.addWidget(self.input_fqpr)

        self.sbet_msg = QtWidgets.QLabel('POSPac SBET Files')

        self.hlayout_two = QtWidgets.QHBoxLayout()
        self.sbetfiles = BrowseListWidget(self)
        self.sbetfiles.setup(registry_key='kluster', app_name='klusterbrowse', supported_file_extension=['.out', '.sbet'],
                             multiselect=True, filebrowse_title='Select SBET files',
                             filebrowse_filter='POSPac SBET files (*.out;*.sbet)')
        self.hlayout_two.addWidget(self.sbetfiles)

        self.smrmsg_msg = QtWidgets.QLabel('POSPac SMRMSG Files')

        self.hlayout_three = QtWidgets.QHBoxLayout()
        self.smrmsgfiles = BrowseListWidget(self)
        self.smrmsgfiles.setup(registry_key='kluster', app_name='klusterbrowse', supported_file_extension=['.out', '.smrmsg'],
                               multiselect=True, filebrowse_title='Select SMRMSG files',
                               filebrowse_filter='POSPac SMRMSG files (*.out;*.smrmsg)')
        self.hlayout_three.addWidget(self.smrmsgfiles)

        self.log_check = QtWidgets.QGroupBox('Load from POSPac export log')
        self.log_check.setCheckable(True)
        self.log_check.setChecked(True)
        self.logopts = QtWidgets.QVBoxLayout()
        self.hlayout_one = QtWidgets.QHBoxLayout()
        self.log_file = QtWidgets.QLineEdit('', self)
        self.log_file.setMinimumWidth(400)
        self.log_file.setReadOnly(True)
        self.hlayout_one.addWidget(self.log_file)
        self.browse_button = QtWidgets.QPushButton("Browse", self)
        self.hlayout_one.addWidget(self.browse_button)
        self.logopts.addLayout(self.hlayout_one)
        self.log_check.setLayout(self.logopts)

        self.override_check = QtWidgets.QGroupBox('Manually set metadata')
        self.override_check.setCheckable(True)
        self.override_check.setChecked(False)
        self.overrideopts = QtWidgets.QVBoxLayout()
        self.hlayout_four_one = QtWidgets.QHBoxLayout()
        self.caltext = QtWidgets.QLabel('Date of SBET')
        self.hlayout_four_one.addWidget(self.caltext)
        self.calendar_widget = QtWidgets.QDateEdit()
        self.calendar_widget.setMaximumWidth(100)
        self.calendar_widget.setCalendarPopup(True)
        currdate = datetime.now()
        self.calendar_widget.setDate(QtCore.QDate(currdate.year, currdate.month, currdate.day))
        self.hlayout_four_one.addWidget(self.calendar_widget)
        self.hlayout_four_two = QtWidgets.QHBoxLayout()
        self.datumtext = QtWidgets.QLabel('Coordinate System')
        self.hlayout_four_two.addWidget(self.datumtext)
        self.datum_val = QtWidgets.QComboBox()
        self.datum_val.addItems(['NAD83', 'WGS84'])
        self.datum_val.setMaximumWidth(100)
        self.hlayout_four_two.addWidget(self.datum_val)
        self.overrideopts.addLayout(self.hlayout_four_one)
        self.overrideopts.addLayout(self.hlayout_four_two)
        self.override_check.setLayout(self.overrideopts)

        self.status_msg = QtWidgets.QLabel('')
        self.status_msg.setStyleSheet("QLabel { " + kluster_variables.error_color + "; }")

        self.hlayout_five = QtWidgets.QHBoxLayout()
        self.hlayout_five.addStretch(1)
        self.ok_button = QtWidgets.QPushButton('OK', self)
        self.hlayout_five.addWidget(self.ok_button)
        self.hlayout_five.addStretch(1)
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        self.hlayout_five.addWidget(self.cancel_button)
        self.hlayout_five.addStretch(1)

        layout.addWidget(self.input_msg)
        layout.addLayout(self.hlayout_zero)
        layout.addWidget(self.sbet_msg)
        layout.addLayout(self.hlayout_two)
        layout.addWidget(self.smrmsg_msg)
        layout.addLayout(self.hlayout_three)
        layout.addWidget(self.log_check)
        layout.addWidget(self.override_check)
        layout.addWidget(self.status_msg)
        layout.addLayout(self.hlayout_five)
        self.setLayout(layout)

        self.log_file_path = ''
        self.sbet_files = []
        self.smrmsg_files = []
        self.fqpr_inst = []
        self.canceled = False

        self.browse_button.clicked.connect(self.file_browse)
        self.log_check.clicked.connect(self.log_override_checked)
        self.override_check.clicked.connect(self.log_override_checked)
        self.input_fqpr.files_updated.connect(self._event_update_fqpr_instances)
        self.sbetfiles.files_updated.connect(self.update_sbet_files)
        self.smrmsgfiles.files_updated.connect(self.update_smrmsg_files)
        self.ok_button.clicked.connect(self.start_processing)
        self.cancel_button.clicked.connect(self.cancel_processing)

        self.resize(600, 500)

    def file_browse(self):
        # dirpath will be None or a string
        msg, self.log_file_path = RegistryHelpers.GetFilenameFromUserQT(self, RegistryKey='Kluster',
                                                                        Title='Select POSPac Export Log',
                                                                        AppName='\\reghelp', bSave=False,
                                                                        fFilter="Log Files|*.txt;*.log")
        if self.log_file_path is not None:
            self.log_file.setText(self.log_file_path)

    def log_override_checked(self):
        """
        Either override or export log is required, but not both.  Make it so only one can be checked at a time
        """
        if self.sender() == self.log_check:
            if self.log_check.isChecked():
                self.override_check.setChecked(False)
            else:
                self.override_check.setChecked(True)
        else:
            if self.override_check.isChecked():
                self.log_check.setChecked(False)
            else:
                self.log_check.setChecked(True)

    def _event_update_fqpr_instances(self):
        """
        Method for connecting the input_fqpr signal with the update_fqpr_instances
        """

        self.update_fqpr_instances()

    def update_fqpr_instances(self, addtl_files=None):
        """
        Used through kluster_main to update the list_widget with new multibeam files to process

        Parameters
        ----------
        addtl_files: optional, list, list of multibeam files (string file paths)

        """
        if addtl_files is not None:
            self.input_fqpr.add_new_files(addtl_files)
        self.fqpr_inst = self.input_fqpr.return_all_items()

    def update_sbet_files(self):
        """
        Populate self.sbet_files with new sbet files from the list widget
        """
        self.sbet_files = self.sbetfiles.return_all_items()

    def update_smrmsg_files(self):
        """
        Populate self.smrmsg_files with new smrmsg files from the list widget
        """
        self.smrmsg_files = self.smrmsgfiles.return_all_items()

    def return_processing_options(self):
        """
        Return a dict of processing options to feed to fqpr_convenience.process_multibeam

        """
        if self.log_check.isChecked():
            logfiles = [self.log_file_path] * len(self.sbet_files)
            weekstart_week = None
            weekstart_year = None
            override_datum = None
        else:
            logfiles = None
            weekstart_year, weekstart_week, dy = datetime.strptime(self.calendar_widget.text(), '%m/%d/%Y').isocalendar()
            override_datum = self.datum_val.currentText()

        if not self.smrmsg_files:
            self.smrmsg_files = None

        # always overwrite when the user uses the manual import with this dialog
        if not self.canceled:
            opts = {'fqpr_inst': self.fqpr_inst, 'navfiles': self.sbet_files, 'errorfiles': self.smrmsg_files,
                    'logfiles': logfiles, 'weekstart_year': weekstart_year, 'weekstart_week': weekstart_week,
                    'override_datum': override_datum, 'overwrite': True}
        else:
            opts = None
        return opts

    def start_processing(self):
        """
        Dialog completes if the specified widgets are populated, use return_processing_options to get access to the
        settings the user entered into the dialog.
        """
        if not self.fqpr_inst and not self.sbet_files:
            self.status_msg.setText('Error: You must select source data and sbet files to continue')
        else:
            self.canceled = False
            self.accept()

    def cancel_processing(self):
        """
        Dialog completes, use self.canceled to get the fact that it cancelled
        """
        self.canceled = True
        self.accept()
Exemplo n.º 9
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setWindowTitle('Export Soundings')
        layout = QtWidgets.QVBoxLayout()

        self.input_msg = QtWidgets.QLabel('Export from the following:')

        self.hlayout_zero = QtWidgets.QHBoxLayout()
        self.input_fqpr = BrowseListWidget(self)
        self.input_fqpr.sizeHint()
        self.input_fqpr.setup(mode='directory', registry_key='kluster', app_name='klusterbrowse',
                              filebrowse_title='Select input processed folder')
        self.input_fqpr.setMinimumWidth(600)
        self.hlayout_zero.addWidget(self.input_fqpr)

        self.hlayout_one = QtWidgets.QHBoxLayout()
        self.start_msg = QtWidgets.QLabel('Export to: ')
        self.hlayout_one.addWidget(self.start_msg)
        self.export_opts = QtWidgets.QComboBox()
        # self.export_opts.addItems(['csv', 'las', 'entwine'])  need to add entwine to the env
        self.export_opts.addItems(['csv', 'las'])
        self.export_opts.setMaximumWidth(100)
        self.hlayout_one.addWidget(self.export_opts)
        self.csvdelimiter_lbl = QtWidgets.QLabel('Delimiter')
        self.hlayout_one.addWidget(self.csvdelimiter_lbl)
        self.csvdelimiter_dropdown = QtWidgets.QComboBox(self)
        self.csvdelimiter_dropdown.addItems(['comma', 'space'])
        self.hlayout_one.addWidget(self.csvdelimiter_dropdown)
        self.hlayout_one.addStretch()

        self.hlayout_one_one = QtWidgets.QHBoxLayout()
        self.zdirect_check = QtWidgets.QCheckBox('Make Z Positive Down')
        self.zdirect_check.setChecked(True)
        self.hlayout_one_one.addWidget(self.zdirect_check)
        self.hlayout_one_one.addStretch()

        self.hlayout_one_three = QtWidgets.QHBoxLayout()
        self.filter_chk = QtWidgets.QCheckBox('Filter Rejected')
        self.filter_chk.setChecked(True)
        self.hlayout_one_three.addWidget(self.filter_chk)
        self.byidentifier_chk = QtWidgets.QCheckBox('Separate Files by Sector/Frequency')
        self.byidentifier_chk.setChecked(False)
        self.hlayout_one_three.addWidget(self.byidentifier_chk)
        self.hlayout_one_three.addStretch()

        self.status_msg = QtWidgets.QLabel('')
        self.status_msg.setStyleSheet("QLabel { " + kluster_variables.error_color + "; }")

        self.hlayout_two = QtWidgets.QHBoxLayout()
        self.hlayout_two.addStretch(1)
        self.ok_button = QtWidgets.QPushButton('OK', self)
        self.hlayout_two.addWidget(self.ok_button)
        self.hlayout_two.addStretch(1)
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        self.hlayout_two.addWidget(self.cancel_button)
        self.hlayout_two.addStretch(1)

        layout.addWidget(self.input_msg)
        layout.addLayout(self.hlayout_zero)
        layout.addLayout(self.hlayout_one)
        layout.addLayout(self.hlayout_one_one)
        layout.addLayout(self.hlayout_one_three)
        layout.addWidget(self.status_msg)
        layout.addLayout(self.hlayout_two)
        self.setLayout(layout)

        self.fqpr_inst = []
        self.canceled = False

        self.input_fqpr.files_updated.connect(self._event_update_fqpr_instances)
        self.export_opts.currentTextChanged.connect(self._event_update_status)
        self.ok_button.clicked.connect(self.start_export)
        self.cancel_button.clicked.connect(self.cancel_export)
Exemplo n.º 10
0
class ExportDialog(QtWidgets.QDialog):
    """
    Dialog allows for providing fqpr data for exporting and the desired export type, in self.export_opts.

    fqpr = fully qualified ping record, the term for the datastore in kluster
    """
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setWindowTitle('Export Soundings')
        layout = QtWidgets.QVBoxLayout()

        self.input_msg = QtWidgets.QLabel('Export from the following:')

        self.hlayout_zero = QtWidgets.QHBoxLayout()
        self.input_fqpr = BrowseListWidget(self)
        self.input_fqpr.sizeHint()
        self.input_fqpr.setup(mode='directory', registry_key='kluster', app_name='klusterbrowse',
                              filebrowse_title='Select input processed folder')
        self.input_fqpr.setMinimumWidth(600)
        self.hlayout_zero.addWidget(self.input_fqpr)

        self.hlayout_one = QtWidgets.QHBoxLayout()
        self.start_msg = QtWidgets.QLabel('Export to: ')
        self.hlayout_one.addWidget(self.start_msg)
        self.export_opts = QtWidgets.QComboBox()
        # self.export_opts.addItems(['csv', 'las', 'entwine'])  need to add entwine to the env
        self.export_opts.addItems(['csv', 'las'])
        self.export_opts.setMaximumWidth(100)
        self.hlayout_one.addWidget(self.export_opts)
        self.csvdelimiter_lbl = QtWidgets.QLabel('Delimiter')
        self.hlayout_one.addWidget(self.csvdelimiter_lbl)
        self.csvdelimiter_dropdown = QtWidgets.QComboBox(self)
        self.csvdelimiter_dropdown.addItems(['comma', 'space'])
        self.hlayout_one.addWidget(self.csvdelimiter_dropdown)
        self.hlayout_one.addStretch()

        self.hlayout_one_one = QtWidgets.QHBoxLayout()
        self.zdirect_check = QtWidgets.QCheckBox('Make Z Positive Down')
        self.zdirect_check.setChecked(True)
        self.hlayout_one_one.addWidget(self.zdirect_check)
        self.hlayout_one_one.addStretch()

        self.hlayout_one_three = QtWidgets.QHBoxLayout()
        self.filter_chk = QtWidgets.QCheckBox('Filter Rejected')
        self.filter_chk.setChecked(True)
        self.hlayout_one_three.addWidget(self.filter_chk)
        self.byidentifier_chk = QtWidgets.QCheckBox('Separate Files by Sector/Frequency')
        self.byidentifier_chk.setChecked(False)
        self.hlayout_one_three.addWidget(self.byidentifier_chk)
        self.hlayout_one_three.addStretch()

        self.status_msg = QtWidgets.QLabel('')
        self.status_msg.setStyleSheet("QLabel { " + kluster_variables.error_color + "; }")

        self.hlayout_two = QtWidgets.QHBoxLayout()
        self.hlayout_two.addStretch(1)
        self.ok_button = QtWidgets.QPushButton('OK', self)
        self.hlayout_two.addWidget(self.ok_button)
        self.hlayout_two.addStretch(1)
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        self.hlayout_two.addWidget(self.cancel_button)
        self.hlayout_two.addStretch(1)

        layout.addWidget(self.input_msg)
        layout.addLayout(self.hlayout_zero)
        layout.addLayout(self.hlayout_one)
        layout.addLayout(self.hlayout_one_one)
        layout.addLayout(self.hlayout_one_three)
        layout.addWidget(self.status_msg)
        layout.addLayout(self.hlayout_two)
        self.setLayout(layout)

        self.fqpr_inst = []
        self.canceled = False

        self.input_fqpr.files_updated.connect(self._event_update_fqpr_instances)
        self.export_opts.currentTextChanged.connect(self._event_update_status)
        self.ok_button.clicked.connect(self.start_export)
        self.cancel_button.clicked.connect(self.cancel_export)

    def _event_update_fqpr_instances(self):
        """
        Method for connecting the input_fqpr signal with the update_fqpr_instances
        """

        self.update_fqpr_instances()

    def _event_update_status(self, combobox_text: str):
        """
        Update the status message if an Error presents itself.  Also controls the OK button, to prevent kicking off
        a process if we know it isn't going to work

        Parameters
        ----------
        combobox_text
            value of the combobox as text
        """

        self._show_hide_options(combobox_text)
        if combobox_text == 'entwine':
            ispydro = is_pydro()
            if ispydro:  # If this is the pydro environment, we know it has Entwine
                self.status_msg.setStyleSheet("QLabel { " + kluster_variables.pass_color + "; }")
                self.status_msg.setText('Pydro found, entwine export allowed')
                self.ok_button.setEnabled(True)
            else:
                self.status_msg.setStyleSheet("QLabel { " + kluster_variables.error_color + "; }")
                self.status_msg.setText('Error: Pydro not found, entwine export is not allowed')
                self.ok_button.setEnabled(False)
        else:
            self.status_msg.setText('')
            self.ok_button.setEnabled(True)

    def _show_hide_options(self, combobox_text):
        if combobox_text == 'csv':
            self.csvdelimiter_dropdown.show()
            self.csvdelimiter_lbl.show()
        else:
            self.csvdelimiter_dropdown.hide()
            self.csvdelimiter_lbl.hide()

    def update_fqpr_instances(self, addtl_files=None):
        """
        Used through kluster_main to update the list_widget with new multibeam files to process

        Parameters
        ----------
        addtl_files: optional, list, list of multibeam files (string file paths)

        """
        if addtl_files is not None:
            self.input_fqpr.add_new_files(addtl_files)
        self.fqpr_inst = [self.input_fqpr.list_widget.item(i).text() for i in range(self.input_fqpr.list_widget.count())]

    def start_export(self):
        """
        Dialog completes if the specified widgets are populated
        """
        if not self.fqpr_inst:
            self.status_msg.setStyleSheet("QLabel { " + kluster_variables.error_color + "; }")
            self.status_msg.setText('Error: No data provided')
        else:
            self.canceled = False
            self.accept()

    def cancel_export(self):
        """
        Dialog completes, use self.canceled to get the fact that it cancelled
        """
        self.canceled = True
        self.accept()
Exemplo n.º 11
0
    def __init__(self, parent=None, title='', settings=None):
        super().__init__(parent, settings, widgetname='export')

        self.setWindowTitle('Export Soundings')
        layout = QtWidgets.QVBoxLayout()

        self.basic_export_group = QtWidgets.QGroupBox(
            'Export from the following datasets:')
        self.basic_export_group.setCheckable(True)
        self.basic_export_group.setChecked(True)
        self.hlayout_zero = QtWidgets.QHBoxLayout()
        self.input_fqpr = BrowseListWidget(self)
        self.input_fqpr.sizeHint()
        self.input_fqpr.setup(mode='directory',
                              registry_key='kluster',
                              app_name='klusterbrowse',
                              filebrowse_title='Select input processed folder')
        self.input_fqpr.setMinimumWidth(600)
        self.hlayout_zero.addWidget(self.input_fqpr)
        self.basic_export_group.setLayout(self.hlayout_zero)

        self.line_export = QtWidgets.QCheckBox('Export selected lines')
        self.line_export.setChecked(False)

        self.points_view_export = QtWidgets.QCheckBox(
            'Export points in Points View')
        self.points_view_export.setChecked(False)

        self.hlayout_one = QtWidgets.QHBoxLayout()
        self.start_msg = QtWidgets.QLabel('Export to: ')
        self.hlayout_one.addWidget(self.start_msg)
        self.export_opts = QtWidgets.QComboBox()
        # self.export_opts.addItems(['csv', 'las', 'entwine'])  need to add entwine to the env
        self.export_opts.addItems(['csv', 'las'])
        self.hlayout_one.addWidget(self.export_opts)
        self.csvdelimiter_lbl = QtWidgets.QLabel('Delimiter')
        self.hlayout_one.addWidget(self.csvdelimiter_lbl)
        self.csvdelimiter_dropdown = QtWidgets.QComboBox(self)
        self.csvdelimiter_dropdown.addItems(['comma', 'space'])
        self.hlayout_one.addWidget(self.csvdelimiter_dropdown)
        self.hlayout_one.addStretch()

        self.hlayout_one_one = QtWidgets.QHBoxLayout()
        self.zdirect_check = QtWidgets.QCheckBox('Make Z Positive Down')
        self.zdirect_check.setChecked(True)
        self.hlayout_one_one.addWidget(self.zdirect_check)
        self.hlayout_one_one.addStretch()

        self.hlayout_one_three = QtWidgets.QHBoxLayout()
        self.filter_chk = QtWidgets.QCheckBox('Filter Rejected')
        self.filter_chk.setChecked(True)
        self.hlayout_one_three.addWidget(self.filter_chk)
        self.byidentifier_chk = QtWidgets.QCheckBox(
            'Separate Files by Sector/Frequency')
        self.byidentifier_chk.setChecked(False)
        self.hlayout_one_three.addWidget(self.byidentifier_chk)
        self.hlayout_one_three.addStretch()

        self.status_msg = QtWidgets.QLabel('')
        self.status_msg.setStyleSheet("QLabel { color : " +
                                      kluster_variables.error_color + "; }")

        self.hlayout_two = QtWidgets.QHBoxLayout()
        self.hlayout_two.addStretch(1)
        self.ok_button = QtWidgets.QPushButton('OK', self)
        self.hlayout_two.addWidget(self.ok_button)
        self.hlayout_two.addStretch(1)
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        self.hlayout_two.addWidget(self.cancel_button)
        self.hlayout_two.addStretch(1)

        layout.addWidget(self.basic_export_group)
        layout.addWidget(self.line_export)
        layout.addWidget(self.points_view_export)
        layout.addWidget(QtWidgets.QLabel(' '))
        layout.addLayout(self.hlayout_one)
        layout.addLayout(self.hlayout_one_one)
        layout.addLayout(self.hlayout_one_three)
        layout.addWidget(self.status_msg)
        layout.addLayout(self.hlayout_two)
        self.setLayout(layout)

        self.fqpr_inst = []
        self.canceled = False

        self.basic_export_group.toggled.connect(self._handle_basic_checked)
        self.line_export.toggled.connect(self._handle_line_checked)
        self.points_view_export.toggled.connect(self._handle_points_checked)
        self.input_fqpr.files_updated.connect(
            self._event_update_fqpr_instances)
        self.export_opts.currentTextChanged.connect(self._event_update_status)
        self.ok_button.clicked.connect(self.start_export)
        self.cancel_button.clicked.connect(self.cancel_export)

        self.text_controls = [['export_ops', self.export_opts],
                              [
                                  'csvdelimiter_dropdown',
                                  self.csvdelimiter_dropdown
                              ]]
        self.checkbox_controls = [[
            'basic_export_group', self.basic_export_group
        ], ['line_export',
            self.line_export], ['points_view_export', self.points_view_export],
                                  ['zdirect_check', self.zdirect_check],
                                  ['filter_chk', self.filter_chk],
                                  ['byidentifier_chk', self.byidentifier_chk]]
        self.read_settings()
        self._event_update_status(self.export_opts.currentText())
Exemplo n.º 12
0
class SurfaceDialog(QtWidgets.QDialog):
    """
    Dialog for selecting surfacing options that we want to use to generate a new surface.
    """
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setWindowTitle('Generate New Surface')
        layout = QtWidgets.QVBoxLayout()

        self.input_msg = QtWidgets.QLabel(
            'Run surface generation on the following:')

        self.hlayout_zero = QtWidgets.QHBoxLayout()

        # fqpr = fully qualified ping record, the term for the datastore in kluster
        self.input_fqpr = BrowseListWidget(self)
        self.input_fqpr.sizeHint()
        self.input_fqpr.setup(mode='directory',
                              registry_key='kluster',
                              app_name='klusterbrowse',
                              filebrowse_title='Select input processed folder')
        self.hlayout_zero.addWidget(self.input_fqpr)

        self.hlayout_one = QtWidgets.QHBoxLayout()
        self.surface_box = QtWidgets.QGroupBox('New Surface')
        self.surf_layout = QtWidgets.QVBoxLayout()
        self.surf_msg = QtWidgets.QLabel('Select from the following options:')
        self.surf_layout.addWidget(self.surf_msg)

        self.hlayout_one_one = QtWidgets.QHBoxLayout()
        self.surf_method_lbl = QtWidgets.QLabel('Method: ')
        self.hlayout_one_one.addWidget(self.surf_method_lbl)
        self.surf_method = QtWidgets.QComboBox()
        self.surf_method.addItems(['Mean'])
        self.surf_method.setMaximumWidth(100)
        self.hlayout_one_one.addWidget(self.surf_method)
        self.surf_resolution_lbl = QtWidgets.QLabel('Resolution: ')
        self.hlayout_one_one.addWidget(self.surf_resolution_lbl)
        self.surf_resolution = QtWidgets.QComboBox()
        self.surf_resolution.addItems([
            '0.25', '0.50', '1.0', '2.0', '4.0', '8.0', '16.0', '32.0', '64.0',
            '128.0'
        ])
        self.surf_resolution.setMaximumWidth(60)
        self.hlayout_one_one.addWidget(self.surf_resolution)
        self.soundings_per_node_lbl = QtWidgets.QLabel(
            'Required Soundings/Node: ')
        self.hlayout_one_one.addWidget(self.soundings_per_node_lbl)
        self.soundings_per_node = QtWidgets.QLineEdit('')
        self.soundings_per_node.setInputMask('0;_')
        self.soundings_per_node.setMaximumWidth(13)
        self.soundings_per_node.setText('5')
        self.soundings_per_node.setDisabled(True)
        self.hlayout_one_one.addWidget(self.soundings_per_node)
        self.hlayout_one_one.addStretch(1)
        self.surf_layout.addLayout(self.hlayout_one_one)

        # self.output_msg = QtWidgets.QLabel('Select the output path for the surface')
        # self.surf_layout.addWidget(self.output_msg)

        # self.hlayout_one_two = QtWidgets.QHBoxLayout()
        # self.fil_text = QtWidgets.QLineEdit('', self)
        # self.fil_text.setMinimumWidth(400)
        # self.fil_text.setReadOnly(True)
        # self.hlayout_one_two.addWidget(self.fil_text)
        # self.browse_button = QtWidgets.QPushButton("Browse", self)
        # self.hlayout_one_two.addWidget(self.browse_button)
        # self.surf_layout.addLayout(self.hlayout_one_two)

        self.surface_box.setLayout(self.surf_layout)
        self.hlayout_one.addWidget(self.surface_box)

        self.status_msg = QtWidgets.QLabel('')
        self.status_msg.setStyleSheet("QLabel { " +
                                      kluster_variables.error_color + "; }")

        self.hlayout_two = QtWidgets.QHBoxLayout()
        self.hlayout_two.addStretch(1)
        self.ok_button = QtWidgets.QPushButton('OK', self)
        self.hlayout_two.addWidget(self.ok_button)
        self.hlayout_two.addStretch(1)
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        self.hlayout_two.addWidget(self.cancel_button)
        self.hlayout_two.addStretch(1)

        layout.addWidget(self.input_msg)
        layout.addLayout(self.hlayout_zero)
        layout.addLayout(self.hlayout_one)
        layout.addWidget(self.status_msg)
        layout.addLayout(self.hlayout_two)
        self.setLayout(layout)

        self.fqpr_inst = []
        self.canceled = False
        self.output_pth = None

        self.input_fqpr.files_updated.connect(
            self._event_update_fqpr_instances)
        # self.browse_button.clicked.connect(self.file_browse)
        self.ok_button.clicked.connect(self.start_processing)
        self.cancel_button.clicked.connect(self.cancel_processing)

    def _event_update_fqpr_instances(self):
        self.update_fqpr_instances()

    def update_fqpr_instances(self, addtl_files=None):
        if addtl_files is not None:
            self.input_fqpr.add_new_files(addtl_files)
        self.fqpr_inst = [
            self.input_fqpr.list_widget.item(i).text()
            for i in range(self.input_fqpr.list_widget.count())
        ]
        if self.fqpr_inst:
            self.output_pth = self.fqpr_inst[0]

    def file_browse(self):
        msg, self.output_pth = RegistryHelpers.GetFilenameFromUserQT(
            self,
            RegistryKey='Kluster',
            Title='Select output surface path',
            AppName='kluster',
            bMulti=False,
            bSave=True,
            fFilter='numpy npz (*.npz)')
        if self.output_pth is not None:
            self.fil_text.setText(self.output_pth)

    def return_processing_options(self):
        if not self.canceled:
            # pull CRS from the first fqpr instance, as we've already checked to ensure they are identical
            opts = {
                'fqpr_inst': self.fqpr_inst,
                'max_grid_size': float(self.surf_resolution.currentText()),
                'min_grid_size': float(self.surf_resolution.currentText()),
                'max_points_per_quad': int(self.soundings_per_node.text()),
                'output_path': self.output_pth
            }
        else:
            opts = None
        return opts

    def start_processing(self):
        if not self.surf_resolution.currentText():
            self.status_msg.setText(
                'Error: You must complete all dialog options to proceed')
        else:
            self.canceled = False
            self.accept()

    def cancel_processing(self):
        self.canceled = True
        self.accept()
Exemplo n.º 13
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setWindowTitle('Generate New Surface')
        layout = QtWidgets.QVBoxLayout()

        self.input_msg = QtWidgets.QLabel(
            'Run surface generation on the following:')

        self.hlayout_zero = QtWidgets.QHBoxLayout()

        # fqpr = fully qualified ping record, the term for the datastore in kluster
        self.input_fqpr = BrowseListWidget(self)
        self.input_fqpr.sizeHint()
        self.input_fqpr.setup(mode='directory',
                              registry_key='kluster',
                              app_name='klusterbrowse',
                              filebrowse_title='Select input processed folder')
        self.hlayout_zero.addWidget(self.input_fqpr)

        self.hlayout_one = QtWidgets.QHBoxLayout()
        self.surface_box = QtWidgets.QGroupBox('New Surface')
        self.surf_layout = QtWidgets.QVBoxLayout()
        self.surf_msg = QtWidgets.QLabel('Select from the following options:')
        self.surf_layout.addWidget(self.surf_msg)

        self.hlayout_one_one = QtWidgets.QHBoxLayout()
        self.surf_method_lbl = QtWidgets.QLabel('Method: ')
        self.hlayout_one_one.addWidget(self.surf_method_lbl)
        self.surf_method = QtWidgets.QComboBox()
        self.surf_method.addItems(['Mean'])
        self.surf_method.setMaximumWidth(100)
        self.hlayout_one_one.addWidget(self.surf_method)
        self.surf_resolution_lbl = QtWidgets.QLabel('Resolution: ')
        self.hlayout_one_one.addWidget(self.surf_resolution_lbl)
        self.surf_resolution = QtWidgets.QComboBox()
        self.surf_resolution.addItems([
            '0.25', '0.50', '1.0', '2.0', '4.0', '8.0', '16.0', '32.0', '64.0',
            '128.0'
        ])
        self.surf_resolution.setMaximumWidth(60)
        self.hlayout_one_one.addWidget(self.surf_resolution)
        self.soundings_per_node_lbl = QtWidgets.QLabel(
            'Required Soundings/Node: ')
        self.hlayout_one_one.addWidget(self.soundings_per_node_lbl)
        self.soundings_per_node = QtWidgets.QLineEdit('')
        self.soundings_per_node.setInputMask('0;_')
        self.soundings_per_node.setMaximumWidth(13)
        self.soundings_per_node.setText('5')
        self.soundings_per_node.setDisabled(True)
        self.hlayout_one_one.addWidget(self.soundings_per_node)
        self.hlayout_one_one.addStretch(1)
        self.surf_layout.addLayout(self.hlayout_one_one)

        # self.output_msg = QtWidgets.QLabel('Select the output path for the surface')
        # self.surf_layout.addWidget(self.output_msg)

        # self.hlayout_one_two = QtWidgets.QHBoxLayout()
        # self.fil_text = QtWidgets.QLineEdit('', self)
        # self.fil_text.setMinimumWidth(400)
        # self.fil_text.setReadOnly(True)
        # self.hlayout_one_two.addWidget(self.fil_text)
        # self.browse_button = QtWidgets.QPushButton("Browse", self)
        # self.hlayout_one_two.addWidget(self.browse_button)
        # self.surf_layout.addLayout(self.hlayout_one_two)

        self.surface_box.setLayout(self.surf_layout)
        self.hlayout_one.addWidget(self.surface_box)

        self.status_msg = QtWidgets.QLabel('')
        self.status_msg.setStyleSheet("QLabel { " +
                                      kluster_variables.error_color + "; }")

        self.hlayout_two = QtWidgets.QHBoxLayout()
        self.hlayout_two.addStretch(1)
        self.ok_button = QtWidgets.QPushButton('OK', self)
        self.hlayout_two.addWidget(self.ok_button)
        self.hlayout_two.addStretch(1)
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        self.hlayout_two.addWidget(self.cancel_button)
        self.hlayout_two.addStretch(1)

        layout.addWidget(self.input_msg)
        layout.addLayout(self.hlayout_zero)
        layout.addLayout(self.hlayout_one)
        layout.addWidget(self.status_msg)
        layout.addLayout(self.hlayout_two)
        self.setLayout(layout)

        self.fqpr_inst = []
        self.canceled = False
        self.output_pth = None

        self.input_fqpr.files_updated.connect(
            self._event_update_fqpr_instances)
        # self.browse_button.clicked.connect(self.file_browse)
        self.ok_button.clicked.connect(self.start_processing)
        self.cancel_button.clicked.connect(self.cancel_processing)
Exemplo n.º 14
0
class AllProcessingDialog(QtWidgets.QDialog):
    """
    Dialog contains all the processing steps post-conversion.  Use return_processing_options to get the kwargs to feed
    the fqpr_convenience.process_multibeam function.

    fqpr = fully qualified ping record, the term for the datastore in kluster
    """
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setWindowTitle('All Processing')
        layout = QtWidgets.QVBoxLayout()

        self.input_msg = QtWidgets.QLabel('Run processing on the following:')

        self.hlayout_zero = QtWidgets.QHBoxLayout()
        self.input_fqpr = BrowseListWidget(self)
        self.input_fqpr.sizeHint()
        self.input_fqpr.setup(mode='directory',
                              registry_key='kluster',
                              app_name='klusterbrowse',
                              filebrowse_title='Select input processed folder')
        self.hlayout_zero.addWidget(self.input_fqpr)

        self.start_msg = QtWidgets.QLabel(
            'Check processes you want to include:')

        self.hlayout_one = QtWidgets.QHBoxLayout()
        self.ovec_check = QtWidgets.QGroupBox('Compute Orientation')
        self.ovec_check.setCheckable(True)
        self.ovec_check.setChecked(True)
        self.hlayout_one.addWidget(self.ovec_check)

        self.hlayout_two = QtWidgets.QHBoxLayout()
        self.bvec_check = QtWidgets.QGroupBox('Compute Beam Vectors')
        self.bvec_check.setCheckable(True)
        self.bvec_check.setChecked(True)
        self.hlayout_two.addWidget(self.bvec_check)

        self.hlayout_three = QtWidgets.QHBoxLayout()
        self.svcorr_check = QtWidgets.QGroupBox('Sound Velocity Correct')
        self.svcorr_check.setCheckable(True)
        self.svcorr_check.setChecked(True)
        self.svopts = QtWidgets.QVBoxLayout()
        self.sv_msg = QtWidgets.QLabel('(Optional) Additional .svp files')
        self.svopts.addWidget(self.sv_msg)

        self.hlayout_three_one = QtWidgets.QHBoxLayout()
        self.svfiles = BrowseListWidget(self)
        self.svfiles.setup(registry_key='kluster',
                           app_name='klusterbrowse',
                           supported_file_extension='.svp',
                           multiselect=True,
                           filebrowse_title='Select .svp files',
                           filebrowse_filter='Caris svp files (*.svp)')
        self.hlayout_three_one.addWidget(self.svfiles)
        self.svopts.addLayout(self.hlayout_three_one)
        self.svcorr_check.setLayout(self.svopts)
        self.hlayout_three.addWidget(self.svcorr_check)

        self.hlayout_four = QtWidgets.QHBoxLayout()
        self.georef_check = QtWidgets.QGroupBox('Georeference Soundings')
        self.georef_check.setCheckable(True)
        self.georef_check.setChecked(True)
        self.georefopts = QtWidgets.QVBoxLayout()
        self.coord_msg = QtWidgets.QLabel('Coordinate System:')
        self.georefopts.addWidget(self.coord_msg)

        self.hlayout_four_one = QtWidgets.QHBoxLayout()
        self.epsg_radio = QtWidgets.QRadioButton('From EPSG')
        self.hlayout_four_one.addWidget(self.epsg_radio)
        self.epsg_val = QtWidgets.QLineEdit('', self)
        self.epsg_val.setMaximumWidth(80)
        self.hlayout_four_one.addWidget(self.epsg_val)
        self.hlayout_four_one.addStretch(1)
        self.georefopts.addLayout(self.hlayout_four_one)

        self.hlayout_four_two = QtWidgets.QHBoxLayout()
        self.auto_utm_radio = QtWidgets.QRadioButton('Auto UTM')
        self.auto_utm_radio.setChecked(True)
        self.hlayout_four_two.addWidget(self.auto_utm_radio)
        self.auto_utm_val = QtWidgets.QComboBox()
        self.auto_utm_val.addItems(['NAD83', 'WGS84'])
        self.auto_utm_val.setMaximumWidth(100)
        self.hlayout_four_two.addWidget(self.auto_utm_val)
        self.hlayout_four_two.addStretch(1)
        self.georefopts.addLayout(self.hlayout_four_two)

        self.hlayout_four_three = QtWidgets.QHBoxLayout()
        self.vertref_msg = QtWidgets.QLabel('Vertical Reference:')
        self.hlayout_four_three.addWidget(self.vertref_msg)
        self.georef_vertref = QtWidgets.QComboBox()
        self.georef_vertref.addItems(['waterline', 'ellipse'])
        self.georef_vertref.setMaximumWidth(100)
        self.hlayout_four_three.addWidget(self.georef_vertref)
        self.hlayout_four_three.addStretch(1)
        self.georefopts.addLayout(self.hlayout_four_three)
        self.georef_check.setLayout(self.georefopts)
        self.hlayout_four.addWidget(self.georef_check)

        self.status_msg = QtWidgets.QLabel('')
        self.status_msg.setStyleSheet("QLabel { " +
                                      kluster_variables.error_color + "; }")

        self.hlayout_five = QtWidgets.QHBoxLayout()
        self.hlayout_five.addStretch(1)
        self.ok_button = QtWidgets.QPushButton('OK', self)
        self.hlayout_five.addWidget(self.ok_button)
        self.hlayout_five.addStretch(1)
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        self.hlayout_five.addWidget(self.cancel_button)
        self.hlayout_five.addStretch(1)

        layout.addWidget(self.input_msg)
        layout.addLayout(self.hlayout_zero)
        layout.addWidget(self.start_msg)
        layout.addLayout(self.hlayout_one)
        layout.addLayout(self.hlayout_two)
        layout.addLayout(self.hlayout_three)
        layout.addLayout(self.hlayout_four)
        layout.addWidget(self.status_msg)
        layout.addLayout(self.hlayout_five)
        self.setLayout(layout)

        self.addtl_cast_files = []
        self.fqpr_inst = []
        self.canceled = False

        self.input_fqpr.files_updated.connect(
            self._event_update_fqpr_instances)
        self.svfiles.files_updated.connect(self.update_cast_files)
        self.ok_button.clicked.connect(self.start_processing)
        self.cancel_button.clicked.connect(self.cancel_processing)

        self.resize(600, 500)

    def _event_update_fqpr_instances(self):
        """
        Method for connecting the input_fqpr signal with the update_fqpr_instances
        """

        self.update_fqpr_instances()

    def update_fqpr_instances(self, addtl_files=None):
        """
        Used through kluster_main to update the list_widget with new fqpr processed instances to process

        Parameters
        ----------
        addtl_files: optional, list, list of folder paths to converted data (string folder paths)

        """
        if addtl_files is not None:
            self.input_fqpr.add_new_files(addtl_files)
        self.fqpr_inst = [
            self.input_fqpr.list_widget.item(i).text()
            for i in range(self.input_fqpr.list_widget.count())
        ]

    def return_processing_options(self):
        """
        Return a dict of processing options to feed to fqpr_convenience.process_multibeam

        """
        if not self.canceled:
            opts = {
                'fqpr_inst': self.fqpr_inst,
                'run_orientation': self.ovec_check.isChecked(),
                'run_beam_vec': self.bvec_check.isChecked(),
                'run_svcorr': self.svcorr_check.isChecked(),
                'add_cast_files': self.addtl_cast_files,
                'run_georef': self.georef_check.isChecked(),
                'use_epsg': self.epsg_radio.isChecked(),
                'epsg': self.epsg_val.text(),
                'use_coord': self.auto_utm_radio.isChecked(),
                'coord_system': self.auto_utm_val.currentText(),
                'vert_ref': self.georef_vertref.currentText()
            }
        else:
            opts = None
        return opts

    def update_cast_files(self):
        """
        Populate self.addtl_cast_files with new cast files from the list widget
        """
        self.addtl_cast_files = [
            self.svfiles.list_widget.item(i).text()
            for i in range(self.svfiles.list_widget.count())
        ]

    def start_processing(self):
        """
        Dialog completes if the specified widgets are populated, use return_processing_options to get access to the
        settings the user entered into the dialog.
        """
        if not self.ovec_check.isChecked() and not self.bvec_check.isChecked(
        ) and not self.svcorr_check.isChecked(
        ) and not self.georef_check.isChecked():
            self.status_msg.setText(
                'Error: You must select at least one processing option to proceed'
            )
        else:
            self.canceled = False
            self.accept()

    def cancel_processing(self):
        """
        Dialog completes, use self.canceled to get the fact that it cancelled
        """
        self.canceled = True
        self.accept()
Exemplo n.º 15
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setWindowTitle('All Processing')
        layout = QtWidgets.QVBoxLayout()

        self.input_msg = QtWidgets.QLabel('Run processing on the following:')

        self.hlayout_zero = QtWidgets.QHBoxLayout()
        self.input_fqpr = BrowseListWidget(self)
        self.input_fqpr.sizeHint()
        self.input_fqpr.setup(mode='directory',
                              registry_key='kluster',
                              app_name='klusterbrowse',
                              filebrowse_title='Select input processed folder')
        self.hlayout_zero.addWidget(self.input_fqpr)

        self.start_msg = QtWidgets.QLabel(
            'Check processes you want to include:')

        self.hlayout_one = QtWidgets.QHBoxLayout()
        self.ovec_check = QtWidgets.QGroupBox('Compute Orientation')
        self.ovec_check.setCheckable(True)
        self.ovec_check.setChecked(True)
        self.hlayout_one.addWidget(self.ovec_check)

        self.hlayout_two = QtWidgets.QHBoxLayout()
        self.bvec_check = QtWidgets.QGroupBox('Compute Beam Vectors')
        self.bvec_check.setCheckable(True)
        self.bvec_check.setChecked(True)
        self.hlayout_two.addWidget(self.bvec_check)

        self.hlayout_three = QtWidgets.QHBoxLayout()
        self.svcorr_check = QtWidgets.QGroupBox('Sound Velocity Correct')
        self.svcorr_check.setCheckable(True)
        self.svcorr_check.setChecked(True)
        self.svopts = QtWidgets.QVBoxLayout()
        self.sv_msg = QtWidgets.QLabel('(Optional) Additional .svp files')
        self.svopts.addWidget(self.sv_msg)

        self.hlayout_three_one = QtWidgets.QHBoxLayout()
        self.svfiles = BrowseListWidget(self)
        self.svfiles.setup(registry_key='kluster',
                           app_name='klusterbrowse',
                           supported_file_extension='.svp',
                           multiselect=True,
                           filebrowse_title='Select .svp files',
                           filebrowse_filter='Caris svp files (*.svp)')
        self.hlayout_three_one.addWidget(self.svfiles)
        self.svopts.addLayout(self.hlayout_three_one)
        self.svcorr_check.setLayout(self.svopts)
        self.hlayout_three.addWidget(self.svcorr_check)

        self.hlayout_four = QtWidgets.QHBoxLayout()
        self.georef_check = QtWidgets.QGroupBox('Georeference Soundings')
        self.georef_check.setCheckable(True)
        self.georef_check.setChecked(True)
        self.georefopts = QtWidgets.QVBoxLayout()
        self.coord_msg = QtWidgets.QLabel('Coordinate System:')
        self.georefopts.addWidget(self.coord_msg)

        self.hlayout_four_one = QtWidgets.QHBoxLayout()
        self.epsg_radio = QtWidgets.QRadioButton('From EPSG')
        self.hlayout_four_one.addWidget(self.epsg_radio)
        self.epsg_val = QtWidgets.QLineEdit('', self)
        self.epsg_val.setMaximumWidth(80)
        self.hlayout_four_one.addWidget(self.epsg_val)
        self.hlayout_four_one.addStretch(1)
        self.georefopts.addLayout(self.hlayout_four_one)

        self.hlayout_four_two = QtWidgets.QHBoxLayout()
        self.auto_utm_radio = QtWidgets.QRadioButton('Auto UTM')
        self.auto_utm_radio.setChecked(True)
        self.hlayout_four_two.addWidget(self.auto_utm_radio)
        self.auto_utm_val = QtWidgets.QComboBox()
        self.auto_utm_val.addItems(['NAD83', 'WGS84'])
        self.auto_utm_val.setMaximumWidth(100)
        self.hlayout_four_two.addWidget(self.auto_utm_val)
        self.hlayout_four_two.addStretch(1)
        self.georefopts.addLayout(self.hlayout_four_two)

        self.hlayout_four_three = QtWidgets.QHBoxLayout()
        self.vertref_msg = QtWidgets.QLabel('Vertical Reference:')
        self.hlayout_four_three.addWidget(self.vertref_msg)
        self.georef_vertref = QtWidgets.QComboBox()
        self.georef_vertref.addItems(['waterline', 'ellipse'])
        self.georef_vertref.setMaximumWidth(100)
        self.hlayout_four_three.addWidget(self.georef_vertref)
        self.hlayout_four_three.addStretch(1)
        self.georefopts.addLayout(self.hlayout_four_three)
        self.georef_check.setLayout(self.georefopts)
        self.hlayout_four.addWidget(self.georef_check)

        self.status_msg = QtWidgets.QLabel('')
        self.status_msg.setStyleSheet("QLabel { " +
                                      kluster_variables.error_color + "; }")

        self.hlayout_five = QtWidgets.QHBoxLayout()
        self.hlayout_five.addStretch(1)
        self.ok_button = QtWidgets.QPushButton('OK', self)
        self.hlayout_five.addWidget(self.ok_button)
        self.hlayout_five.addStretch(1)
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        self.hlayout_five.addWidget(self.cancel_button)
        self.hlayout_five.addStretch(1)

        layout.addWidget(self.input_msg)
        layout.addLayout(self.hlayout_zero)
        layout.addWidget(self.start_msg)
        layout.addLayout(self.hlayout_one)
        layout.addLayout(self.hlayout_two)
        layout.addLayout(self.hlayout_three)
        layout.addLayout(self.hlayout_four)
        layout.addWidget(self.status_msg)
        layout.addLayout(self.hlayout_five)
        self.setLayout(layout)

        self.addtl_cast_files = []
        self.fqpr_inst = []
        self.canceled = False

        self.input_fqpr.files_updated.connect(
            self._event_update_fqpr_instances)
        self.svfiles.files_updated.connect(self.update_cast_files)
        self.ok_button.clicked.connect(self.start_processing)
        self.cancel_button.clicked.connect(self.cancel_processing)

        self.resize(600, 500)