def test_run(self):

        if not QtWidgets.qApp:
            QtWidgets.QApplication([])

        widget = QtWidgets.QWidget()
        widget.show()

        progress = QtProgress(widget)

        progress.start(title='Test Bar',
                       text='Doing stuff',
                       min_value=100,
                       max_value=300,
                       init_value=100)

        time.sleep(.1)

        progress.update(value=150, text='Updating')

        time.sleep(.1)

        progress.add(quantum=50, text='Updating')

        time.sleep(.1)

        print("canceled? %s" % progress.canceled)

        progress.end()
示例#2
0
    def stop_emulation(self):
        logger.debug("stop SIS")
        if self.sis:
            progress = QtProgress(self)
            progress.start(title="Halting", text="Wait while threads stop")
            progress.update(value=20)
            self.sis.stop()

            progress.update(value=30)
            self.sis = None

            progress.end()

        self.enable_commands(enable=True)
示例#3
0
    def stop_listening(self):
        logger.debug("stop Topside")
        if self.topside:
            progress = QtProgress(self)
            progress.start(title="Halting", text="Wait while threads stop")
            progress.update(value=20)
            self.topside.stop()

            progress.update(value=30)
            self.topside.join()
            self.topside = None

            progress.end()

        self._active = False
        self.info_viewer.hide()
示例#4
0
    def stop_emulation(self):
        logger.debug("stop SIS")
        if self.sis:
            progress = QtProgress(self)
            progress.start(title="Halting", text="Wait while threads stop")
            progress.update(value=20)
            self.sis.stop()

            progress.update(value=30)
            self.sis.join()
            self.sis = None

            progress.end()

        self._active = False
        self.info_viewer.hide()
示例#5
0
    def noaa_support_unzip(self):
        logger.debug("unzipping NOAA Support Files")

        noaa_support = NOAASupport(app_info=self._ai,
                                   lib_info=self._li,
                                   progress=QtProgress(parent=self))

        if noaa_support.local_noaa_support_folder_present():
            msg = "The support folder was already unzipped:\n" \
                  "- %s\n\n" \
                  "Do you want to force to re-unzip it? If no, go to step #2." \
                  % noaa_support.local_noaa_support_folder()
            # noinspection PyCallByClass,PyArgumentList
            ret = QtWidgets.QMessageBox.information(
                self, "Unzip folder", msg,
                QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
            if ret == QtWidgets.QMessageBox.No:
                return

        unzipped = False

        if noaa_support.internal_zip_path_exists():
            internal_zip_path = noaa_support.internal_zip_path()
            logger.debug("internal zip: %s" % internal_zip_path)

            success = noaa_support.unzip_internal_zip()
            logger.debug("installed internal zip: %s" % success)
            if success:
                unzipped = True

        if not unzipped:
            success = noaa_support.download_from_noaa()
            logger.debug("download from noaa: %s" % success)
            if success:
                unzipped = True

        if not unzipped:
            success = noaa_support.download_from_unh()
            logger.debug("download from unh: %s" % success)
            if success:
                unzipped = True

        # noinspection PyArgumentList
        if unzipped and noaa_support.local_noaa_support_folder_present():
            msg = "Success! Go to step #2."
            # noinspection PyCallByClass,PyArgumentList
            QtWidgets.QMessageBox.information(self, "Unzip done!", msg,
                                              QtWidgets.QMessageBox.Ok)
            return

        else:
            msg = "Unable to unzip the archive. Do you have a working Internet connection?"
            # noinspection PyCallByClass,PyArgumentList
            QtWidgets.QMessageBox.critical(self, "Error", msg,
                                           QtWidgets.QMessageBox.Ok)
            return
示例#6
0
    def __init__(self, main_win, lib, parent=None):
        QtWidgets.QDialog.__init__(self, parent)
        if not isinstance(lib, SoundSpeedLibrary):
            raise RuntimeError("Passed invalid project object: %s" % type(lib))
        self.main_win = main_win
        self.lib = lib

        self.setWindowFlags(self.windowFlags()
                            & ~QtCore.Qt.WindowContextHelpButtonHint)

        # progress dialog
        self.progress = QtProgress(parent=self)
示例#7
0
    def __init__(self, main_win):
        QtWidgets.QMainWindow.__init__(self)

        self.main_win = main_win
        self.media = self.main_win.media

        self.setContentsMargins(0, 0, 0, 0)

        # add a frame
        self.frame = QtWidgets.QFrame()
        self.setCentralWidget(self.frame)

        # progress dialog
        self.progress = QtProgress(parent=self)
示例#8
0
    def __init__(self, main_win, lib):
        QtWidgets.QMainWindow.__init__(self)
        if type(lib) != SoundSpeedLibrary:
            raise RuntimeError("Passed invalid project object: %s" % type(lib))
        self.main_win = main_win
        self.lib = lib

        self.setContentsMargins(0, 0, 0, 0)

        # add a frame
        self.frame = QtWidgets.QFrame()
        self.setCentralWidget(self.frame)

        # progress dialog
        self.progress = QtProgress(parent=self)
示例#9
0
    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)
示例#10
0
    def __init__(self, main_win, db):
        super(AbstractWidget, self).__init__()
        if type(db) != SetupDb:
            raise RuntimeError("Passed invalid settings db object: %s" %
                               type(db))
        self.main_win = main_win
        self.db = db

        self.setContentsMargins(0, 0, 0, 0)

        # add a frame
        self.frame = QtWidgets.QFrame()
        self.setCentralWidget(self.frame)

        # progress dialog
        self.progress = QtProgress(parent=self)
示例#11
0
    def noaa_support_copy(self):
        logger.debug("copying NOAA Support Files")

        noaa_support = NOAASupport(app_info=self._ai,
                                   lib_info=self._li,
                                   progress=QtProgress(parent=self))

        if not noaa_support.local_noaa_support_folder_present():
            msg = "The support folder is not present!\n" \
                  "Did you unzip it? Go to step #1."
            # noinspection PyCallByClass,PyArgumentList
            QtWidgets.QMessageBox.information(self, "Copy folder", msg,
                                              QtWidgets.QMessageBox.Ok)
            return

        if noaa_support.system_noaa_support_folder_present():
            msg = "The support folder was already copied:\n" \
                  "- %s\n\n" \
                  "Do you want to force the re-copy? If no, go to step #3." % noaa_support.system_noaa_support_folder()
            # noinspection PyCallByClass,PyArgumentList
            ret = QtWidgets.QMessageBox.information(
                self, "Copy folder", msg,
                QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
            if ret == QtWidgets.QMessageBox.No:
                return
            noaa_support.delete_system_noaa_support_files()

        copied = noaa_support.copy_local_to_system()
        logger.info(copied)
        if copied and noaa_support.system_noaa_support_folder_present():
            msg = "Success! Go to step #3."
            # noinspection PyCallByClass,PyArgumentList
            QtWidgets.QMessageBox.information(self, "Copy done!", msg,
                                              QtWidgets.QMessageBox.Ok)
            return

        else:
            msg = "Unable to copy the folder:\n" \
                  "- %s\n" \
                  "to:\n" \
                  "- %s\n" \
                  "Try to manually do the copy or re-run QC Tools as administrator." \
                  % (noaa_support.local_noaa_support_folder(), noaa_support.caris_root)
            # noinspection PyCallByClass,PyArgumentList
            QtWidgets.QMessageBox.critical(self, "Error", msg,
                                           QtWidgets.QMessageBox.Ok)
            return
示例#12
0
    def __init__(self, main_win):
        QtWidgets.QWidget.__init__(self)

        self.main_win = main_win
        self.media = self.main_win.media

        # self.setContentsMargins(0, 0, 0, 0)
        #
        # # add a frame
        # self.vbox = QtWidgets.QVBoxLayout()
        # self.setLayout(self.vbox)
        #
        # self.frame = QtWidgets.QFrame()
        # self.vbox.addWidget(self.frame)

        # progress dialog
        self.progress = QtProgress(parent=self)
示例#13
0
    def __init__(self, main_win):
        QtWidgets.QMainWindow.__init__(self)
        self.setFocusPolicy(QtCore.Qt.ClickFocus)

        self.main_win = main_win
        self.media = self.main_win.media

        # set palette
        style_info = QtCore.QFileInfo(
            os.path.join(self.abstract_here, 'styles', 'widget.stylesheet'))
        style_content = open(style_info.filePath()).read()
        self.setStyleSheet(style_content)

        self.setContentsMargins(0, 0, 0, 0)

        # add a frame
        self.frame = QtWidgets.QFrame()
        self.setCentralWidget(self.frame)

        # progress dialog
        self.progress = QtProgress(parent=self)
示例#14
0
import sys
import logging

default_logging.load()
logger = logging.getLogger()

from hyo2.qc.survey.project import SurveyProject
from hyo2.qc.common import testing
from PySide2 import QtWidgets
from hyo2.abc.app.qt_progress import QtProgress

app = QtWidgets.QApplication([])
wid = QtWidgets.QWidget()

prj = SurveyProject(output_folder=testing.output_data_folder(),
                    progress=QtProgress(parent=wid))

# submission folders
sub_folders = [
    r"C:\code\hyo2\processing\hyo2_qc\data\download\2021\ALL_OK\CARIS-GSF\OPR-A123-RA-20",
]
logger.debug("testing > submission folders: %d" % len(sub_folders))

# add folders
for i, sf in enumerate(sub_folders):

    logger.debug("- %d: %s" % (i, sf))

    try:
        if prj.is_valid_project_folder(path=sf):
            prj.add_to_submission_list(sf)

ns_list = ["hyo2.soundspeed", "hyo2.soundspeedmanager", "hyo2.soundspeedsettings"]
set_logging(ns_list=ns_list)

logger = logging.getLogger(__name__)

testing = Testing(root_folder=os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir)))

nc_path = testing.download_test_files(ext=".nc", subfolder="sfbofs")[0]

app = QtWidgets.QApplication([])  # PySide stuff (start)
mw = QtWidgets.QMainWindow()
mw.show()

lib = SoundSpeedLibrary(progress=QtProgress(parent=mw), callbacks=QtCallbacks(parent=mw))

# Choose test location
tests = [

    # (-19.1, 74.16),              # Indian Ocean
    # (72.852028, -67.315431)      # Baffin Bay
    # (18.2648113, 16.1761115),    # in land -> middle of Africa
    # (39.725989, -104.967745)     # in land -> Denver, CO
    # (37.985427, -76.311156),     # Chesapeake Bay
    # (39.162802, -75.278057),     # Deleware Bay
    # (43.026480, -70.318824),     # offshore Portsmouth
    # (40.662218, -74.049306),     # New York Harbor
    # (30.382518, -81.573615),     # Mill Cove, St. Johns River
    # (28.976225, -92.078882),     # Offshore Louisiana
    # (27.762904, -82.557280),     # Tampa Bay
set_logging(ns_list=ns_list)

logger = logging.getLogger(__name__)

# examples of test position:
# - offshore Portsmouth: 43.026480, -70.318824
# - Indian Ocean: -19.1, 74.16
# - middle of Africa (in land): 18.2648113, 16.1761115

switch = "LEOFS"  # WOA09 or WOA13 or RTOFS or GoMOFS or LEOFS or LHOFS

app = QtWidgets.QApplication([])  # PySide stuff (start)
mw = QtWidgets.QMainWindow()
mw.show()

lib = SoundSpeedLibrary(progress=QtProgress(parent=mw),
                        callbacks=QtCallbacks(parent=mw))

if switch == "WOA09":

    # download the WOA09 if not present
    if not lib.has_woa09():
        success = lib.download_woa09()
        if not success:
            raise RuntimeError("unable to download")
    logger.info("has WOA09: %s" % lib.has_woa09())

    # ask user for location and timestamp
    lib.retrieve_woa09()
    logger.info("retrieved WOA09 profiles: %s" % lib.ssp)
示例#17
0
    def __init__(self, main_win):
        AbstractWidget.__init__(self, main_win=main_win)
        self.prj = SurveyProject(progress=QtProgress(parent=self))
        self.prj.set_callback(QtGridCallback(progress=self.prj.progress))

        # init default settings
        settings = QtCore.QSettings()
        # - import
        import_folder = settings.value("survey_import_folder")
        if (import_folder is None) or (not os.path.exists(import_folder)):
            settings.setValue("survey_import_folder", self.prj.output_folder)
        # - output folder
        export_folder = settings.value("survey_export_folder")
        if (export_folder is None) or (not os.path.exists(export_folder)):
            settings.setValue("survey_export_folder", self.prj.output_folder)
        else:  # folder exists
            self.prj.output_folder = export_folder
        # - shp
        export_shp = settings.value("survey_export_shp")
        if export_shp is None:
            settings.setValue("survey_export_shp", self.prj.output_shp)
        else:  # exists
            self.prj.output_shp = (export_shp == "true")
        # - kml
        export_kml = settings.value("survey_export_kml")
        if export_kml is None:
            settings.setValue("survey_export_kml", self.prj.output_kml)
        else:  # exists
            self.prj.output_kml = (export_kml == "true")
        # - subfolders
        export_subfolders = settings.value("survey_export_subfolders")
        if export_subfolders is None:
            settings.setValue("survey_export_subfolders",
                              self.prj.output_subfolders)
        else:  # exists
            self.prj.output_subfolders = (export_subfolders == "true")
        # - project folder
        export_project_folder = settings.value("survey_export_project_folder")
        if export_project_folder is None:
            settings.setValue("survey_export_project_folder",
                              self.prj.output_project_folder)
        else:  # exists
            self.prj.output_project_folder = (export_project_folder == "true")

        # make tabs
        self.tabs = QtWidgets.QTabWidget()
        self.setCentralWidget(self.tabs)
        self.tabs.setContentsMargins(0, 0, 0, 0)
        self.tabs.setIconSize(QtCore.QSize(36, 36))
        self.tabs.setTabPosition(QtWidgets.QTabWidget.South)

        # - inputs
        self.tab_inputs = InputsTab(parent_win=self, prj=self.prj)
        # noinspection PyArgumentList
        self.idx_inputs = self.tabs.insertTab(
            0, self.tab_inputs,
            QtGui.QIcon(os.path.join(self.media, 'inputs.png')), "")
        self.tabs.setTabToolTip(self.idx_inputs, "Data inputs")

        # - flier finder
        self.tab_fliers = FliersTab(parent_win=self, prj=self.prj)
        # noinspection PyArgumentList
        self.idx_fliers = self.tabs.insertTab(
            1, self.tab_fliers,
            QtGui.QIcon(os.path.join(self.media, 'fliers.png')), "")
        self.tabs.setTabToolTip(self.idx_fliers, "Detect fliers")
        self.tabs.setTabEnabled(self.idx_fliers, False)

        # - holiday finder
        self.tab_holes = HolesTab(parent_win=self, prj=self.prj)
        # noinspection PyArgumentList
        self.idx_holes = self.tabs.insertTab(
            3, self.tab_holes,
            QtGui.QIcon(os.path.join(self.media, 'holes.png')), "")
        self.tabs.setTabToolTip(self.idx_holes, "Detect holidays")
        self.tabs.setTabEnabled(self.idx_holes, False)

        # - grid qa
        self.tab_gridqa = GridQATab(parent_win=self, prj=self.prj)
        # noinspection PyArgumentList
        self.idx_gridqa = self.tabs.insertTab(
            4, self.tab_gridqa,
            QtGui.QIcon(os.path.join(self.media, 'gridqa.png')), "")
        self.tabs.setTabToolTip(self.idx_gridqa, "Grid QA")
        self.tabs.setTabEnabled(self.idx_gridqa, False)

        # - bag checks
        self.tab_bag_checks = BAGChecksTab(parent_win=self, prj=self.prj)
        # noinspection PyArgumentList
        self.idx_bag_checks = self.tabs.insertTab(
            5, self.tab_bag_checks,
            QtGui.QIcon(os.path.join(self.media, 'bag_checks.png')), "")
        self.tabs.setTabToolTip(self.idx_bag_checks, "BAG Checks")
        self.tabs.setTabEnabled(self.idx_bag_checks, False)

        # - designated
        self.tab_designated = DesignatedTab(parent_win=self, prj=self.prj)
        # noinspection PyArgumentList
        self.idx_designated = self.tabs.insertTab(
            6, self.tab_designated,
            QtGui.QIcon(os.path.join(self.media, 'designated.png')), "")
        self.tabs.setTabToolTip(self.idx_designated,
                                "Scan designated (BAG only)")
        self.tabs.setTabEnabled(self.idx_designated, False)

        # - scan features
        self.tab_scan = ScanTab(parent_win=self, prj=self.prj)
        # noinspection PyArgumentList
        self.idx_scan = self.tabs.insertTab(
            7, self.tab_scan,
            QtGui.QIcon(os.path.join(self.media, 'scan_features.png')), "")
        self.tabs.setTabToolTip(self.idx_scan, "Scan features")
        self.tabs.setTabEnabled(self.idx_scan, False)

        # - VALSOU checks
        self.tab_valsou = ValsouTab(parent_win=self, prj=self.prj)
        # noinspection PyArgumentList
        self.idx_valsou = self.tabs.insertTab(
            8, self.tab_valsou,
            QtGui.QIcon(os.path.join(self.media, 'valsou.png')), "")
        self.tabs.setTabToolTip(self.idx_valsou, "VALSOU check")
        self.tabs.setTabEnabled(self.idx_valsou, False)

        # - SBDARE checks
        self.tab_sbdare = SbdareTab(parent_win=self, prj=self.prj)
        # noinspection PyArgumentList
        self.idx_sbdare = self.tabs.insertTab(
            9, self.tab_sbdare,
            QtGui.QIcon(os.path.join(self.media, 'sbdare.png')), "")
        self.tabs.setTabToolTip(self.idx_sbdare, "SBDARE export")
        self.tabs.setTabEnabled(self.idx_sbdare, False)

        # - Submission tests
        self.tab_submission = SubmissionTab(parent_win=self, prj=self.prj)
        # noinspection PyArgumentList
        self.idx_submission = self.tabs.insertTab(
            10, self.tab_submission,
            QtGui.QIcon(os.path.join(self.media, 'submission.png')), "")
        self.tabs.setTabToolTip(self.idx_submission, "Submission checks")
        self.tabs.setTabEnabled(self.idx_submission, True)

        # noinspection PyUnresolvedReferences
        self.tabs.currentChanged.connect(self.change_tabs)

        # flags
        self.has_grid = False
        self.has_s57 = False
示例#18
0
    def __init__(self, main_win):
        AbstractWidget.__init__(self, main_win=main_win)
        self.prj = QAXProject()
        self.prj.params.progress = QtProgress(self)

        # init default settings
        settings = QtCore.QSettings()
        # - output folder
        export_folder = settings.value("qax_export_folder")
        if (export_folder is None) or (not os.path.exists(export_folder)):
            settings.setValue("qax_export_folder", str(self.prj.outputs.output_folder))
        else:  # folder exists
            self.prj.outputs.output_folder = Path(export_folder)
        # - shp
        export_shp = settings.value("qax_export_shp")
        if export_shp is None:
            settings.setValue("qax_export_shp", self.prj.params.write_shp)
        else:  # exists
            self.prj.params.write_shp = (export_shp == "true")
        # - kml
        export_kml = settings.value("qax_export_kml")
        if export_kml is None:
            settings.setValue("qax_export_kml", self.prj.params.write_kml)
        else:  # exists
            self.prj.params.write_kml = (export_kml == "true")
        # - import
        import_folder = settings.value("ff_import_folder")
        if (import_folder is None) or (not os.path.exists(import_folder)):
            settings.setValue("ff_import_folder", str(self.prj.outputs.output_folder))
        import_folder = settings.value("dtm_import_folder")
        if (import_folder is None) or (not os.path.exists(import_folder)):
            settings.setValue("dtm_import_folder", str(self.prj.outputs.output_folder))
        # - project folder
        export_project_folder = settings.value("qax_export_project_folder")
        if export_project_folder is None:
            settings.setValue("qax_export_project_folder", str(self.prj.params.project_folder))
        else:  # exists
            self.prj.params.project_folder = (export_project_folder == "true")
        # - subfolders
        export_subfolders = settings.value("qax_export_subfolders")
        if export_subfolders is None:
            settings.setValue("qax_export_subfolders", self.prj.params.subfolders)
        else:  # exists
            self.prj.params.subfolders = (export_subfolders == "true")

        # make tabs
        self.tabs = QtWidgets.QTabWidget()
        self.setCentralWidget(self.tabs)
        self.tabs.setContentsMargins(0, 0, 0, 0)
        self.tabs.setIconSize(QtCore.QSize(36, 36))
        self.tabs.setTabPosition(QtWidgets.QTabWidget.South)
        # main tab
        self.tab_inputs = MainTab(parent_win=self, prj=self.prj)
        # noinspection PyArgumentList
        self.idx_inputs = self.tabs.insertTab(0, self.tab_inputs,
                                              QtGui.QIcon(os.path.join(self.media, 'qax.png')), "")
        self.tabs.setTabToolTip(self.idx_inputs, "QAX")
        # Mate tab
        self.tab_mate = ChecksTab(parent_win=self, prj=self.prj, qa_group="raw_data")
        # noinspection PyArgumentList
        self.idx_mate = self.tabs.insertTab(1, self.tab_mate,
                                            QtGui.QIcon(os.path.join(self.media, 'mate.png')), "")
        self.tabs.setTabEnabled(self.idx_mate, False)
        self.tabs.setTabToolTip(self.idx_mate, "Mate")
        # QC Tools tab
        self.tab_qc_tools = ChecksTab(parent_win=self, prj=self.prj, qa_group="survey_products")
        # noinspection PyArgumentList
        self.idx_qc_tools = self.tabs.insertTab(2, self.tab_qc_tools,
                                                QtGui.QIcon(os.path.join(self.media, 'qc_tools.png')), "")
        self.tabs.setTabEnabled(self.idx_qc_tools, False)
        self.tabs.setTabToolTip(self.idx_qc_tools, "QC Tools")
        # CA Tools tab
        self.tab_ca_tools = ChecksTab(parent_win=self, prj=self.prj, qa_group="chart_adequacy")
        # noinspection PyArgumentList
        self.idx_ca_tools = self.tabs.insertTab(3, self.tab_ca_tools,
                                                QtGui.QIcon(os.path.join(self.media, 'ca_tools.png')), "")
        self.tabs.setTabEnabled(self.idx_ca_tools, False)
        self.tabs.setTabToolTip(self.idx_ca_tools, "CA Tools")
        # noinspection PyUnresolvedReferences
        self.tabs.currentChanged.connect(self.change_tabs)
示例#19
0
    def __init__(self, main_win):
        super().__init__(parent=main_win)
        self.setWindowTitle("Main Tab")
        self.settings = QtCore.QSettings()

        self.main_win = main_win
        self.lib = OpenBST(progress=QtProgress(self))
        self.tab_idx = -1
        self.progress = QtProgress(parent=self)

        # Enable dragging and dropping onto the GUI
        self.setAcceptDrops(True)

        self.setContentsMargins(0, 0, 0, 0)

        # ### CANVAS ###
        self.canvas = MainCanvas(main_win=self.main_win,
                                 main_tab=self,
                                 lib=self.lib)
        self.setCentralWidget(self.canvas)

        # ### FILE PROJECT BAR ###
        self.file_project_bar = FileProjectBar(main_win=self.main_win,
                                               main_tab=self,
                                               canvas=self.canvas,
                                               lib=self.lib)
        # noinspection PyArgumentList
        self.addToolBar(self.file_project_bar)

        # ### FILE PRODUCTS BAR ###
        self.file_products_bar = FileProductsBar(main_win=self.main_win,
                                                 main_tab=self,
                                                 canvas=self.canvas,
                                                 lib=self.lib)
        # noinspection PyArgumentList
        self.addToolBar(self.file_products_bar)

        # ### VIEW PRODUCTS TOOLBAR ###
        self.view_products_bar = ViewProductsBar(main_win=self.main_win,
                                                 main_tab=self,
                                                 canvas=self.canvas,
                                                 lib=self.lib)
        # noinspection PyArgumentList
        self.addToolBar(self.view_products_bar)

        # ### EDIT PRODUCTS TOOLBAR ###
        self.edit_products_bar = EditProductsBar(main_win=self.main_win,
                                                 main_tab=self,
                                                 canvas=self.canvas,
                                                 lib=self.lib)
        # noinspection PyArgumentList
        self.addToolBar(self.edit_products_bar)

        # ### APP SETTINGS BAR ###
        self.app_settings_bar = AppSettingsBar(main_win=self.main_win,
                                               main_tab=self,
                                               canvas=self.canvas,
                                               lib=self.lib)
        # noinspection PyArgumentList
        self.addToolBar(self.app_settings_bar)

        # ### TOOLS ###
        self.product_colors_tool = ProductColorsTool(main_win=self.main_win,
                                                     main_tab=self,
                                                     main_canvas=self.canvas,
                                                     lib=self.lib)
        self.product_shift_tool = ProductShiftTool(main_win=self.main_win,
                                                   main_tab=self,
                                                   main_canvas=self.canvas,
                                                   lib=self.lib)
        self.product_erase_tool = ProductEraseTool(main_win=self.main_win,
                                                   main_tab=self,
                                                   main_canvas=self.canvas,
                                                   lib=self.lib)
        self.product_modify_tool = ProductModifyTool(main_win=self.main_win,
                                                     main_tab=self,
                                                     main_canvas=self.canvas,
                                                     lib=self.lib)
        self.product_clone_tool = ProductCloneTool(main_win=self.main_win,
                                                   main_tab=self,
                                                   main_canvas=self.canvas,
                                                   lib=self.lib)

        self.on_empty_draw()
示例#20
0
    def __init__(self, main_win):
        AbstractWidget.__init__(self, main_win=main_win)
        self.prj = ChartProject(progress=QtProgress(parent=self))
        self.prj.set_callback(QtGridCallback(progress=self.prj.progress))

        # init default settings
        settings = QtCore.QSettings()
        # - import
        import_folder = settings.value("chart_import_folder")
        if (import_folder is None) or (not os.path.exists(import_folder)):
            settings.setValue("chart_import_folder", self.prj.output_folder)
        # - output folder
        export_folder = settings.value("chart_export_folder")
        if (export_folder is None) or (not os.path.exists(export_folder)):
            settings.setValue("chart_export_folder", self.prj.output_folder)
        else:  # folder exists
            self.prj.output_folder = export_folder
        # - shp
        export_shp = settings.value("chart_export_shp")
        if export_shp is None:
            settings.setValue("chart_export_shp", self.prj.output_shp)
        else:  # exists
            self.prj.output_shp = (export_shp == "true")
        # - kml
        export_kml = settings.value("chart_export_kml")
        if export_kml is None:
            settings.setValue("chart_export_kml", self.prj.output_kml)
        else:  # exists
            self.prj.output_kml = (export_kml == "true")
        # - subfolders
        export_subfolders = settings.value("chart_export_subfolders")
        if export_subfolders is None:
            settings.setValue("chart_export_subfolders",
                              self.prj.output_subfolders)
        else:  # exists
            self.prj.output_subfolders = (export_subfolders == "true")
        # - project folder
        export_project_folder = settings.value("chart_export_project_folder")
        if export_project_folder is None:
            settings.setValue("chart_export_project_folder",
                              self.prj.output_project_folder)
        else:  # exists
            self.prj.output_project_folder = (export_project_folder == "true")

        # make tabs
        self.tabs = QtWidgets.QTabWidget()
        self.setCentralWidget(self.tabs)
        self.tabs.setContentsMargins(0, 0, 0, 0)
        self.tabs.setIconSize(QtCore.QSize(36, 36))
        self.tabs.setTabPosition(QtWidgets.QTabWidget.South)

        # - inputs
        self.tab_inputs = InputsTab(parent_win=self, prj=self.prj)
        self.idx_inputs = self.tabs.insertTab(
            0, self.tab_inputs,
            QtGui.QIcon(os.path.join(self.media, 'inputs.png')), "")
        self.tabs.setTabToolTip(self.idx_inputs, "Data inputs")

        # - grid truncate
        self.tab_grid_truncate = GridTruncateTab(parent_win=self, prj=self.prj)
        self.idx_grid_truncate = self.tabs.insertTab(
            1, self.tab_grid_truncate,
            QtGui.QIcon(os.path.join(self.media, 'grid_truncate.png')), "")
        self.tabs.setTabToolTip(self.idx_grid_truncate, "Grid truncate")
        self.tabs.setTabEnabled(self.idx_grid_truncate, False)

        # - grid xyz
        self.tab_grid_xyz = GridXyzTab(parent_win=self, prj=self.prj)
        self.idx_grid_xyz = self.tabs.insertTab(
            2, self.tab_grid_xyz,
            QtGui.QIcon(os.path.join(self.media, 'grid_xyz.png')), "")
        self.tabs.setTabToolTip(self.idx_grid_xyz, "Grid xyz")
        self.tabs.setTabEnabled(self.idx_grid_xyz, False)

        # - S57 truncate
        self.tab_s57_truncate = S57TruncateTab(parent_win=self, prj=self.prj)
        self.idx_s57_truncate = self.tabs.insertTab(
            3, self.tab_s57_truncate,
            QtGui.QIcon(os.path.join(self.media, 's57_truncate.png')), "")
        self.tabs.setTabToolTip(self.idx_s57_truncate, "S57 truncate")
        self.tabs.setTabEnabled(self.idx_s57_truncate, False)

        # - scan features
        self.tab_scan = ScanTab(parent_win=self, prj=self.prj)
        self.idx_scan = self.tabs.insertTab(
            4, self.tab_scan,
            QtGui.QIcon(os.path.join(self.media, 'scan_features.png')), "")
        self.tabs.setTabToolTip(self.idx_scan, "Scan features")
        self.tabs.setTabEnabled(self.idx_scan, False)

        # - triangle
        self.tab_triangle = TriangleTab(parent_win=self, prj=self.prj)
        self.idx_triangle = self.tabs.insertTab(
            5, self.tab_triangle,
            QtGui.QIcon(os.path.join(self.media, 'triangle.png')), "")
        self.tabs.setTabToolTip(self.idx_triangle, "Triangle Rule")
        self.tabs.setTabEnabled(self.idx_triangle, False)

        # noinspection PyUnresolvedReferences
        self.tabs.currentChanged.connect(self.change_tabs)

        # flags
        self.has_grid = False
        self.has_s57 = False
        self.has_ss = False
示例#21
0
    def __init__(self):
        QtWidgets.QMainWindow.__init__(self)

        logger.info("* > APP: initializing ...")

        # set the application name and the version
        self.name = app_info.app_name
        self.version = app_info.app_version
        self.setWindowTitle('%s v.%s' % (self.name, self.version))
        # noinspection PyArgumentList
        _app = QtCore.QCoreApplication.instance()
        _app.setApplicationName('%s' % self.name)
        _app.setOrganizationName("HydrOffice")
        _app.setOrganizationDomain("hydroffice.org")

        # set the minimum and the initial size
        self.setMinimumSize(640, 480)
        self.resize(920, 640)

        # set icons
        self.setWindowIcon(QtGui.QIcon(app_info.app_icon_path))

        # check if setup db exists; if yes, ask to copy
        has_setup = SoundSpeedLibrary.setup_exists()
        logger.info("setup exists: %s" % has_setup)
        if not has_setup:
            other_setups = SoundSpeedLibrary.list_other_setups()
            if len(other_setups) != 0:
                logger.debug("other existing setups: %d" % len(other_setups))
                # noinspection PyCallByClass
                sel, ok = QtWidgets.QInputDialog.getItem(self, 'Do you want to copy an existing setup?',
                                                         'Select one (or click on Cancel to create a new one):',
                                                         other_setups, 0, False)
                if ok:
                    SoundSpeedLibrary.copy_setup(input_setup=sel)

        # create the project
        self.lib = SoundSpeedLibrary(callbacks=QtCallbacks(parent=self), progress=QtProgress(parent=self))
        logger.info("current configuration:\n%s" % Helper(lib_info=lib_info).package_info())
        self.check_woa09()
        self.check_woa13()
        # self.check_rtofs()  # no need to wait for the download at the beginning
        self.check_sis4()
        self.check_sis5()
        self.check_sippican()
        self.check_mvp()

        # init default settings
        settings = QtCore.QSettings()
        export_folder = settings.value("export_folder")
        if (export_folder is None) or (not os.path.exists(export_folder)):
            settings.setValue("export_folder", self.lib.data_folder)
        import_folder = settings.value("import_folder")
        if (import_folder is None) or (not os.path.exists(import_folder)):
            settings.setValue("import_folder", self.lib.data_folder)

        # menu

        self.menu = self.menuBar()
        self.file_menu = self.menu.addMenu("File")
        self.edit_menu = self.menu.addMenu("Process")
        self.database_menu = self.menu.addMenu("Database")
        self.monitor_menu = self.menu.addMenu("Monitor")
        self.server_menu = self.menu.addMenu("Server")
        self.setup_menu = self.menu.addMenu("Setup")
        self.help_menu = self.menu.addMenu("Help")

        # make tabs
        self.tabs = QtWidgets.QTabWidget()
        self.setCentralWidget(self.tabs)
        self.tabs.setIconSize(QtCore.QSize(42, 42))
        self.tabs.blockSignals(True)  # during the initialization
        # noinspection PyUnresolvedReferences
        self.tabs.currentChanged.connect(self.on_change)  # changed!
        # editor
        self.tab_editor = Editor(lib=self.lib, main_win=self)
        self.idx_editor = self.tabs.insertTab(0, self.tab_editor,
                                              QtGui.QIcon(os.path.join(app_info.app_media_path, 'editor.png')), "")
        self.tabs.setTabToolTip(self.idx_editor, "Editor")
        # database
        self.tab_database = Database(lib=self.lib, main_win=self)
        self.idx_database = self.tabs.insertTab(1, self.tab_database,
                                                QtGui.QIcon(os.path.join(app_info.app_media_path, 'database.png')), "")
        self.tabs.setTabToolTip(self.idx_database, "Database")
        # survey data monitor
        self.has_sdm_support = True
        try:  # try.. except to make SSM working also without SDM
            # noinspection PyUnresolvedReferences
            from hyo2.surveydatamonitor.app.widgets.monitor import SurveyDataMonitor
            self.tab_monitor = SurveyDataMonitor(lib=self.lib, main_win=self)
            self.idx_monitor = self.tabs.insertTab(3, self.tab_monitor,
                                                   QtGui.QIcon(
                                                       os.path.join(app_info.app_media_path, 'surveydatamonitor.png')),
                                                   "")
            self.tabs.setTabToolTip(self.idx_monitor, "Survey Data Monitor")
            logger.info("Support for Survey Monitor: ON")
        except Exception as e:
            traceback.print_exc()
            self.has_sdm_support = False
            logger.info("Support for Survey Monitor: OFF(%s)" % e)
        # server
        self.tab_server = Server(lib=self.lib, main_win=self)
        self.idx_server = self.tabs.insertTab(4, self.tab_server,
                                              QtGui.QIcon(os.path.join(app_info.app_media_path, 'server.png')), "")
        self.tabs.setTabToolTip(self.idx_server, "Synthetic Profile Server")

        # refraction
        # self.tab_refraction = Refraction(lib=self.lib, main_win=self)
        # idx = self.tabs.insertTab(5, self.tab_refraction,
        #                           QtGui.QIcon(os.path.join(app_info.app_media_path, 'refraction.png')), "")
        # self.tabs.setTabToolTip(idx, "Refraction Monitor")
        # setup
        self.tab_setup = Settings(lib=self.lib, main_win=self)
        self.idx_setup = self.tabs.insertTab(6, self.tab_setup,
                                             QtGui.QIcon(os.path.join(app_info.app_media_path, 'settings.png')), "")
        self.tabs.setTabToolTip(self.idx_setup, "Setup")
        # info
        self.tab_info = InfoTab(main_win=self, lib_info=lib_info, app_info=app_info,
                                with_online_manual=True,
                                with_offline_manual=True,
                                with_bug_report=True,
                                with_hydroffice_link=True,
                                with_ccom_link=True,
                                with_noaa_link=True,
                                with_unh_link=True,
                                with_license=True)
        self.idx_info = self.tabs.insertTab(6, self.tab_info,
                                            QtGui.QIcon(os.path.join(app_info.app_media_path, 'info.png')), "")
        self.tabs.setTabToolTip(self.idx_info, "Info")
        # Help menu
        self.help_menu.addAction(self.tab_info.open_online_manual_action)
        self.help_menu.addAction(self.tab_info.open_offline_manual_action)
        self.help_menu.addAction(self.tab_info.fill_bug_report_action)
        self.help_menu.addAction(self.tab_info.authors_action)
        self.help_menu.addAction(self.tab_info.show_about_action)

        self.statusBar().setStyleSheet("QStatusBar{color:rgba(0,0,0,128);font-size: 8pt;}")
        self.status_bar_normal_style = self.statusBar().styleSheet()
        self.statusBar().showMessage("%s" % app_info.app_name, 2000)
        self.releaseInfo = QtWidgets.QLabel()
        self.statusBar().addPermanentWidget(self.releaseInfo)
        self.releaseInfo.setStyleSheet("QLabel{color:rgba(0,0,0,128);font-size: 8pt;}")
        timer = QtCore.QTimer(self)
        # noinspection PyUnresolvedReferences
        timer.timeout.connect(self.update_gui)
        timer.start(1500)
        self.timer_execs = 0

        self.data_cleared()
        self.tabs.blockSignals(False)

        logger.info("* > APP: initialized!")
示例#22
0
from hyo2.abc.lib.logging import set_logging

logger = logging.getLogger(__name__)
set_logging(ns_list=["hyo2.abc"])

use_setup = 0  # 0: internal, 1: NOAA, 2: CCOM
delete_local_folder = False
copy_files = True

QtWidgets.QApplication([])
w = QtWidgets.QWidget()
w.show()

noaa_support = NOAASupport(lib_info=LibInfo(),
                           app_info=AppInfo(),
                           progress=QtProgress(parent=w))

if use_setup == 0:

    if noaa_support.internal_zip_path_exists():
        internal_zip_path = noaa_support.internal_zip_path()
        logger.debug("internal zip: %s" % internal_zip_path)

        success = noaa_support.unzip_internal_zip()
        logger.debug("installed internal zip: %s" % success)
        if not success:
            exit(-1)

elif use_setup == 1:  # 5.8 is now 7z, thus this fails

    success = noaa_support.download_from_noaa()
示例#23
0
    def noaa_support_install(self):
        logger.debug("installing NOAA Support Files")

        noaa_support = NOAASupport(app_info=self._ai,
                                   lib_info=self._li,
                                   progress=QtProgress(parent=self))

        msg = "The batch file must be executed as administrator\n" \
              "with all other users logged off the system.\n" \
              "Once executed, follow the instructions in the Windows shell.\n\n" \
              "Do you want to continue with the installation?"
        # noinspection PyCallByClass,PyArgumentList
        ret = QtWidgets.QMessageBox.information(
            self, "Install files", msg,
            QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
        if ret == QtWidgets.QMessageBox.No:
            return

        if not noaa_support.system_noaa_support_folder_present():
            msg = "The support folder is not present!\n" \
                  "Did you copy it? Go to step #2."
            # noinspection PyCallByClass,PyArgumentList
            QtWidgets.QMessageBox.information(self, "Install files", msg,
                                              QtWidgets.QMessageBox.Ok)
            return

        if not noaa_support.system_batch_file_exists():
            msg = "The batch file does not exist!\n" \
                  "Did you execute steps #1 and #2? Try to execute them again."
            # noinspection PyCallByClass,PyArgumentList
            QtWidgets.QMessageBox.information(self, "Install files", msg,
                                              QtWidgets.QMessageBox.Ok)
            return

        if not Helper.is_user_admin():

            msg = "CA Tools was not executed as admin!\n\n" \
                  "Do you want that CA Tools executes the batch file?\n\n" \
                  "You will be prompted for permissions.\n"

            # noinspection PyCallByClass,PyArgumentList
            ret = QtWidgets.QMessageBox.information(
                self, "Install files", msg,
                QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
            if ret == QtWidgets.QMessageBox.No:

                msg = "You have then two alternatives:\n" \
                      "#1: Close CA Tools and re-open it using the option \"Run as administrator\"\n" \
                      "or:\n" \
                      "#2: Manually run as administrator the batch file at:\n" \
                      "- %s\n\n" \
                      "For option #2, do you want that CA Tools open the folder with the batch file?" \
                      % (noaa_support.system_batch_file())

                # noinspection PyCallByClass,PyArgumentList
                ret = QtWidgets.QMessageBox.information(
                    self, "Install files", msg,
                    QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
                if ret == QtWidgets.QMessageBox.Yes:
                    noaa_support.open_system_noaa_support_folder()
                return

            installed = noaa_support.exec_system_batch()
            if installed:
                msg = "Follow the instruction in the windows shell!"
                # noinspection PyCallByClass,PyArgumentList
                QtWidgets.QMessageBox.information(self, "Windows shell", msg,
                                                  QtWidgets.QMessageBox.Ok)
                return

            else:
                msg = "Unable to install the support files.\n" \
                      "Try to manually run as administrator the batch file at: %s\n\n" \
                      % (noaa_support.system_batch_file())
                # noinspection PyCallByClass,PyArgumentList
                QtWidgets.QMessageBox.critical(self, "Error", msg,
                                               QtWidgets.QMessageBox.Ok)
                noaa_support.open_system_noaa_support_folder()
                return

        else:

            installed = noaa_support.exec_system_batch()
            if installed:
                msg = "Success!"
                # noinspection PyCallByClass,PyArgumentList
                QtWidgets.QMessageBox.information(self, "Installation done!",
                                                  msg,
                                                  QtWidgets.QMessageBox.Ok)
                return

            else:
                msg = "Unable to install the support files.\n" \
                      "Try to manually run as administrator the batch file at: %s\n\n" \
                      % (noaa_support.system_batch_file())
                # noinspection PyCallByClass,PyArgumentList
                QtWidgets.QMessageBox.critical(self, "Error", msg,
                                               QtWidgets.QMessageBox.Ok)
                noaa_support.open_system_noaa_support_folder()
                return
示例#24
0
    def __init__(self, main_win, plot_params: Optional[PlotParams] = None):
        super().__init__(parent=main_win)
        if plot_params is None:
            self._pp = PlotParams()  # plot parameters
        else:
            self._pp = plot_params

        self.jm2 = Model()
        self.jm2.use_test_sed_params(TestSediments.COARSE_SAND)
        self.jm2.use_default_mdl_params()

        self.setWindowTitle("Arch Tab")
        self.settings = QtCore.QSettings()

        self.main_win = main_win
        self.progress = QtProgress(parent=self)

        self.setContentsMargins(0, 0, 0, 0)

        canvas_frame = QtWidgets.QFrame(self)
        self.layout = QtWidgets.QVBoxLayout()
        canvas_frame.setLayout(self.layout)

        with rc_context(app_info.plot_rc_context):

            self.f = Figure()
            self.f.patch.set_alpha(0.0)
            self.c = FigureCanvas(self.f)
            self.c.setParent(self)
            # noinspection PyUnresolvedReferences
            self.c.setFocusPolicy(
                QtCore.Qt.ClickFocus)  # key for press events!!!
            self.c.setFocus()
            self.layout.addWidget(self.c)

            # axes
            gs = gridspec.GridSpec(3, 3)
            self.up_ax = self.f.add_subplot(gs[0:2, :])
            self.down_ax = self.f.add_subplot(gs[2, :])

        # navigation
        self.nav = NavToolbar(canvas=self.c, parent=self)
        self.layout.addWidget(self.nav)

        self.setCentralWidget(canvas_frame)

        settings_dock = QtWidgets.QDockWidget("Settings")
        settings_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetFloatable
                                  | QtWidgets.QDockWidget.DockWidgetMovable)
        settings_dock.setMinimumWidth(200)
        settings_dock.setMaximumWidth(400)
        settings_frame = QtWidgets.QWidget()
        settings_dock.setWidget(settings_frame)
        self.process_layout = QtWidgets.QVBoxLayout()
        settings_frame.setLayout(self.process_layout)

        # sediment

        seds_label_layout = QtWidgets.QHBoxLayout()
        self.process_layout.addLayout(seds_label_layout)
        seds_label_layout.addStretch()
        seds_label = QtWidgets.QLabel("Sediment Type")
        seds_label_layout.addWidget(seds_label)
        seds_label_layout.addStretch()

        seds_layout = QtWidgets.QHBoxLayout()
        self.process_layout.addLayout(seds_layout)
        seds_layout.addStretch()
        self.seds = dict()
        for sed in TestSediments:
            self.seds[test_params[sed].name] = sed
        self.seds_list = QtWidgets.QComboBox()
        self.seds_list.addItems(list(self.seds.keys()))
        self.seds_list.setCurrentText(
            test_params[TestSediments.COARSE_SAND].name)
        # noinspection PyUnresolvedReferences
        self.seds_list.currentTextChanged.connect(self.on_draw)
        seds_layout.addWidget(self.seds_list)
        seds_layout.addStretch()

        # frequency

        freq_label_layout = QtWidgets.QHBoxLayout()
        self.process_layout.addLayout(freq_label_layout)
        freq_label_layout.addStretch()
        self.freq_label = QtWidgets.QLabel("Frequency [%.1f kHz]" %
                                           (self.jm2.mdl_params.f / 1000))
        freq_label_layout.addWidget(self.freq_label)
        freq_label_layout.addStretch()

        freq_layout = QtWidgets.QHBoxLayout()
        self.process_layout.addLayout(freq_layout)
        freq_layout.addStretch()
        self.freq_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        self.freq_slider.setMinimumWidth(160)
        self.freq_slider.setMinimum(1)
        self.freq_slider.setMaximum(500)
        self.freq_slider.setTickInterval(1)
        self.freq_slider.setValue(self.jm2.mdl_params.f / 1000)
        # noinspection PyUnresolvedReferences
        self.freq_slider.valueChanged.connect(self.on_draw)
        freq_layout.addWidget(self.freq_slider)
        freq_layout.addStretch()

        self.process_layout.addSpacing(12)

        redraw_layout = QtWidgets.QHBoxLayout()
        self.process_layout.addLayout(redraw_layout)
        redraw_layout.addStretch()
        redraw_btn = QtWidgets.QPushButton("Redraw")
        # noinspection PyUnresolvedReferences
        redraw_btn.clicked.connect(self.on_draw)
        redraw_layout.addWidget(redraw_btn)
        redraw_layout.addStretch()

        self.process_layout.addStretch()
        self.addDockWidget(QtCore.Qt.RightDockWidgetArea, settings_dock)

        self.on_draw()
示例#25
0
import time
import logging
from PySide2 import QtWidgets

from hyo2.abc.app.qt_progress import QtProgress
from hyo2.abc.lib.logging import set_logging

logger = logging.getLogger(__name__)
set_logging(ns_list=["hyo2.abc"])

app = QtWidgets.QApplication([])

widget = QtWidgets.QWidget()
widget.show()

progress = QtProgress(parent=widget)

progress.start(title='Test Bar', text='Doing stuff')

time.sleep(.1)

progress.update(value=30, text='Updating')

time.sleep(.1)

print("canceled? %s" % progress.canceled)

progress.end()
示例#26
0
from hyo2.abc.app.qt_progress import QtProgress

logger = logging.getLogger(__name__)
set_logging(ns_list=["hyo2.qc", ])

app = QtWidgets.QApplication([])
wid = QtWidgets.QWidget()

# options
use_internal_test_files = False
use_internal_csar = True
with_laser = True
specs_version = "2021"
is_target_detection = False

prj = SurveyProject(output_folder=testing.output_data_folder(), progress=QtProgress(parent=wid))

# add a S57 file
if use_internal_test_files:
    s57_idx = 0
    s57_files = testing.input_test_files(".000")
    logger.debug("- test S57 files: %d" % len(s57_files))
    logger.debug("- adding test S57 file #%d" % s57_idx)
    prj.add_to_s57_list(s57_path=s57_files[s57_idx])

    # add a grid file
    grid_idx = 0
    if use_internal_csar:
        grid_files = testing.input_test_files(".csar")
        logger.debug("- test CSAR files: %d" % len(grid_files))
    else: