Example #1
0
    def _add_new_fqpr_from_proj(self, parent: QtGui.QStandardItem, line_data):
        """
        Read from the kluster_main FqprProject (provided here is the line_data from that project) and add the lines
        that are not currently in project tree.  self.tree_data contains the record of the data in the tree.

        Parameters
        ----------
        parent: PySide2.QtGui.QStandardItem, the item that represents the 'Converted' entry in the tree.  All fqpr
                projects go underneath.
        line_data: dict, a dictionary of project paths: multibeam lines.
                   ex: {'C:\\collab\\dasktest\\data_dir\\hassler_acceptance\\refsurf\\converted':
                                {'0015_20200304_070725_S250.all': [1583305645.423, 1583305889.905]}

        """
        current_fq_proj = self.tree_data['Converted'][1:]
        for fq_proj in line_data:
            if fq_proj not in current_fq_proj:
                proj_child = QtGui.QStandardItem(fq_proj)
                parent.appendRow(proj_child)
                for fq_line in line_data[fq_proj]:
                    line_child = QtGui.QStandardItem(fq_line)
                    proj_child.appendRow([line_child])
                self.tree_data['Converted'].append(fq_proj)
            else:  # see if there are new lines to display
                idx = self.tree_data['Converted'][1:].index(fq_proj)
                proj_child = parent.child(idx)
                tst = proj_child.rowCount()
                tsttwo = len(line_data[fq_proj])
                if proj_child.rowCount() != len(line_data[fq_proj]):  # new lines
                    tree_lines = [proj_child.child(rw).text() for rw in range(proj_child.rowCount())]
                    for fq_line in line_data[fq_proj]:
                        if fq_line not in tree_lines:
                            line_child = QtGui.QStandardItem(fq_line)
                            proj_child.appendRow([line_child])
        parent.sortChildren(0, order=QtCore.Qt.AscendingOrder)
    def _update_unmatched(self, parent: QtGui.QStandardItem, unmatched: dict):
        """
        Take the provided actions and populate the 'Queued Files' Tree item with the input_files attribute from each action

        Parameters
        ----------
        parent
            The parent item we are adding to
        unmatched
            dict of 'filename: reason not matched' for each unmatched file
        """

        parent.removeRows(0, parent.rowCount())
        self.tree_data['Unmatched Files'] = [self.tree_data['Unmatched Files'][0]]
        if unmatched:
            for unmatched_file, reason in unmatched.items():
                proj_child = QtGui.QStandardItem(unmatched_file)
                proj_child.setToolTip(reason)
                parent.appendRow(proj_child)
                self.tree_data['Unmatched Files'].append(unmatched_file)
    def _update_all_actions(self, parent: QtGui.QStandardItem, actions: list):
        """
        Take the provided actions and populate the 'All Actions' Tree item with the text attribute from each action

        Parameters
        ----------
        parent
            The parent item we are adding to
        actions
            list of FqprActions sorted by priority, we are only interested in the text attribute of each
        """

        parent.removeRows(0, parent.rowCount())
        self.tree_data['All Actions'] = [self.tree_data['All Actions'][0]]
        if actions:
            for act in actions:
                proj_child = QtGui.QStandardItem(act.text)
                ttip = self._build_action_tooltip(act)
                proj_child.setToolTip(ttip)
                parent.appendRow(proj_child)
                self.tree_data['All Actions'].append(act.text)
    def _update_next_action(self, parent: QtGui.QStandardItem, actions: list):
        """
        Take the provided actions and populate the 'Next Action' Tree item

        Parameters
        ----------
        parent
            The parent item we are adding to
        actions
            list of FqprActions sorted by priority, we are only interested in the first (the next one)
        """

        parent.removeRows(1, parent.rowCount() - 1)
        if actions:
            next_action = actions[0]
            action_text = next_action.text
            if next_action.input_files:
                input_files = ['Input Files:'] + ['- ' + f for f in next_action.input_files]
            else:
                input_files = ['Input Files: None']
            data = [action_text] + input_files

            for d in data:
                proj_child = QtGui.QStandardItem(d)
                ttip = self._build_action_tooltip(next_action)
                proj_child.setToolTip(ttip)
                parent.appendRow(proj_child)
                self.tree_data['Next Action'].append(d)
            self.start_button.setDisabled(False)
            self.expand(parent.index())
    def _update_queued_files(self, parent: QtGui.QStandardItem, actions: list):
        """
        Take the provided actions and populate the 'Queued Files' Tree item with the input_files attribute from each action

        Parameters
        ----------
        parent
            The parent item we are adding to
        actions
            list of FqprActions sorted by priority, we are only interested in the input_files attribute of each
        """

        parent.removeRows(0, parent.rowCount())
        self.tree_data['Queued Files'] = [self.tree_data['Queued Files'][0]]
        fils = []
        if actions:
            for act in actions:
                fils += act.input_files
            for f in fils:
                proj_child = QtGui.QStandardItem(f)
                parent.appendRow(proj_child)
                self.tree_data['Queued Files'].append(f)
Example #6
0
    def _update_all_actions(self, parent: QtGui.QStandardItem, actions: list):
        """
        Take the provided actions and populate the 'All Actions' Tree item with the text attribute from each action

        Parameters
        ----------
        parent
            The parent item we are adding to
        actions
            list of FqprActions sorted by priority, we are only interested in the text attribute of each
        """

        parent.removeRows(0, parent.rowCount())
        self.tree_data['All Actions'] = [self.tree_data['All Actions'][0]]
        if actions:
            for act in actions:
                proj_child = QtGui.QStandardItem(act.text)
                if act.input_files:
                    ttip = '{}\n\nPriority:{}\nInput Files:\n-{}'.format(
                        act.text, act.priority, '\n-'.join(act.input_files))
                elif act.priority == 5:  # process multibeam action
                    ttip = '{}\n\nPriority:{}\nRun Orientation:{}\nRun Correct Beam Vectors:{}\n'.format(
                        act.text, act.priority, act.kwargs['run_orientation'],
                        act.kwargs['run_beam_vec'])
                    ttip += 'Run Sound Velocity:{}\nRun Georeference/TPU:{}'.format(
                        act.kwargs['run_svcorr'], act.kwargs['run_georef'])
                    if act.kwargs['run_georef']:
                        if act.kwargs['use_epsg']:
                            ttip += '\nEPSG: {}\nVertical Reference: {}'.format(
                                act.kwargs['epsg'], act.kwargs['vert_ref'])
                        else:
                            ttip += '\nCoordinate System: {}\nVertical Reference: {}'.format(
                                act.kwargs['coord_system'],
                                act.kwargs['vert_ref'])
                else:
                    ttip = '{}\n\nPriority:{}'.format(act.text, act.priority)
                proj_child.setToolTip(ttip)
                parent.appendRow(proj_child)
                self.tree_data['All Actions'].append(act.text)
Example #7
0
    def _add_new_surf_from_proj(self, parent: QtGui.QStandardItem, surf_data):
        """
        Read from the kluster_main FqprProject (provided here is the line_data from that project) and add the surfaces
        that are not currently in project tree.  self.tree_data contains the record of the data in the tree.

        Parameters
        ----------
        parent: PySide2.QtGui.QStandardItem, the item that represents the 'Surfaces' entry in the tree.  All fqpr
                projects go underneath.
        surf_data: dict, a dictionary of surface paths: surface objects.
                   ex: {'C:/collab/dasktest/data_dir/hassler_acceptance/refsurf/refsurf.npz':
                            <HSTB.kluster.fqpr_surface.BaseSurface object at 0x0000019CFFF1A520>}

        """
        current_surfs = self.tree_data['Surfaces'][1:]
        for surf in surf_data:
            if surf not in current_surfs:
                surf_child = QtGui.QStandardItem(surf)
                parent.appendRow(surf_child)
                for lyr in surf_data[surf].return_layer_names():
                    lyr_child = QtGui.QStandardItem(lyr)
                    lyr_child.setCheckable(True)
                    surf_child.appendRow([lyr_child])
                    if lyr == 'depth':  # add optional hillshade layer
                        lyr_child = QtGui.QStandardItem('hillshade')
                        lyr_child.setCheckable(True)
                        surf_child.appendRow([lyr_child])
                try:  # add the ability to draw the grid outline, new in bathygrid 1.1.2
                    surf_data[surf].get_tile_boundaries
                    lyr_child = QtGui.QStandardItem('tiles')
                    lyr_child.setCheckable(True)
                    surf_child.appendRow([lyr_child])
                except AttributeError:  # bathygrid does not support this method
                    pass
                self.tree_data['Surfaces'].append(surf)
        parent.sortChildren(0, order=QtCore.Qt.AscendingOrder)