def __init__(self): super(ManualWindow, self).__init__() self.setWindowTitle('QAX Manual') icon_info = QFileInfo(app_info.app_icon_path) self.setWindowIcon(QIcon(icon_info.absoluteFilePath())) self.toolbar = QToolBar() self.addToolBar(self.toolbar) self.back_button = QPushButton() self.back_button.setIcon(qta.icon('fa.arrow-left')) self.back_button.clicked.connect(self.back) self.toolbar.addWidget(self.back_button) self.forward_button = QPushButton() self.forward_button.setIcon(qta.icon('fa.arrow-right')) self.forward_button.clicked.connect(self.forward) self.toolbar.addWidget(self.forward_button) self.address_line_edit = QLineEdit() self.address_line_edit.returnPressed.connect(self.load) self.address_line_edit.setVisible(False) self.toolbar.addWidget(self.address_line_edit) self.web_engine_view = QWebEngineView() self.web_engine_view.setZoomFactor(2.0) self.setCentralWidget(self.web_engine_view) initialUrl = self.docs_url() self.address_line_edit.setText(str(initialUrl)) self.web_engine_view.load(QUrl(initialUrl)) self.web_engine_view.page().urlChanged.connect(self.urlChanged)
def __init__(self, file_group: QaxFileGroup, parent=None): QtWidgets.QWidget.__init__(self, parent=parent) self.setMinimumHeight(40) self.file_group = file_group hbox = QtWidgets.QHBoxLayout() hbox.setAlignment(QtCore.Qt.AlignTop) hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) self.selected_files = [] left_space = 100 label_layout = QtWidgets.QVBoxLayout() label_layout.setAlignment(QtCore.Qt.AlignTop) label = QtWidgets.QLabel("{}:".format(file_group.name)) label.setWordWrap(True) label.setMinimumWidth(left_space) label.setMaximumWidth(left_space) label_layout.addWidget(label) hbox.addLayout(label_layout) self.file_list = QtWidgets.QListWidget() self.file_list.setMinimumHeight(40) hbox.addWidget(self.file_list) self.file_list.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) self.file_list.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.file_list.customContextMenuRequested.connect( self.__make_context_menu) self.file_list.setAlternatingRowColors(True) # Enable dropping onto the input ss list self.file_list.setAcceptDrops(True) self.file_list.installEventFilter(self) button_layout = QtWidgets.QVBoxLayout() hbox.addLayout(button_layout) button_layout.setAlignment(QtCore.Qt.AlignTop) self.add_file_button = QtWidgets.QPushButton() button_layout.addWidget(self.add_file_button) self.add_file_button.setIcon(qta.icon('fa.folder-open')) self.add_file_button.setToolTip( "Add (or drag-and-drop) the survey {} files" .format(file_group.name)) self.add_file_button.clicked.connect(self._click_add) self.clear_files_button = QtWidgets.QPushButton() button_layout.addWidget(self.clear_files_button) self.clear_files_button.setIcon(qta.icon('fa.close')) self.clear_files_button.setToolTip( "Clear {} files".format(file_group.name)) self.clear_files_button.clicked.connect(self._click_clear)
def __init__(self, checks: List[QajsonCheck] = None, parent=None): super(ScoreBoardCheckModel, self).__init__(parent) # qtawesome needs a GUI running to load icons, this prevents these from # being created at a class level (instead of per instance) self.cross_icon = qta.icon('fa.close', color='red') self.tick_icon = qta.icon('fa.check', color='green') self.warning_icon = qta.icon('fa.warning', color='orange') if checks is None: self.checks = [] else: self.checks = checks
def __init__(self, main_win): QtWidgets.QTabWidget.__init__(self) self.prj = QAXProject() self.prj.params.progress = QtProgress(self) self.profile = None # QaxConfigProfile # make tabs self.tabs = self # self.vbox = QtWidgets.QVBoxLayout() # self.setLayout(self.vbox) # self.vbox.addWidget(self.tabs) # self.tabs.setContentsMargins(0, 0, 0, 0) self.tabs.setIconSize(QtCore.QSize(72, 72)) # self.tabs.setTabPosition(QtWidgets.QTabWidget.South) # main tab self.tab_inputs = MainTab(parent_win=self, prj=self.prj) self.tab_inputs.profile_selected.connect(self._on_profile_selected) self.tab_inputs.check_inputs_changed.connect( self._on_update_check_inputs) # noinspection PyArgumentList self.idx_inputs = self.tabs.insertTab(0, self.tab_inputs, qta.icon('mdi.file-multiple'), "") self.tabs.setTabToolTip(self.idx_inputs, "QAX") self.tab_plugins = PluginsTab(parent_win=self, prj=self.prj) self.tab_plugins.plugin_changed.connect(self._on_plugin_changed) self.idx_plugins = self.tabs.insertTab( 1, self.tab_plugins, qta.icon('mdi.format-list-checkbox'), "") self.tabs.setTabToolTip(self.idx_plugins, "Plugins") self.tab_run = RunTab(self.prj) self.tab_run.objectName = "tab_run" self.tab_run.run_checks.connect(self._on_execute_checks) self.idx_run = self.tabs.insertTab(2, self.tab_run, qta.icon('fa.play'), "") self.tabs.setTabToolTip(self.idx_run, "Run Checks") self.tab_result = ResultTab(self.prj) self.tab_result.objectName = "tab_result" self.idx_result = self.tabs.insertTab(3, self.tab_result, qta.icon('fa.check'), "") self.tabs.setTabToolTip(self.idx_result, "View check results") self.tabs.currentChanged.connect(self.change_tabs)
def _add_output(self): output_groupbox = QGroupBox("Output") output_groupbox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) output_layout = QVBoxLayout() output_layout.setSpacing(0) output_groupbox.setLayout(output_layout) output_file_layout = QHBoxLayout() output_file_layout.setSpacing(4) self.output_file_input = QLineEdit() self.output_file_input.textChanged.connect( self._on_output_filename_changed) self.output_file_input.setMinimumWidth(400) self.output_file_input.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) output_file_layout.addWidget(self.output_file_input) output_layout.addLayout(output_file_layout) self.open_output_file_button = QPushButton() output_file_layout.addWidget(self.open_output_file_button) self.open_output_file_button.setIcon(qta.icon('fa.folder-open')) self.open_output_file_button.setToolTip("Select output file location") self.open_output_file_button.clicked.connect(self._click_open_output) self.layout.addWidget(output_groupbox)
def __init__(self, parent=None): super(GridTransformerDialog, self).__init__( parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowCloseButtonHint) self.setWindowTitle("Grid Transformer") self.setWindowIcon(qta.icon('fa.th')) # dict to store inputs that will get passed to the grid transformer # this gets validated to ensure all the bits of info are in it before # the run button gets enabled self.grid_transformer_inputs = {} self.layout = QVBoxLayout() self.setLayout(self.layout) self._add_inputs() self._add_output() self._add_process() close_layout = QHBoxLayout() close_layout.addStretch() button_close = QPushButton("Close") button_close.clicked.connect(self.close_dialog) close_layout.addWidget(button_close) self.layout.addLayout(close_layout)
def _add_check_outputs(self): co_groupbox = QGroupBox("Check outputs") co_groupbox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) co_layout = QVBoxLayout() co_layout.setSpacing(16) co_groupbox.setLayout(co_layout) self.qajson_spatial_checkbox = QCheckBox( "Include summary spatial output in QAJSON. " "Supports QAX visualisation.") self.qajson_spatial_checkbox.setCheckState( QtCore.Qt.CheckState.Checked) co_layout.addWidget(self.qajson_spatial_checkbox) export_layout = QVBoxLayout() export_layout.setSpacing(4) self.export_spatial_checkbox = QCheckBox( "Export detailed spatial outputs to file. " "Supports visualisation in other geospatial applications.") self.export_spatial_checkbox.stateChanged.connect( self._on_export_spatial_changed) export_layout.addWidget(self.export_spatial_checkbox) output_folder_layout = QHBoxLayout() output_folder_layout.setSpacing(4) output_folder_layout.addSpacerItem(QtWidgets.QSpacerItem(37, 20)) self.output_folder_label = QLabel( "Detailed spatial output folder location:") output_folder_layout.addWidget(self.output_folder_label) self.output_folder_input = QLineEdit() self.output_folder_input.setText( GuiSettings.settings().value("spatial_outputs")) self.output_folder_input.setMinimumWidth(300) self.output_folder_input.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) output_folder_layout.addWidget(self.output_folder_input) self.open_output_folder_button = QPushButton() output_folder_layout.addWidget(self.open_output_folder_button) self.open_output_folder_button.setIcon(qta.icon('fa.folder-open')) self.open_output_folder_button.setToolTip( f"Select file containing data") self.open_output_folder_button.clicked.connect( self._click_open_spatial_export_folder) export_layout.addLayout(output_folder_layout) co_layout.addLayout(export_layout) self._on_export_spatial_changed() self.vbox.addWidget(co_groupbox)
def __init__(self, band_name: str, parent=None): QWidget.__init__(self, parent=parent) self.band_name = band_name self.filename = None self.file_info = None self.layout = QHBoxLayout() self.layout.setSpacing(16) self.layout.setMargin(8) self.setLayout(self.layout) label = QLabel(self.band_name) label.setMinimumWidth(125) self.layout.addWidget(label) input_file_layout = QHBoxLayout() input_file_layout.setSpacing(4) self.input_file_input = QLineEdit() # can only be set by file selection dialog self.input_file_input.setReadOnly(True) self.input_file_input.setMinimumWidth(300) self.input_file_input.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) input_file_layout.addWidget(self.input_file_input) self.open_file_button = QPushButton() input_file_layout.addWidget(self.open_file_button) self.open_file_button.setIcon(qta.icon('fa.folder-open')) self.open_file_button.setToolTip( f"Select file containing {self.band_name} data") self.open_file_button.clicked.connect(self._click_open) self.layout.addLayout(input_file_layout) self.band_select = QComboBox() self.band_select.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.band_select.setMinimumWidth(180) self.band_select.setMaximumWidth(240) self.band_select.setToolTip( f"Select band containing {self.band_name} data") self.band_select.currentIndexChanged.connect(self._band_selected) self.band_select.setDisabled(True) self.layout.addWidget(self.band_select)
def _add_process(self): process_groupbox = QGroupBox("Process") process_groupbox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) process_layout = QVBoxLayout() process_layout.setSpacing(0) process_groupbox.setLayout(process_layout) pbar_frame = QFrame() pbar_frame.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) pbar_hbox = QHBoxLayout() pbar_hbox.setContentsMargins(QtCore.QMargins(0, 0, 0, 16)) pbar_hbox.setSpacing(16) # Run and stop buttons hbox = QHBoxLayout() hbox.setSpacing(8) self.run_button = QPushButton() # is only enabled when validation passes self.run_button.setEnabled(False) self.run_button.setText("Run") self.run_button.setFixedWidth(100) run_icon = qta.icon('fa.play', color='green') self.run_button.setIcon(run_icon) self.run_button.clicked.connect(self._click_run) hbox.addWidget(self.run_button) self.stop_button = QPushButton() self.stop_button.setEnabled(False) self.stop_button.setText("Stop") self.stop_button.setFixedWidth(100) stop_icon = qta.icon('fa.stop', color='red') self.stop_button.setIcon(stop_icon) self.stop_button.clicked.connect(self._click_stop) hbox.addWidget(self.stop_button) self.progress_bar = QProgressBar() self.progress_bar.setTextVisible(True) self.progress_bar.setAlignment(QtCore.Qt.AlignCenter) self.progress_bar.setValue(0) self.progress_bar.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) pbar_hbox.addLayout(hbox) pbar_hbox.addWidget(self.progress_bar) pbar_frame.setLayout(pbar_hbox) process_layout.addWidget(pbar_frame) self.warning_frame = QFrame() self.warning_frame.setVisible(False) self.warning_frame.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) hbox = QHBoxLayout() warning_icon_widget = qta.IconWidget('fa.warning', color='red') warning_icon_widget.setIconSize(QtCore.QSize(48, 48)) warning_icon_widget.update() hbox.addWidget(warning_icon_widget) warning_label = QLabel( "Grid Transformer did not complete successfully. Please refer to " "log output.") warning_label.setStyleSheet("QLabel { color: red; }") warning_label.setWordWrap(True) warning_label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) hbox.addWidget(warning_label) self.warning_frame.setLayout(hbox) process_layout.addWidget(self.warning_frame) self.success_frame = QFrame() self.success_frame.setVisible(False) self.success_frame.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) hbox = QHBoxLayout() success_icon_widget = qta.IconWidget('fa.check', color='green') success_icon_widget.setIconSize(QtCore.QSize(48, 48)) success_icon_widget.update() hbox.addWidget(success_icon_widget) success_label = QLabel("Grid Transformer completed successfully.") success_label.setStyleSheet("QLabel { color: green; }") success_label.setWordWrap(True) success_label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) hbox.addWidget(success_label) self.success_frame.setLayout(hbox) process_layout.addWidget(self.success_frame) log_layout = QVBoxLayout() log_layout.setSpacing(4) log_label = QLabel("Log messages") log_label.setStyleSheet("QLabel { color: grey; }") log_layout.addWidget(log_label) self.log_messages = QPlainTextEdit() log_font = QFont("monospace") log_font.setStyleHint(QFont.TypeWriter) self.log_messages.setFont(log_font) self.log_messages.setReadOnly(True) self.log_messages.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) # self.log_messages.sizePolicy.setVerticalStretch(1) log_layout.addWidget(self.log_messages) process_layout.addLayout(log_layout) self.layout.addWidget(process_groupbox)
def __init__(self, prj: QAXProject): super(ResultTab, self).__init__() self.prj = prj self.prj.qa_json_changed.connect(self._on_qa_json_changed) self.qa_group = "raw_data" self._qa_json = None # ui self.vbox = QtWidgets.QVBoxLayout() self.setLayout(self.vbox) self.set_view = None self.cur_view = 'Summary' self.set_data_level = None self.qa_group = None self.force_reload = None self.execute_all = None self.json_text_group = None self.json_viewer = None self.score_board_widget = None self.score_board_group = None self.score_board = None self.summary_widget = None self.summary_group = None self.summary_table = None self.scoreboard_details = None self.scoreboard_selected_check = None self.cross_icon = qta.icon('fa.close', color='red') self.tick_icon = qta.icon('fa.check', color='green') self.warning_icon = qta.icon('fa.warning', color='orange') self.view_names = ['Summary', 'Score Board', 'Json Text'] self.warning_groupbox = QtWidgets.QGroupBox('Warning') self.warning_groupbox.setStyleSheet( 'QGroupBox:title {color: red; top: -12px; left: 10px;} ' 'QGroupBox { border: 1px solid red; margin-top: 8px; padding: 5px;}' ) hbox = QtWidgets.QHBoxLayout() self.warning_groupbox.setLayout(hbox) self.warning_groupbox.setHidden(True) warning_icon_widget = qta.IconWidget('fa.warning', color='red') warning_icon_widget.setIconSize(QtCore.QSize(48, 48)) warning_icon_widget.update() hbox.addWidget(warning_icon_widget) warning_label = QtWidgets.QLabel( "QAJSON is invalid, contents shown below have not been updated. " "Please correct check parameter values on the plugins tab to " "resolve this issue.") warning_label.setWordWrap(True) warning_label.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) hbox.addWidget(warning_label) hbox.stretch(1) self.vbox.addWidget(self.warning_groupbox) gb = QtWidgets.QGroupBox('View') # gb.setFixedHeight(40) hbox = QtWidgets.QHBoxLayout() gb.setLayout(hbox) hbox_view_and_datalevel = QtWidgets.QHBoxLayout() hbox_view_and_datalevel.addWidget(gb) self.vbox.addLayout(hbox_view_and_datalevel) self.set_view = QtWidgets.QButtonGroup() self.set_view.setExclusive(True) for idx, view_name in enumerate(self.view_names): # viewRadioButton = QtWidgets.QRadioButton(view_name) viewRadioButton = QtWidgets.QPushButton(view_name) viewRadioButton.setCheckable(True) if idx == 0: viewRadioButton.setChecked(True) viewRadioButton.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) self.set_view.addButton(viewRadioButton, idx) hbox.addWidget(viewRadioButton) self.set_view.buttonReleased.connect(self._on_set_view) gb = QtWidgets.QGroupBox("Data Level") hbox = QtWidgets.QHBoxLayout() gb.setLayout(hbox) hbox_view_and_datalevel.addWidget(gb) self.set_data_level = QtWidgets.QComboBox() self.set_data_level.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) self.set_data_level.addItems(ResultTab.possible_dl_names) self.set_data_level.currentTextChanged.connect(self._on_set_data_level) # starts off disabled as the default summary view doesn't filter by # data level self.set_data_level.setDisabled(True) hbox.addWidget(self.set_data_level) self._add_summary_view() self._add_json_view() self._add_score_board_view() self._on_set_view()