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 configure(self): """ Clears all data currently in the tree and repopulates with loaded actions """ self.model.clear() self.model.setHorizontalHeaderLabels(['Actions']) for cnt, c in enumerate(self.categories): parent = QtGui.QStandardItem(c) self.tree_data[c] = [parent] self.model.appendRow(parent) self.setFirstColumnSpanned(cnt, self.rootIndex(), True) if c == 'Next Action': proj_child = QtGui.QStandardItem( '') # empty entry to overwrite with setIndexWidget parent.appendRow(proj_child) qindex_button = parent.child(0, 0).index() self.setIndexWidget(qindex_button, self.start_button) proj_child = QtGui.QStandardItem( '') # empty entry to overwrite with setIndexWidget parent.appendRow(proj_child) qindex_progress = parent.child(1, 0).index() self.setIndexWidget(qindex_progress, self.progress) self.expand(parent.index())
def _setup_project(self, parent, proj_directory): if len(self.tree_data['Project']) == 1: proj_child = QtGui.QStandardItem(proj_directory) parent.appendRow(proj_child) self.tree_data['Project'].append(proj_directory) else: parent.removeRow(0) proj_child = QtGui.QStandardItem(proj_directory) parent.appendRow(proj_child) self.tree_data['Project'][1] = proj_directory
def paintEvent(self, event: QtGui.QPaintEvent): painter = QtGui.QPainter(self) # Draw rule self.opt.initFrom(self) self.opt.rect = self.rect() self.opt.sliderPosition = 0 self.opt.subControls = QtWidgets.QStyle.SC_SliderGroove | QtWidgets.QStyle.SC_SliderTickmarks # Draw GROOVE self.style().drawComplexControl(QtWidgets.QStyle.CC_Slider, self.opt, painter) # Draw INTERVAL color = self.palette().color(QtGui.QPalette.Highlight) color.setAlpha(160) painter.setBrush(QtGui.QBrush(color)) painter.setPen(QtCore.Qt.NoPen) self.opt.sliderPosition = self.first_position x_left_handle = (self.style().subControlRect( QtWidgets.QStyle.CC_Slider, self.opt, QtWidgets.QStyle.SC_SliderHandle).right()) self.opt.sliderPosition = self.second_position x_right_handle = (self.style().subControlRect( QtWidgets.QStyle.CC_Slider, self.opt, QtWidgets.QStyle.SC_SliderHandle).left()) groove_rect = self.style().subControlRect( QtWidgets.QStyle.CC_Slider, self.opt, QtWidgets.QStyle.SC_SliderGroove) selection = QtCore.QRect( x_left_handle, groove_rect.y(), x_right_handle - x_left_handle, groove_rect.height(), ).adjusted(-1, 1, 1, -1) painter.drawRect(selection) # Draw first handle self.opt.subControls = QtWidgets.QStyle.SC_SliderHandle self.opt.sliderPosition = self.first_position self.style().drawComplexControl(QtWidgets.QStyle.CC_Slider, self.opt, painter) # Draw second handle self.opt.sliderPosition = self.second_position self.style().drawComplexControl(QtWidgets.QStyle.CC_Slider, self.opt, painter)
def _setup_vessel_file(self, parent, vessel_path): if len(self.tree_data['Vessel File']) == 1: if vessel_path: proj_child = QtGui.QStandardItem(vessel_path) parent.appendRow(proj_child) self.tree_data['Vessel File'].append(vessel_path) else: parent.removeRow(0) if vessel_path: proj_child = QtGui.QStandardItem(vessel_path) parent.appendRow(proj_child) self.tree_data['Vessel File'][1] = vessel_path
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 __init__(self, param=None): """Main Window for holding the Vispy Canvas and the parameter control menu. """ QtWidgets.QMainWindow.__init__(self) self.resize(1067, 800) icon = load_data_file('wiggly_bar/spring.ico') self.setWindowIcon(QtGui.QIcon(icon)) self.setWindowTitle('Nonlinear Physical Model Simulation') self.parameter_object = SetupWidget(self) self.parameter_object.param = (param if param is not None else self.parameter_object.param) self.parameter_object.changed_parameter_sig.connect(self.update_view) self.view_box = WigglyBar(**self.parameter_object.param.props) self.view_box.create_native() self.view_box.native.setParent(self) splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal) splitter.addWidget(self.parameter_object) splitter.addWidget(self.view_box.native) self.setCentralWidget(splitter)
def __init__(self, parent=None): super().__init__(parent) self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) self.model = QtGui.QStandardItemModel() self.setModel(self.model) self.setUniformRowHeights(True) # ExtendedSelection - allows multiselection with shift/ctrl self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) self.setDragDropMode(QtWidgets.QAbstractItemView.NoDragDrop) # makes it so no editing is possible with the table self.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) # set up the context menu per item self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.right_click_menu_converted = None self.right_click_menu_surfaces = None self.setup_menu() self.categories = ['Project', 'Vessel File', 'Converted', 'Surfaces'] self.tree_data = {} self.shown_layers = [] self.clicked.connect(self.item_selected) self.customContextMenuRequested.connect(self.show_context_menu) self.configure()
def __init__(self, parent=None, settings=None): super().__init__(parent) self.external_settings = settings self.parent = parent self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) self.model = QtGui.QStandardItemModel() # row can be 0 even when there are more than 0 rows self.setModel(self.model) self.setUniformRowHeights(False) self.setAcceptDrops(False) self.viewport().setAcceptDrops(False) # viewport is the total rendered area, this is recommended from my reading # ExtendedSelection - allows multiselection with shift/ctrl self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) # set up the context menu per item self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.right_click_menu_files = None self.setup_menu() # makes it so no editing is possible with the table self.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.categories = ['Next Action', 'All Actions', 'Queued Files', 'Unmatched Files'] self.tree_data = {} self.actions = None self.unmatched = None self.exclude_buffer = [] self.start_button = QtWidgets.QPushButton('Start Process') self.start_button.clicked.connect(self.start_process) self.start_button.setDisabled(True) self.auto_checkbox = QtWidgets.QCheckBox('Auto') self.auto_checkbox.setCheckable(True) self.auto_checkbox.clicked.connect(self.auto_process) self.button_widget = QtWidgets.QWidget() self.button_sizer = QtWidgets.QHBoxLayout() self.button_sizer.addWidget(self.start_button) self.button_sizer.addWidget(self.auto_checkbox) self.button_sizer.setAlignment(QtCore.Qt.AlignLeft) self.button_widget.setLayout(self.button_sizer) self.button_widget.setToolTip('Start the action below by clicking "Start Process".\n' + 'If the "Start Process" button is greyed out, there is no viable action to run.\n\n' + 'If the "Auto" check box is checked, Kluster will automatically run all actions as they appear.\n' + 'You will not need to use the "Start Process" button with "Auto" enabled.') self.stop_auto = Event() self.stop_auto.set() self.auto_thread = AutoThread(self.stop_auto, self.emit_auto_signal) self.customContextMenuRequested.connect(self.show_context_menu) self.configure() self.read_settings()
def configure(self): """ Clears all data currently in the tree and repopulates with loaded datasets and surfaces. """ self.model.clear() self.model.setHorizontalHeaderLabels(['Project Tree']) for cnt, c in enumerate(self.categories): parent = QtGui.QStandardItem(c) self.tree_data[c] = [parent] self.model.appendRow(parent) self.setFirstColumnSpanned(cnt, self.rootIndex(), True)
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)
def _add_new_surf_from_proj(self, parent, 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]) self.tree_data['Surfaces'].append(surf)
def __init__(self, parent=None): super().__init__(parent) self.parent = parent self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) self.model = QtGui.QStandardItemModel( ) # row can be 0 even when there are more than 0 rows self.setModel(self.model) self.setUniformRowHeights(False) self.setAcceptDrops(False) self.viewport().setAcceptDrops( False ) # viewport is the total rendered area, this is recommended from my reading # ExtendedSelection - allows multiselection with shift/ctrl self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) # set up the context menu per item self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.right_click_menu_files = None self.setup_menu() # makes it so no editing is possible with the table self.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.categories = [ 'Next Action', 'All Actions', 'Queued Files', 'Unmatched Files' ] self.tree_data = {} self.actions = None self.unmatched = None self.exclude_buffer = [] self.start_button = QtWidgets.QPushButton('Start Process') self.start_button.setMinimumWidth(120) self.start_button.setMaximumWidth(150) self.start_button.setMinimumHeight(30) self.start_button.clicked.connect(self.start_process) self.start_button.setDisabled(True) self.progress = QtWidgets.QProgressBar(self) self.progress.setMaximum(1) self.progress.setMinimum(0) self.customContextMenuRequested.connect(self.show_context_menu) self.configure()
def __init__(self): """ Build out the dock widgets with the kluster widgets inside. Will use QSettings object to retain size and position. """ super().__init__() self.setWindowTitle('Kluster Intelligence') self.setDockNestingEnabled(True) self.iconpath = os.path.join( os.path.dirname(os.path.dirname(__file__)), 'images', 'kluster_img.ico') self.setWindowIcon(QtGui.QIcon(self.iconpath)) self.widget_obj_names = [] self.project = fqpr_project.FqprProject( is_gui=False ) # is_gui controls the progress bar text, used to disable it for gui, no longer # fqpr = fully qualified ping record, the term for the datastore in kluster self.intelligence = fqpr_intelligence.FqprIntel(project=self.project) self.action_tab = ActionTab(self) self.monitor_dashboard = MonitorDashboard(self) self.project_view = kluster_projectview.KlusterProjectView(self) self.multibeam_intel = MultibeamIntel() self.nav_intel = NavIntel() self.naverror_intel = NavErrorIntel() self.navlog_intel = NavLogIntel() self.svp_intel = SvpIntel() self.lyout = QtWidgets.QGridLayout() self.top_widget = QtWidgets.QWidget() self.intel_tab = IntelTab() self.output_window = IntelOutput() self.setup_widgets() self.setup_signals() self.seen_files = [] self.intelligence.bind_to_action_update(self.action_tab.update_actions)
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_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)
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)
def __init__(self, parent=None, title='', settings=None): super().__init__(parent, settings, widgetname='settings') self.setWindowTitle('Settings') layout = QtWidgets.QVBoxLayout() self.tabwidget = QtWidgets.QTabWidget() self.general_tab = QtWidgets.QWidget() self.general_layout = QtWidgets.QVBoxLayout() self.parallel_write = QtWidgets.QCheckBox('Enable Parallel Writes') self.parallel_write.setChecked(True) self.parallel_write.setToolTip('If checked, Kluster will write to the hard drive in parallel, disabling this ' + 'is a useful step in troubleshooting PermissionErrors.') self.keep_waterline_changes = QtWidgets.QCheckBox('Retain Waterline Changes') self.keep_waterline_changes.setChecked(True) self.keep_waterline_changes.setToolTip('If checked (only applicable if you are using a Vessel File), Kluster will save all ' + 'waterline changes in later multibeam files to the vessel file. \nUncheck this if you ' + 'do not want changes in waterline to be new entries in the vessel file.') self.force_coordinate_match = QtWidgets.QCheckBox('Force all days to have the same Coordinate System') self.force_coordinate_match.setChecked(True) self.force_coordinate_match.setToolTip('By default, Kluster will assign an automatic UTM zone number to each day of data. If you ' + 'have data that crosses UTM zones, you might find that a project \ncontains data with ' + 'different coordinate systems. Check this box if you want to force all days in a project ' + '\nto have the same coordinate system by using the most prevalent coordinate system in the Project Tree list. use_epsg in project ' + 'settings will ignore this.') self.gen_hlayout_one_one = QtWidgets.QHBoxLayout() self.auto_processing_mode_label = QtWidgets.QLabel('Process Mode: ') self.gen_hlayout_one_one.addWidget(self.auto_processing_mode_label) self.auto_processing_mode = QtWidgets.QComboBox() autooptions = ['normal', 'convert_only', 'concatenate'] self.auto_processing_mode.addItems(autooptions) self.auto_processing_mode.setToolTip('Controls the processing actions that appear when new data is added or settings are changed.\n' + 'See the following mode explanations for the currently available options\n\n' + 'normal = data is converted and processed as it comes in, where each line added would reprocess the whole day\n' + 'convert only = data is only converted, data is never automatically processed\n' + 'concatenate = data is converted as lines are added and each line is processed individually. Similar to normal\n' + ' mode but more efficient if you are adding lines as they are acquired, normal mode would do a full reprocess of\n' + ' the day after each new line is added') self.gen_hlayout_one_one.addWidget(self.auto_processing_mode) self.gen_hlayout_one_one.addStretch() self.gen_hlayout_one = QtWidgets.QHBoxLayout() self.vdatum_label = QtWidgets.QLabel('VDatum Directory') self.gen_hlayout_one.addWidget(self.vdatum_label) self.vdatum_text = QtWidgets.QLineEdit('', self) self.vdatum_text.setToolTip('Optional, this is required if you are using the "NOAA MLLW" or "NOAA MHW" vertical reference options.') self.gen_hlayout_one.addWidget(self.vdatum_text) self.browse_button = QtWidgets.QPushButton("Browse", self) self.gen_hlayout_one.addWidget(self.browse_button) self.gen_hlayout_two = QtWidgets.QHBoxLayout() self.filter_label = QtWidgets.QLabel('External Filter Directory') self.gen_hlayout_two.addWidget(self.filter_label) self.filter_text = QtWidgets.QLineEdit('', self) self.filter_text.setToolTip('Optional, set if you have a directory of custom Kluster filter .py files that you would like to include.') self.gen_hlayout_two.addWidget(self.filter_text) self.browse_filter_button = QtWidgets.QPushButton("Browse", self) self.gen_hlayout_two.addWidget(self.browse_filter_button) self.status_msg = QtWidgets.QLabel('') self.status_msg.setStyleSheet("QLabel { color : " + 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) self.default_button = QtWidgets.QPushButton('Reset Tab', self) self.hlayout_five.addWidget(self.default_button) self.hlayout_five.addStretch(1) self.general_layout.addWidget(self.parallel_write) self.general_layout.addWidget(self.keep_waterline_changes) self.general_layout.addWidget(self.force_coordinate_match) self.general_layout.addLayout(self.gen_hlayout_one_one) self.general_layout.addLayout(self.gen_hlayout_one) self.general_layout.addLayout(self.gen_hlayout_two) self.general_layout.addWidget(self.status_msg) self.general_layout.addStretch() self.general_tab.setLayout(self.general_layout) self.tabwidget.addTab(self.general_tab, 'General') self.display_tab = QtWidgets.QWidget() self.display_layout = QtWidgets.QVBoxLayout() # yes I know about color pickers, yes I know this is a dumb way to do this, get off my back already possible_colors = ['black', 'white', 'red', 'magenta', 'purple', 'blue', 'cyan', 'pink', 'salmon', 'peru', 'orange', 'yellow', 'light green', 'green', 'teal'] colorone = QtWidgets.QHBoxLayout() self.kvar_pass_color_lbl = QtWidgets.QLabel('Pass Color') self.kvar_pass_color = QtWidgets.QComboBox() self.kvar_pass_color.addItems(possible_colors) self.kvar_pass_color.setCurrentText(kluster_variables.pass_color) self.kvar_pass_color.setToolTip('Color of the graphical labels and text where a test passes') self.kvar_error_color_lbl = QtWidgets.QLabel('Error Color') self.kvar_error_color = QtWidgets.QComboBox() self.kvar_error_color.addItems(possible_colors) self.kvar_error_color.setCurrentText(kluster_variables.error_color) self.kvar_error_color.setToolTip('Color of the graphical labels and text where a test fails') self.kvar_warning_color_lbl = QtWidgets.QLabel('Warning Color') self.kvar_warning_color = QtWidgets.QComboBox() self.kvar_warning_color.addItems(possible_colors) self.kvar_warning_color.setCurrentText(kluster_variables.warning_color) self.kvar_warning_color.setToolTip('Color of the graphical labels and text where a warning is raised') colorone.addWidget(self.kvar_pass_color_lbl) colorone.addWidget(self.kvar_pass_color) colorone.addWidget(self.kvar_error_color_lbl) colorone.addWidget(self.kvar_error_color) colorone.addWidget(self.kvar_warning_color_lbl) colorone.addWidget(self.kvar_warning_color) colortwo = QtWidgets.QHBoxLayout() self.kvar_amplitude_color_lbl = QtWidgets.QLabel('Amplitude Color') self.kvar_amplitude_color = QtWidgets.QComboBox() self.kvar_amplitude_color.addItems(possible_colors) self.kvar_amplitude_color.setCurrentText(kluster_variables.amplitude_color) self.kvar_amplitude_color.setToolTip('Color of the Amplitude status points in Points View') self.kvar_phase_color_lbl = QtWidgets.QLabel('Phase Color') self.kvar_phase_color = QtWidgets.QComboBox() self.kvar_phase_color.addItems(possible_colors) self.kvar_phase_color.setCurrentText(kluster_variables.phase_color) self.kvar_phase_color.setToolTip('Color of the Phase status points in Points View') self.kvar_reject_color_lbl = QtWidgets.QLabel('Reject Color') self.kvar_reject_color = QtWidgets.QComboBox() self.kvar_reject_color.addItems(possible_colors) self.kvar_reject_color.setCurrentText(kluster_variables.reject_color) self.kvar_reject_color.setToolTip('Color of the Reject status points in Points View') self.kvar_reaccept_color_lbl = QtWidgets.QLabel('Reaccept Color') self.kvar_reaccept_color = QtWidgets.QComboBox() self.kvar_reaccept_color.addItems(possible_colors) self.kvar_reaccept_color.setCurrentText(kluster_variables.reaccept_color) self.kvar_reaccept_color.setToolTip('Color of the Reaccept status points in Points View') colortwo.addWidget(self.kvar_amplitude_color_lbl) colortwo.addWidget(self.kvar_amplitude_color) colortwo.addWidget(self.kvar_phase_color_lbl) colortwo.addWidget(self.kvar_phase_color) colortwo.addWidget(self.kvar_reject_color_lbl) colortwo.addWidget(self.kvar_reject_color) colortwo.addWidget(self.kvar_reaccept_color_lbl) colortwo.addWidget(self.kvar_reaccept_color) self.display_layout.addLayout(colorone) self.display_layout.addLayout(colortwo) self.display_layout.addStretch() self.display_tab.setLayout(self.display_layout) self.tabwidget.addTab(self.display_tab, 'Display') self.processing_tab = QtWidgets.QWidget() self.processing_layout = QtWidgets.QVBoxLayout() processingone = QtWidgets.QHBoxLayout() self.kvar_convfiles_label = QtWidgets.QLabel('Files converted at once') self.kvar_convfiles = QtWidgets.QSpinBox() self.kvar_convfiles.setRange(1, 999) self.kvar_convfiles.setValue(kluster_variables.converted_files_at_once) self.kvar_convfiles.setToolTip('Conversion will convert this many files at once, raising this value can create memory issues in Kluster') processingone.addWidget(self.kvar_convfiles_label) processingone.addWidget(self.kvar_convfiles) processingtwo = QtWidgets.QHBoxLayout() self.kvar_pingslas_label = QtWidgets.QLabel('Pings per LAS File') self.kvar_pingslas = QtWidgets.QSpinBox() self.kvar_pingslas.setRange(1, 500000) self.kvar_pingslas.setValue(kluster_variables.pings_per_las) self.kvar_pingslas.setToolTip('LAS export will put this many pings in one file before starting a new file, raising this value can create overly large files') processingtwo.addWidget(self.kvar_pingslas_label) processingtwo.addWidget(self.kvar_pingslas) processingthree = QtWidgets.QHBoxLayout() self.kvar_pingscsv_label = QtWidgets.QLabel('Pings per CSV File') self.kvar_pingscsv = QtWidgets.QSpinBox() self.kvar_pingscsv.setRange(1, 500000) self.kvar_pingscsv.setValue(kluster_variables.pings_per_csv) self.kvar_pingscsv.setToolTip('CSV export will put this many pings in one file before starting a new file, raising this value can create overly large files') processingthree.addWidget(self.kvar_pingscsv_label) processingthree.addWidget(self.kvar_pingscsv) self.processing_layout.addLayout(processingone) self.processing_layout.addLayout(processingtwo) self.processing_layout.addLayout(processingthree) self.processing_layout.addStretch() self.processing_tab.setLayout(self.processing_layout) self.tabwidget.addTab(self.processing_tab, 'Processing') self.uncertainty_tab = QtWidgets.QWidget() self.uncertainty_layout = QtWidgets.QVBoxLayout() validator = QtGui.QDoubleValidator(-999, 999, 3) uncertaintyone = QtWidgets.QHBoxLayout() self.kvar_heaveerror_label = QtWidgets.QLabel('Default Heave Error (meters)') self.kvar_heaveerror = QtWidgets.QLineEdit('') self.kvar_heaveerror.setValidator(validator) self.kvar_heaveerror.setText(str(kluster_variables.default_heave_error)) self.kvar_heaveerror.editingFinished.connect(self.validate_numctrl) self.kvar_heaveerror.setToolTip('Default 1 sigma standard deviation in the heave sensor, generally found in manufacturer specifications.') self.kvar_rollerror_label = QtWidgets.QLabel('Default Roll Sensor Error (meters)') self.kvar_rollerror = QtWidgets.QLineEdit('') self.kvar_rollerror.setValidator(validator) self.kvar_rollerror.setText(str(kluster_variables.default_roll_sensor_error)) self.kvar_rollerror.editingFinished.connect(self.validate_numctrl) self.kvar_rollerror.setToolTip('Default 1 sigma standard deviation in the roll sensor, generally found in manufacturer specifications.') uncertaintyone.addWidget(self.kvar_heaveerror_label) uncertaintyone.addWidget(self.kvar_heaveerror) uncertaintyone.addWidget(self.kvar_rollerror_label) uncertaintyone.addWidget(self.kvar_rollerror) uncertaintytwo = QtWidgets.QHBoxLayout() self.kvar_pitcherror_label = QtWidgets.QLabel('Default Pitch Sensor Error (meters)') self.kvar_pitcherror = QtWidgets.QLineEdit('') self.kvar_pitcherror.setValidator(validator) self.kvar_pitcherror.setText(str(kluster_variables.default_pitch_sensor_error)) self.kvar_pitcherror.editingFinished.connect(self.validate_numctrl) self.kvar_pitcherror.setToolTip('Default 1 sigma standard deviation in the pitch sensor, generally found in manufacturer specifications') self.kvar_yawerror_label = QtWidgets.QLabel('Default Yaw Sensor Error (meters)') self.kvar_yawerror = QtWidgets.QLineEdit('') self.kvar_yawerror.setValidator(validator) self.kvar_yawerror.setText(str(kluster_variables.default_heading_sensor_error)) self.kvar_yawerror.editingFinished.connect(self.validate_numctrl) self.kvar_yawerror.setToolTip('Default 1 sigma standard deviation in the heading sensor, generally found in manufacturer specifications') uncertaintytwo.addWidget(self.kvar_pitcherror_label) uncertaintytwo.addWidget(self.kvar_pitcherror) uncertaintytwo.addWidget(self.kvar_yawerror_label) uncertaintytwo.addWidget(self.kvar_yawerror) uncertaintythree = QtWidgets.QHBoxLayout() self.kvar_beamangle_label = QtWidgets.QLabel('Default Beam Opening Angle (degrees)') self.kvar_beamangle = QtWidgets.QLineEdit('') self.kvar_beamangle.setValidator(validator) self.kvar_beamangle.setText(str(kluster_variables.default_beam_opening_angle)) self.kvar_beamangle.editingFinished.connect(self.validate_numctrl) self.kvar_beamangle.setToolTip('Default Receiver beam opening angle, should auto populate from the multibeam data, this value is used otherwise') self.kvar_sverror_label = QtWidgets.QLabel('Default Surface SV Error (meters/second)') self.kvar_sverror = QtWidgets.QLineEdit('') self.kvar_sverror.setValidator(validator) self.kvar_sverror.setText(str(kluster_variables.default_surface_sv_error)) self.kvar_sverror.editingFinished.connect(self.validate_numctrl) self.kvar_sverror.setToolTip('Default 1 sigma standard deviation in surface sv sensor, generally found in manufacturer specifications') uncertaintythree.addWidget(self.kvar_beamangle_label) uncertaintythree.addWidget(self.kvar_beamangle) uncertaintythree.addWidget(self.kvar_sverror_label) uncertaintythree.addWidget(self.kvar_sverror) uncertaintyfour = QtWidgets.QHBoxLayout() self.kvar_rollpatch_label = QtWidgets.QLabel('Default Roll Patch Error (degrees)') self.kvar_rollpatch = QtWidgets.QLineEdit('') self.kvar_rollpatch.setValidator(validator) self.kvar_rollpatch.setText(str(kluster_variables.default_roll_patch_error)) self.kvar_rollpatch.editingFinished.connect(self.validate_numctrl) self.kvar_rollpatch.setToolTip('Default 1 sigma standard deviation in your roll angle patch test procedure') self.kvar_waterline_label = QtWidgets.QLabel('Default Waterline (meters)') self.kvar_waterline = QtWidgets.QLineEdit('') self.kvar_waterline.setValidator(validator) self.kvar_waterline.setText(str(kluster_variables.default_waterline_error)) self.kvar_waterline.editingFinished.connect(self.validate_numctrl) self.kvar_waterline.setToolTip('Default 1 sigma standard deviation of the waterline measurement, only used for waterline vertical reference') uncertaintyfour.addWidget(self.kvar_rollpatch_label) uncertaintyfour.addWidget(self.kvar_rollpatch) uncertaintyfour.addWidget(self.kvar_waterline_label) uncertaintyfour.addWidget(self.kvar_waterline) uncertaintyfive = QtWidgets.QHBoxLayout() self.kvar_horizontalerror_label = QtWidgets.QLabel('Default Horizontal Positioning Error (meters)') self.kvar_horizontalerror = QtWidgets.QLineEdit('') self.kvar_horizontalerror.setValidator(validator) self.kvar_horizontalerror.setText(str(kluster_variables.default_horizontal_positioning_error)) self.kvar_horizontalerror.editingFinished.connect(self.validate_numctrl) self.kvar_horizontalerror.setToolTip('Default 1 sigma standard deviation of the horizontal positioning system, only used if SBET is not provided') self.kvar_verticalerror_label = QtWidgets.QLabel('Default Vertical Positioning Error (meters)') self.kvar_verticalerror = QtWidgets.QLineEdit('') self.kvar_verticalerror.setValidator(validator) self.kvar_verticalerror.setText(str(kluster_variables.default_vertical_positioning_error)) self.kvar_verticalerror.editingFinished.connect(self.validate_numctrl) self.kvar_verticalerror.setToolTip('Default 1 sigma standard deviation of the vertical positioning system, only used if SBET is not provided') uncertaintyfive.addWidget(self.kvar_horizontalerror_label) uncertaintyfive.addWidget(self.kvar_horizontalerror) uncertaintyfive.addWidget(self.kvar_verticalerror_label) uncertaintyfive.addWidget(self.kvar_verticalerror) self.uncertainty_layout.addLayout(uncertaintyone) self.uncertainty_layout.addLayout(uncertaintytwo) self.uncertainty_layout.addLayout(uncertaintythree) self.uncertainty_layout.addLayout(uncertaintyfour) self.uncertainty_layout.addLayout(uncertaintyfive) self.uncertainty_layout.addStretch() self.uncertainty_tab.setLayout(self.uncertainty_layout) self.tabwidget.addTab(self.uncertainty_tab, 'Uncertainty') layout.addWidget(self.tabwidget) layout.addLayout(self.hlayout_five) self.setLayout(layout) self.vdatum_pth = None self.filter_pth = None self.canceled = False self.browse_button.clicked.connect(self.vdatum_browse) self.vdatum_text.textChanged.connect(self.vdatum_changed) self.browse_filter_button.clicked.connect(self.filter_browse) self.filter_text.textChanged.connect(self.filter_changed) self.ok_button.clicked.connect(self.start) self.cancel_button.clicked.connect(self.cancel) self.default_button.clicked.connect(self.set_to_default) self.text_controls = [['vdatum_directory', self.vdatum_text], ['auto_processing_mode', self.auto_processing_mode], ['filter_text', self.filter_text]] self.checkbox_controls = [['enable_parallel_writes', self.parallel_write], ['keep_waterline_changes', self.keep_waterline_changes], ['force_coordinate_match', self.force_coordinate_match]] self.read_settings() self.resize(600, 150)
if filepath is not None: os.startfile(os.path.dirname(filepath)) else: print("Can't locate row by uniqueid {}".format(unique_id)) if __name__ == '__main__': try: # pyside2 app = QtWidgets.QApplication() except TypeError: # pyqt5 app = QtWidgets.QApplication([]) # Force the style to be the same on all OSs: app.setStyle("Fusion") # Now use a palette to switch to dark colors: palette = QtGui.QPalette() palette.setColor(QtGui.QPalette.Window, QtGui.QColor(53, 53, 53)) palette.setColor(QtGui.QPalette.WindowText, QtCore.Qt.gray) palette.setColor(QtGui.QPalette.Base, QtGui.QColor(25, 25, 25)) palette.setColor(QtGui.QPalette.AlternateBase, QtGui.QColor(53, 53, 53)) palette.setColor(QtGui.QPalette.ToolTipBase, QtCore.Qt.black) palette.setColor(QtGui.QPalette.ToolTipText, QtCore.Qt.gray) palette.setColor(QtGui.QPalette.Text, QtCore.Qt.gray) palette.setColor(QtGui.QPalette.Button, QtGui.QColor(53, 53, 53)) palette.setColor(QtGui.QPalette.ButtonText, QtCore.Qt.gray) palette.setColor(QtGui.QPalette.BrightText, QtCore.Qt.red) palette.setColor(QtGui.QPalette.Link, QtGui.QColor(42, 130, 218)) palette.setColor(QtGui.QPalette.Highlight, QtGui.QColor(42, 130, 218)) palette.setColor(QtGui.QPalette.HighlightedText, QtCore.Qt.black) app.setPalette(palette)