Ejemplo n.º 1
0
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self,
                                main_win=main_win,
                                lib=lib,
                                parent=parent)

        self.setWindowTitle("Receive data")

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)
        self.buttonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.mainLayout.addWidget(self.buttonBox)

        # add buttons
        # -- WOA09
        btn = QtWidgets.QPushButton("Retrieve WOA09 data")
        self.buttonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from WOA09 Atlas")
        btn.clicked.connect(self.on_click_woa09)
        # -- WOA13
        btn = QtWidgets.QPushButton("Retrieve WOA13 data")
        self.buttonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from WOA13 Atlas")
        btn.clicked.connect(self.on_click_woa13)
        # -- RTOFS
        btn = QtWidgets.QPushButton("Retrieve RTOFS data")
        self.buttonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from RTOFS Atlas")
        btn.clicked.connect(self.on_click_rtofs)
        # -- SIS
        btn = QtWidgets.QPushButton("Retrieve from SIS")
        self.buttonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve current profile from SIS")
        btn.clicked.connect(self.on_click_sis)
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self,
                                main_win=main_win,
                                lib=lib,
                                parent=parent)

        self.fmt_outputs = list()

        self.setWindowTitle("New project")
        self.setMinimumWidth(160)

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)

        # -- label
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        label = QtWidgets.QLabel("Project name:")
        hbox.addWidget(label)
        hbox.addStretch()
        # -- value
        self.new_project = QtWidgets.QLineEdit()
        rex = QtCore.QRegExp('[a-zA-Z0-9_.-]+')
        validator = QtGui.QRegExpValidator(rex)
        self.new_project.setValidator(validator)
        self.mainLayout.addWidget(self.new_project)
        # -- space
        self.mainLayout.addSpacing(6)
        # -- button
        btn = QtWidgets.QPushButton("Create")
        self.mainLayout.addWidget(btn)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_create)
Ejemplo n.º 3
0
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self, main_win=main_win, lib=lib, parent=parent)

        self.fmt_outputs = list()

        self.setWindowTitle("Import data from another project")
        self.setMinimumWidth(220)

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)

        # -- label
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        label = QtWidgets.QLabel("Input Project DB:")
        hbox.addWidget(label)
        hbox.addStretch()
        # -- value
        self.db_path = QtWidgets.QLineEdit()
        self.db_path.setReadOnly(True)
        self.mainLayout.addWidget(self.db_path)
        # -- button
        btn = QtWidgets.QPushButton("Browse")
        self.mainLayout.addWidget(btn)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_browse)
        # -- space
        self.mainLayout.addSpacing(6)
        # -- button
        btn = QtWidgets.QPushButton("Import")
        self.mainLayout.addWidget(btn)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_import)
Ejemplo n.º 4
0
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self, main_win=main_win, lib=lib, parent=parent)

        self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowMinMaxButtonsHint)

        self.setWindowTitle("Spreadsheet")
        self.setMinimumSize(QtCore.QSize(400, 300))

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)

        self.tabs = QtWidgets.QTabWidget()
        self.mainLayout.addWidget(self.tabs)

        # raw
        self.raw_table = QtWidgets.QTableView()
        self.raw_model = RawDataModel(self.lib, table=self)
        self.raw_table.setModel(self.raw_model)
        self.raw_table.resizeColumnsToContents()
        idx = self.tabs.insertTab(0, self.raw_table, "Raw")
        self.tabs.setTabToolTip(idx, "Raw data")

        # proc
        self.proc_table = QtWidgets.QTableView()
        self.proc_model = ProcDataModel(self.lib, table=self)
        self.proc_table.setModel(self.proc_model)
        self.proc_table.resizeColumnsToContents()
        idx = self.tabs.insertTab(1, self.proc_table, "Processed")
        self.tabs.setTabToolTip(idx, "Processed data")

        # sis
        self.sis_table = QtWidgets.QTableView()
        self.sis_model = SisDataModel(self.lib, table=self)
        self.sis_table.setModel(self.sis_model)
        self.sis_table.resizeColumnsToContents()
        idx = self.tabs.insertTab(2, self.sis_table, "SIS")
        self.tabs.setTabToolTip(idx, "SIS-output data")

        self.mainLayout.addSpacing(8)

        # edit/apply
        hbox = QtWidgets.QHBoxLayout()
        hbox.addStretch()
        self.editable = QtWidgets.QPushButton()
        self.editable.setIconSize(QtCore.QSize(30, 30))
        self.editable.setFixedHeight(34)
        edit_icon = QtGui.QIcon()
        edit_icon.addFile(os.path.join(self.media, 'lock.png'), state=QtGui.QIcon.Off)
        edit_icon.addFile(os.path.join(self.media, 'unlock.png'), state=QtGui.QIcon.On)
        self.editable.setIcon(edit_icon)
        self.editable.setCheckable(True)
        # noinspection PyUnresolvedReferences
        self.editable.clicked.connect(self.on_editable)
        self.editable.setToolTip("Unlock data editing")
        hbox.addWidget(self.editable)
        hbox.addStretch()
        self.mainLayout.addLayout(hbox)

        self.tabs.setCurrentIndex(1)
Ejemplo n.º 5
0
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self,
                                main_win=main_win,
                                lib=lib,
                                parent=parent)

        self.fmt_outputs = list()

        self.setWindowTitle("Switch project")
        self.setMinimumWidth(160)

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)

        # -- label
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        label = QtWidgets.QLabel("Project name:")
        hbox.addWidget(label)
        hbox.addStretch()
        # -- value
        self.load_project = QtWidgets.QComboBox()
        self.load_project.addItems(self.lib.list_projects())
        self.mainLayout.addWidget(self.load_project)
        # -- space
        self.mainLayout.addSpacing(6)
        # -- button
        btn = QtWidgets.QPushButton("Switch")
        self.mainLayout.addWidget(btn)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_load)
Ejemplo n.º 6
0
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self,
                                main_win=main_win,
                                lib=lib,
                                parent=parent)

        self.only_saved = False

        self.fmt_outputs = list()

        self.setWindowTitle("Plot profiles")
        self.setMinimumWidth(160)

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)

        # label
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        label = QtWidgets.QLabel("Select plot product:")
        hbox.addWidget(label)
        hbox.addStretch()
        # buttons
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        self.buttonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        hbox.addWidget(self.buttonBox)
        hbox.addStretch()
        # - profile map
        btn = QtWidgets.QPushButton("Profiles Map")
        self.buttonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_profile_map)
        btn.setToolTip("Create a map with the profile locations")
        # - aggregate plot
        btn = QtWidgets.QPushButton("Aggregate Plot")
        self.buttonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_aggregate_plot)
        btn.setToolTip("Create a plot showing aggregated profiles")
        # - show per-day
        btn = QtWidgets.QPushButton("Plot per-day")
        self.buttonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_show_perday)
        btn.setToolTip("Create per-day plots")
        # - save per-day
        btn = QtWidgets.QPushButton("Save per-day")
        self.buttonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_save_perday)
        btn.setToolTip("Save per-day plots")
Ejemplo n.º 7
0
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self, main_win=main_win, lib=lib, parent=parent)

        self.setWindowTitle("Input data")
        self.botton_min_width = 80

        # outline ui
        self.mainLayout = QtWidgets.QHBoxLayout()
        self.setLayout(self.mainLayout)

        # import data
        self.importLayout = QtWidgets.QVBoxLayout()
        self.mainLayout.addLayout(self.importLayout)
        # - import
        import_hbox = QtWidgets.QHBoxLayout()
        self.importLayout.addLayout(import_hbox)
        import_hbox.addStretch()
        import_label = QtWidgets.QLabel("Import file:")
        import_hbox.addWidget(import_label)
        import_hbox.addStretch()
        # - fmt layout
        self.fmtLayout = QtWidgets.QHBoxLayout()
        self.importLayout.addLayout(self.fmtLayout)
        # -- left
        # noinspection PyUnresolvedReferences
        self.leftButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.fmtLayout.addWidget(self.leftButtonBox)
        # -- middle
        # noinspection PyUnresolvedReferences
        self.midButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.fmtLayout.addWidget(self.midButtonBox)
        # -- right
        # noinspection PyUnresolvedReferences
        self.rightButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.fmtLayout.addWidget(self.rightButtonBox)
        # --- add buttons
        for idx, _ in enumerate(self.lib.name_readers):

            if len(self.lib.ext_readers[idx]) == 0:
                continue

            btn = QtWidgets.QPushButton("%s" % self.lib.desc_readers[idx])
            btn.setToolTip("Import %s format [*.%s]" % (self.lib.desc_readers[idx],
                                                        ", *.".join(self.lib.ext_readers[idx])))
            btn.setMinimumWidth(self.botton_min_width)
            if (idx % 3) == 0:
                self.leftButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
            elif (idx % 3) == 1:
                self.midButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
            else:
                self.rightButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        # noinspection PyUnresolvedReferences
        self.leftButtonBox.clicked.connect(self.on_click_import)
        # noinspection PyUnresolvedReferences
        self.midButtonBox.clicked.connect(self.on_click_import)
        # noinspection PyUnresolvedReferences
        self.rightButtonBox.clicked.connect(self.on_click_import)

        self.mainLayout.addSpacing(18)

        # retrieve data
        self.retrieveLayout = QtWidgets.QVBoxLayout()
        self.mainLayout.addLayout(self.retrieveLayout)
        # - retrieve
        retrieve_hbox = QtWidgets.QHBoxLayout()
        self.retrieveLayout.addLayout(retrieve_hbox)
        retrieve_hbox.addStretch()
        retrieve_label = QtWidgets.QLabel("Retrieve from:")
        retrieve_hbox.addWidget(retrieve_label)
        retrieve_hbox.addStretch()
        # - button box
        # noinspection PyUnresolvedReferences
        self.retrieveButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.retrieveButtonBox.setMinimumWidth(self.botton_min_width)
        self.retrieveLayout.addWidget(self.retrieveButtonBox)
        # add buttons
        # -- current project
        btn = QtWidgets.QPushButton("Project DB")
        self.retrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve profile from current project DB")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_load_db)
        # -- WOA09
        btn = QtWidgets.QPushButton("WOA09 DB")
        self.retrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from WOA09 Atlas")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_woa09)
        # -- WOA13
        btn = QtWidgets.QPushButton("WOA13 DB")
        self.retrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from WOA13 Atlas")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_woa13)
        # -- RTOFS
        btn = QtWidgets.QPushButton("RTOFS")
        self.retrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from RTOFS Atlas")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_rtofs)
        # -- GoMOFS
        btn = QtWidgets.QPushButton("GoMOFS")
        self.retrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from GoMOFS Atlas")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_gomofs)
        # -- SIS4
        btn = QtWidgets.QPushButton("SIS4")
        self.retrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve current profile from SIS4")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_sis4)
        # -- SIS5
        btn = QtWidgets.QPushButton("SIS5")
        self.retrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve current profile from SIS5")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_sis5)
        # -- Seabird CTD
        btn = QtWidgets.QPushButton("Seabird CTD")
        self.retrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve profiles from Seabird CTD")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_seabird_ctd)

        self.retrieveLayout.addStretch()
Ejemplo n.º 8
0
    def __init__(self, title, basename, body, main_win, lib, parent=None, init_size=QtCore.QSize(600, 400)):
        AbstractDialog.__init__(self, main_win=main_win, lib=lib, parent=parent)

        self._title = title
        self.setWindowTitle(self._title)
        self.setMinimumSize(200, 200)
        self.resize(init_size)

        self._basename = basename
        self._body = body

        self._original = str()

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)
        self.mainLayout.setSpacing(0)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.mainWidget = QtWidgets.QMainWindow()
        self.mainLayout.addWidget(self.mainWidget)

        self._editor = TextEditor()
        self.mainWidget.setCentralWidget(self._editor)
        self._editor.set_html_text(body)

        # tool bar
        self._tools_bar = self.mainWidget.addToolBar('Tools')
        self._tools_bar.setIconSize(QtCore.QSize(32, 32))
        self._tools_bar.setAllowedAreas(QtCore.Qt.TopToolBarArea | QtCore.Qt.BottomToolBarArea)

        # lock
        icon = QtGui.QIcon()
        icon.addFile(os.path.join(self.media, 'lock.png'), QtCore.QSize(), QtGui.QIcon.Selected, QtGui.QIcon.Off)
        icon.addFile(os.path.join(self.media, 'unlock.png'), QtCore.QSize(), QtGui.QIcon.Selected, QtGui.QIcon.On)
        self._lock_act = QtWidgets.QAction(icon, 'Lock/unlock editing', self)
        self._lock_act.setCheckable(True)
        self._lock_act.setShortcut('Ctrl+L')
        # noinspection PyUnresolvedReferences
        self._lock_act.triggered.connect(self.on_lock_editing)
        self._tools_bar.addAction(self._lock_act)

        # view
        icon = QtGui.QIcon()
        icon.addFile(os.path.join(self.media, 'html.png'), QtCore.QSize(), QtGui.QIcon.Selected, QtGui.QIcon.Off)
        icon.addFile(os.path.join(self.media, 'text.png'), QtCore.QSize(), QtGui.QIcon.Selected, QtGui.QIcon.On)
        self._view_act = QtWidgets.QAction(icon, 'View as html or raw text', self)
        self._view_act.setCheckable(True)
        self._view_act.setShortcut('Ctrl+T')
        # noinspection PyUnresolvedReferences
        self._view_act.triggered.connect(self.on_view_file)
        self._tools_bar.addAction(self._view_act)

        self._tools_bar.addSeparator()

        # save
        self._save_act = QtWidgets.QAction(QtGui.QIcon(os.path.join(self.media, 'save.png')), 'Save file', self)
        self._save_act.setShortcut('Ctrl+S')
        # noinspection PyUnresolvedReferences
        self._save_act.triggered.connect(self.on_save_file)
        self._tools_bar.addAction(self._save_act)

        self.mainWidget.statusBar().setStyleSheet("QStatusBar{color:rgba(0,0,0,128);font-size: 8pt;}")
        self.status_bar_normal_style = self.mainWidget.statusBar().styleSheet()
        timer = QtCore.QTimer(self)
        # noinspection PyUnresolvedReferences
        timer.timeout.connect(self._update_gui)
        timer.start(400)
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self, main_win=main_win, lib=lib, parent=parent)

        settings = QtCore.QSettings()

        self.setWindowTitle("Profile metadata")
        self.setMinimumWidth(400)

        lbl_width = 90

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)

        # types
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Data type:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.sensor_type = QtWidgets.QLineEdit()
        self.sensor_type.setDisabled(True)
        self.sensor_type.setText(self.lib.cur.meta.sensor)
        hbox.addWidget(self.sensor_type)
        self.probe_type = QtWidgets.QLineEdit()
        self.probe_type.setDisabled(True)
        self.probe_type.setText(self.lib.cur.meta.probe)
        hbox.addWidget(self.probe_type)

        # original path
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Path:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.original_path = QtWidgets.QLineEdit()
        self.original_path.setDisabled(True)
        self.original_path.setText(self.lib.cur.meta.original_path)
        hbox.addWidget(self.original_path)

        # location
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Location:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.latitude = QtWidgets.QLineEdit()
        self.latitude.setDisabled(True)
        self.latitude.setText("%s" % self.lib.cur.meta.latitude)
        hbox.addWidget(self.latitude)
        # noinspection PyUnresolvedReferences
        self.latitude.textChanged.connect(self.changed_latitude)
        self.longitude = QtWidgets.QLineEdit()
        self.longitude.setDisabled(True)
        self.longitude.setText("%s" % self.lib.cur.meta.longitude)
        hbox.addWidget(self.longitude)
        # noinspection PyUnresolvedReferences
        self.longitude.textChanged.connect(self.changed_longitude)

        # datetime
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Timestamp:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.timestamp = QtWidgets.QLineEdit()
        self.timestamp.setDisabled(True)
        self.timestamp.setText(self.lib.cur.meta.utc_time.strftime("%d/%m/%y %H:%M:%S.%f"))
        hbox.addWidget(self.timestamp)
        # noinspection PyUnresolvedReferences
        self.timestamp.textChanged.connect(self.changed_timestamp)

        # last edit
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Last edit:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.proc_time = QtWidgets.QLineEdit()
        self.proc_time.setDisabled(True)
        self.proc_time.setText(self.lib.cur.meta.proc_time.strftime("%d/%m/%y %H:%M:%S.%f"))
        hbox.addWidget(self.proc_time)

        # proc info
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Proc. info:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.proc_info = QtWidgets.QLineEdit()
        self.proc_info.setDisabled(True)
        self.proc_info.setText("%s" % self.lib.cur.meta.proc_info)
        hbox.addWidget(self.proc_info)

        # institution
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Institution:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.institution = QtWidgets.QLineEdit()
        self.institution.setDisabled(True)
        self.institution.setText("%s" % self.lib.cur.meta.institution)
        hbox.addWidget(self.institution)
        self.institution.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.institution.textChanged.connect(self.changed_institution)

        # survey
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Survey:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.survey = QtWidgets.QLineEdit()
        self.survey.setDisabled(True)
        self.survey.setText("%s" % self.lib.cur.meta.survey)
        hbox.addWidget(self.survey)
        self.survey.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.survey.textChanged.connect(self.changed_survey)

        # vessel
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Vessel:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.vessel = QtWidgets.QComboBox()
        self.vessel.setDisabled(True)
        if not lib.setup.noaa_tools:
            self.vessel.setEditable(True)
        self.vessel.addItems(vessel_list)
        if self.lib.cur.meta.vessel and self.vessel.findText(self.lib.cur.meta.vessel) < 0:
            # noinspection PyArgumentList
            self.vessel.insertItem(0, self.lib.cur.meta.vessel)
        self.vessel.setCurrentIndex(self.vessel.findText(self.lib.cur.meta.vessel))
        hbox.addWidget(self.vessel)
        self.vessel.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.vessel.editTextChanged.connect(self.changed_vessel)
        # noinspection PyUnresolvedReferences
        self.vessel.currentIndexChanged.connect(self.changed_vessel)

        # serial number
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("S/N:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.sn = QtWidgets.QLineEdit()
        self.sn.setDisabled(True)
        self.sn.setText("%s" % self.lib.cur.meta.sn)
        hbox.addWidget(self.sn)
        self.sn.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.sn.textChanged.connect(self.changed_sn)

        # surveylines
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Surveylines:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.surveylines = QtWidgets.QTextEdit()
        self.surveylines.setMinimumHeight(24)
        self.surveylines.setMaximumHeight(60)
        self.surveylines.setDisabled(True)
        self.surveylines.setText("%s" % self.lib.cur.meta.surveylines)
        hbox.addWidget(self.surveylines)
        self.surveylines.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.surveylines.textChanged.connect(self.changed_surveylines)

        # comments
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Comments:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.comments = QtWidgets.QTextEdit()
        self.comments.setMinimumHeight(24)
        self.comments.setMaximumHeight(60)
        self.comments.setDisabled(True)
        self.comments.setText("%s" % self.lib.cur.meta.comments)
        hbox.addWidget(self.comments)
        self.comments.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.comments.textChanged.connect(self.changed_comments)

        # pressure uom
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Pressure UoM:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.pressure_uom = QtWidgets.QLineEdit()
        self.pressure_uom.setDisabled(True)
        self.pressure_uom.setText("%s" % self.lib.cur.meta.pressure_uom)
        hbox.addWidget(self.pressure_uom)
        self.pressure_uom.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.pressure_uom.textChanged.connect(self.changed_pressure_uom)

        # depth uom
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("depth UoM:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.depth_uom = QtWidgets.QLineEdit()
        self.depth_uom.setDisabled(True)
        self.depth_uom.setText("%s" % self.lib.cur.meta.depth_uom)
        hbox.addWidget(self.depth_uom)
        self.depth_uom.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.depth_uom.textChanged.connect(self.changed_depth_uom)

        # speed uom
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("speed UoM:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.speed_uom = QtWidgets.QLineEdit()
        self.speed_uom.setDisabled(True)
        self.speed_uom.setText("%s" % self.lib.cur.meta.speed_uom)
        hbox.addWidget(self.speed_uom)
        self.speed_uom.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.speed_uom.textChanged.connect(self.changed_speed_uom)

        # temperature uom
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("temperature UoM:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.temperature_uom = QtWidgets.QLineEdit()
        self.temperature_uom.setDisabled(True)
        self.temperature_uom.setText("%s" % self.lib.cur.meta.temperature_uom)
        hbox.addWidget(self.temperature_uom)
        self.temperature_uom.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.temperature_uom.textChanged.connect(self.changed_temperature_uom)

        # conductivity uom
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("conductivity UoM:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.conductivity_uom = QtWidgets.QLineEdit()
        self.conductivity_uom.setDisabled(True)
        self.conductivity_uom.setText("%s" % self.lib.cur.meta.conductivity_uom)
        hbox.addWidget(self.conductivity_uom)
        self.conductivity_uom.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.conductivity_uom.textChanged.connect(self.changed_conductivity_uom)

        # salinity uom
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("salinity UoM:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.salinity_uom = QtWidgets.QLineEdit()
        self.salinity_uom.setDisabled(True)
        self.salinity_uom.setText("%s" % self.lib.cur.meta.salinity_uom)
        hbox.addWidget(self.salinity_uom)
        self.salinity_uom.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.salinity_uom.textChanged.connect(self.changed_salinity_uom)

        self.mainLayout.addStretch()

        # edit/apply
        hbox = QtWidgets.QHBoxLayout()
        hbox.addStretch()
        self.editable = QtWidgets.QPushButton()
        self.editable.setIconSize(QtCore.QSize(30, 30))
        self.editable.setFixedHeight(34)
        edit_icon = QtGui.QIcon()
        edit_icon.addFile(os.path.join(self.media, 'lock.png'), state=QtGui.QIcon.Off)
        edit_icon.addFile(os.path.join(self.media, 'unlock.png'), state=QtGui.QIcon.On)
        self.editable.setIcon(edit_icon)
        self.editable.setCheckable(True)
        # noinspection PyUnresolvedReferences
        self.editable.clicked.connect(self.on_editable)
        self.editable.setToolTip("Unlock metadata editing")
        hbox.addWidget(self.editable)
        # --
        self.load_default = QtWidgets.QPushButton("Load default")
        self.load_default.setFixedHeight(self.editable.height())
        self.load_default.setDisabled(True)
        # noinspection PyUnresolvedReferences
        self.load_default.clicked.connect(self.on_load_default)
        self.load_default.setToolTip("Load default metadata (if any)")
        hbox.addWidget(self.load_default)
        # --
        if self.lib.ssp.loaded_from_db:
            self.apply = QtWidgets.QPushButton("Apply and save")
        else:
            self.apply = QtWidgets.QPushButton("Apply")
        self.apply.setFixedHeight(self.editable.height())
        self.apply.setDisabled(True)
        # noinspection PyUnresolvedReferences
        self.apply.clicked.connect(self.on_apply)
        if self.lib.ssp.loaded_from_db:
            self.apply.setToolTip("Apply changes (if any) and store them in the database")
        else:
            self.apply.setToolTip("Apply changes (if any)")
        hbox.addWidget(self.apply)
        # --
        self.show_at_import = QtWidgets.QPushButton("Show at Import")
        self.show_at_import.setFixedHeight(self.editable.height())
        self.show_at_import.setCheckable(True)
        if settings.value("show_metadata_at_import") == 'true':
            self.show_at_import.setChecked(True)
        else:
            self.show_at_import.setChecked(False)
        # noinspection PyUnresolvedReferences
        self.show_at_import.clicked.connect(self.on_show_at_import)
        self.show_at_import.setToolTip("Show metadata at each cast import")
        hbox.addWidget(self.show_at_import)
        hbox.addStretch()
        self.mainLayout.addLayout(hbox)
Ejemplo n.º 10
0
    def __init__(self, main_win, lib, pks, parent=None):
        AbstractDialog.__init__(self,
                                main_win=main_win,
                                lib=lib,
                                parent=parent)

        # check the passed primary keys
        if type(pks) is not list:
            raise RuntimeError(
                "The dialog takes a list of primary keys, not %s" % type(pks))
        if len(pks) < 2:
            raise RuntimeError(
                "The dialog takes a list of at least 2 primary keys, not %s" %
                len(pks))
        self._pks = pks

        # the list of selected writers passed to the library
        self.selected_writers = list()

        self.setWindowTitle("Plot multiple profiles")
        self.setMinimumWidth(160)

        self.f_dpi = 120  # dots-per-inch
        self.f_sz = (3.0, 6.0)  # inches

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)

        # plot sound speed
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        btn = QtWidgets.QPushButton("Plot sound speed")
        btn.setFixedWidth(200)
        btn.setMinimumHeight(32)
        hbox.addWidget(btn)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_plot_sound_speed)
        hbox.addStretch()

        # plot temp
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        btn = QtWidgets.QPushButton("Plot temperature")
        btn.setFixedWidth(200)
        btn.setMinimumHeight(32)
        hbox.addWidget(btn)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_plot_temperature)
        hbox.addStretch()

        # plot sal
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        btn = QtWidgets.QPushButton("Plot salinity")
        btn.setFixedWidth(200)
        btn.setMinimumHeight(32)
        hbox.addWidget(btn)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_plot_salinity)
        hbox.addStretch()
Ejemplo n.º 11
0
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self,
                                main_win=main_win,
                                lib=lib,
                                parent=parent)

        self.setWindowTitle("Reference cast")

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)

        # set reference
        self.setRefLayout = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(self.setRefLayout)
        # - label
        label = QtWidgets.QLabel("Set current profile as reference cast")
        self.setRefLayout.addWidget(label)
        # - button
        btn = QtWidgets.QPushButton("Apply")
        btn.setToolTip("Apply!")
        btn.setFixedWidth(60)
        if not self.lib.has_ssp():
            btn.setDisabled(True)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_set_ref)
        self.setRefLayout.addWidget(btn)

        # load reference
        self.loadLayout = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(self.loadLayout)
        # - label
        label = QtWidgets.QLabel("Reload reference cast as current profile")
        self.loadLayout.addWidget(label)
        # - button
        btn = QtWidgets.QPushButton("Apply")
        btn.setToolTip("Apply!")
        btn.setFixedWidth(60)
        if not self.lib.has_ref():
            btn.setDisabled(True)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_reload_ref)
        self.loadLayout.addWidget(btn)

        # clear reference
        self.clearLayout = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(self.clearLayout)
        # - label
        label = QtWidgets.QLabel("Clear current reference cast")
        self.clearLayout.addWidget(label)
        # - button
        btn = QtWidgets.QPushButton("Apply")
        btn.setToolTip("Apply!")
        btn.setFixedWidth(60)
        if not self.lib.has_ref():
            btn.setDisabled(True)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_clear_ref)
        self.clearLayout.addWidget(btn)

        self.mainLayout.addSpacing(12)
    def __init__(self, main_win, lib, pks, parent=None):
        AbstractDialog.__init__(self,
                                main_win=main_win,
                                lib=lib,
                                parent=parent)

        self.pks = pks

        self.setWindowTitle("Edit common metadata fields")
        self.setMinimumWidth(400)

        lbl_width = 90

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)

        # institution
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Institution:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.institution = QtWidgets.QComboBox()
        if not lib.setup.noaa_tools:
            self.institution.setEditable(True)
        self.institution.addItems(institution_list)
        # noinspection PyArgumentList
        self.institution.insertItem(0, "")
        self.institution.setCurrentIndex(self.institution.findText(""))
        hbox.addWidget(self.institution)
        self.institution.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.institution.editTextChanged.connect(self.changed_institution)
        # noinspection PyUnresolvedReferences
        self.institution.currentIndexChanged.connect(self.changed_institution)

        # survey
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Survey:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.survey = QtWidgets.QLineEdit()
        hbox.addWidget(self.survey)
        self.survey.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.survey.textChanged.connect(self.changed_survey)

        # vessel
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Vessel:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.vessel = QtWidgets.QComboBox()
        if not lib.setup.noaa_tools:
            self.vessel.setEditable(True)
        self.vessel.addItems(vessel_list)
        # noinspection PyArgumentList
        self.vessel.insertItem(0, "")
        self.vessel.setCurrentIndex(self.vessel.findText(""))
        hbox.addWidget(self.vessel)
        self.vessel.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.vessel.editTextChanged.connect(self.changed_vessel)
        # noinspection PyUnresolvedReferences
        self.vessel.currentIndexChanged.connect(self.changed_vessel)

        # serial number
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("S/N:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.sn = QtWidgets.QLineEdit()
        hbox.addWidget(self.sn)
        self.sn.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.sn.textChanged.connect(self.changed_sn)

        # comments
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        label = QtWidgets.QLabel("Comments:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        self.comments = QtWidgets.QTextEdit()
        self.comments.setMinimumHeight(24)
        self.comments.setMaximumHeight(60)
        hbox.addWidget(self.comments)
        self.comments.setAutoFillBackground(True)
        # noinspection PyUnresolvedReferences
        self.comments.textChanged.connect(self.changed_comments)

        self.mainLayout.addStretch()
        self.mainLayout.addSpacing(8)

        # edit/apply
        hbox = QtWidgets.QHBoxLayout()
        hbox.addStretch()
        # --
        self.load_default = QtWidgets.QPushButton("Load default")
        self.load_default.setFixedHeight(30)
        self.load_default.setFixedWidth(90)
        # noinspection PyUnresolvedReferences
        self.load_default.clicked.connect(self.on_load_default)
        self.load_default.setToolTip("Load default metadata (if any)")
        hbox.addWidget(self.load_default)
        # --
        self.apply = QtWidgets.QPushButton("Apply")
        self.apply.setFixedHeight(self.load_default.height())
        self.apply.setFixedWidth(self.load_default.width())
        # noinspection PyUnresolvedReferences
        self.apply.clicked.connect(self.on_apply)
        self.apply.setToolTip("Apply changes (if any)")
        hbox.addWidget(self.apply)
        # --
        self.cancel = QtWidgets.QPushButton("Cancel")
        self.cancel.setFixedHeight(self.load_default.height())
        self.cancel.setFixedWidth(self.load_default.width())
        # noinspection PyUnresolvedReferences
        self.cancel.clicked.connect(self.reject)
        self.cancel.setToolTip("Not apply changes")
        hbox.addWidget(self.cancel)
        hbox.addStretch()
        self.mainLayout.addLayout(hbox)
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self,
                                main_win=main_win,
                                lib=lib,
                                parent=parent)

        self.fmt_outputs = list()

        self.setWindowTitle("Export metadata profiles")
        self.setMinimumWidth(160)

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)

        # label
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        label = QtWidgets.QLabel("Select output formats:")
        hbox.addWidget(label)
        hbox.addStretch()
        # buttons
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        # noinspection PyUnresolvedReferences
        self.buttonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        hbox.addWidget(self.buttonBox)
        hbox.addStretch()
        # add buttons
        for fmt in GdalAux.ogr_formats.keys():
            btn = QtWidgets.QPushButton("%s" % fmt)
            btn.setCheckable(True)
            self.buttonBox.addButton(btn,
                                     QtWidgets.QDialogButtonBox.ActionRole)
            btn.setToolTip("Select %s format [*.%s]" %
                           (fmt, ", *.".join(GdalAux.ogr_exts[fmt])))

        # noinspection PyUnresolvedReferences
        self.buttonBox.clicked.connect(self.on_select_btn)

        # option for opening the output folder
        settings = QtCore.QSettings()
        export_filter_fields = settings.value("export_filter_fields")
        if export_filter_fields is None:
            settings.setValue("export_filter_fields", False)
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        self.filterFields = QtWidgets.QCheckBox('Filter fields', self)
        self.filterFields.setChecked(
            settings.value("export_filter_fields") == 'true')
        hbox.addWidget(self.filterFields)
        hbox.addStretch()

        self.mainLayout.addSpacing(16)

        # export
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        btn = QtWidgets.QPushButton("Export data")
        btn.setMinimumHeight(36)
        hbox.addWidget(btn)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_export_btn)
        hbox.addStretch()
    def __init__(self, main_win, lib, writers, parent=None):
        AbstractDialog.__init__(self,
                                main_win=main_win,
                                lib=lib,
                                parent=parent)

        # check the passed list writers
        if type(writers) is not list:
            raise RuntimeError("The dialog takes a list of writers, not %s" %
                               type(writers))
        if len(writers) < 1:
            raise RuntimeError(
                "The dialog takes a list with at least 1 writer, not %s" %
                len(writers))
        self._writers = writers

        # a dict of output folders (one for each writer)
        self.output_folders = dict()

        self.setWindowTitle("Output folders")
        self.setMinimumWidth(420)

        settings = QtCore.QSettings()

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)

        # label
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        label = QtWidgets.QLabel(
            "Click on the format name to change its output folder:")
        hbox.addWidget(label)
        hbox.addStretch()

        self.mainLayout.addSpacing(3)

        self.paths = dict()
        for writer in writers:
            output_folder = settings.value("output_folder_%s" % writer)
            if output_folder is None:
                settings.setValue("output_folder_%s" % writer,
                                  self.lib.outputs_folder)
                output_folder = self.lib.outputs_folder
            if not os.path.exists(output_folder):
                settings.setValue("output_folder_%s" % writer,
                                  self.lib.outputs_folder)
                output_folder = self.lib.outputs_folder

            # buttons
            hbox = QtWidgets.QHBoxLayout()
            self.mainLayout.addLayout(hbox)
            # hbox.addStretch()
            btn = QtWidgets.QPushButton("%s" % writer)
            btn.setToolTip("Select output folder for %s format" % (writer, ))
            btn.setMinimumWidth(80)
            # noinspection PyUnresolvedReferences
            btn.clicked.connect(self.on_change_folder)
            hbox.addWidget(btn)
            path = QtWidgets.QLineEdit("%s" % output_folder)
            path.setReadOnly(True)
            path.setMinimumWidth(200)
            hbox.addWidget(path)
            self.paths[writer] = path
            # hbox.addStretch()

        self.mainLayout.addStretch()

        # apply
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        btn = QtWidgets.QPushButton("Apply")
        btn.setMinimumHeight(32)
        hbox.addWidget(btn)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_apply)
        hbox.addStretch()

        self.mainLayout.addStretch()
Ejemplo n.º 15
0
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self,
                                main_win=main_win,
                                lib=lib,
                                parent=parent)

        settings = QtCore.QSettings()

        self.setWindowTitle("Automated Processing Setup")
        self.setMinimumWidth(300)

        self.botton_min_width = 80
        lbl_width = 180

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)

        # input file formats
        self.importLayout = QtWidgets.QVBoxLayout()
        self.mainLayout.addLayout(self.importLayout)
        # - import
        import_hbox = QtWidgets.QHBoxLayout()
        self.importLayout.addLayout(import_hbox)
        import_hbox.addStretch()
        import_label = QtWidgets.QLabel("Input file format:")
        import_hbox.addWidget(import_label)
        import_hbox.addStretch()
        # - fmt layout
        self.fmtLayout = QtWidgets.QHBoxLayout()
        self.importLayout.addLayout(self.fmtLayout)
        # -- left
        self.leftButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.fmtLayout.addWidget(self.leftButtonBox)
        # -- middle
        self.midButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.fmtLayout.addWidget(self.midButtonBox)
        # -- right
        self.rightButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.fmtLayout.addWidget(self.rightButtonBox)
        # --- add "Ask user"
        ask_label = "Ask user"
        btn = QtWidgets.QPushButton(ask_label)
        btn.setToolTip("Ask user for input format")
        btn.setMinimumWidth(self.botton_min_width)
        btn.setCheckable(True)
        if settings.value("default_input_format") is None:
            btn.setChecked(True)
        elif settings.value("default_input_format") == ask_label:
            btn.setChecked(True)
        self.leftButtonBox.addButton(btn,
                                     QtWidgets.QDialogButtonBox.ActionRole)
        # --- add buttons
        idx_reminder = 0
        for idx, _ in enumerate(self.lib.name_readers):

            if len(self.lib.ext_readers[idx]) == 0:
                continue

            btn = QtWidgets.QPushButton("%s" % self.lib.desc_readers[idx])
            btn.setToolTip("Import %s format [*.%s]" %
                           (self.lib.desc_readers[idx], ", *.".join(
                               self.lib.ext_readers[idx])))
            btn.setMinimumWidth(self.botton_min_width)
            btn.setCheckable(True)
            if settings.value(
                    "default_input_format") == self.lib.desc_readers[idx]:
                btn.setChecked(True)

            idx_reminder = idx % 3
            if idx_reminder == 2:
                self.leftButtonBox.addButton(
                    btn, QtWidgets.QDialogButtonBox.ActionRole)
            elif idx_reminder == 0:
                self.midButtonBox.addButton(
                    btn, QtWidgets.QDialogButtonBox.ActionRole)
            else:
                self.rightButtonBox.addButton(
                    btn, QtWidgets.QDialogButtonBox.ActionRole)
        # --- add Seabird CTD
        seabird_ctd_label = "Seabird CTD"
        btn = QtWidgets.QPushButton(seabird_ctd_label)
        btn.setToolTip("Retrieve profiles from Seabird CTD")
        btn.setMinimumWidth(self.botton_min_width)
        btn.setCheckable(True)
        if settings.value("default_input_format") == seabird_ctd_label:
            btn.setChecked(True)
        if idx_reminder == 1:
            self.leftButtonBox.addButton(btn,
                                         QtWidgets.QDialogButtonBox.ActionRole)
        elif idx_reminder == 2:
            self.midButtonBox.addButton(btn,
                                        QtWidgets.QDialogButtonBox.ActionRole)
        else:
            self.rightButtonBox.addButton(
                btn, QtWidgets.QDialogButtonBox.ActionRole)
        # noinspection PyUnresolvedReferences
        self.leftButtonBox.clicked.connect(self.on_input_format)
        # noinspection PyUnresolvedReferences
        self.midButtonBox.clicked.connect(self.on_input_format)
        # noinspection PyUnresolvedReferences
        self.rightButtonBox.clicked.connect(self.on_input_format)

        self.mainLayout.addSpacing(18)

        # auto apply
        self.applyLayout = QtWidgets.QVBoxLayout()
        self.mainLayout.addLayout(self.applyLayout)
        apply_hbox = QtWidgets.QHBoxLayout()
        self.applyLayout.addLayout(apply_hbox)
        apply_hbox.addStretch()
        apply_label = QtWidgets.QLabel("Auto apply:")
        apply_hbox.addWidget(apply_label)
        apply_hbox.addStretch()

        # - smooth/filter data
        hbox = QtWidgets.QHBoxLayout()
        self.applyLayout.addLayout(hbox)
        # -- label
        label = QtWidgets.QLabel("Smooth/filter profile data:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        # -- label
        self.smooth_filter = QtWidgets.QComboBox()
        self.smooth_filter.addItems(["True", "False"])
        if settings.value("auto_smooth_filter") == "true":
            self.smooth_filter.setCurrentIndex(0)
        else:
            self.smooth_filter.setCurrentIndex(1)
        # noinspection PyUnresolvedReferences
        self.smooth_filter.currentIndexChanged.connect(
            self.changed_smooth_filter)
        hbox.addWidget(self.smooth_filter)

        # - salinity/temperature
        hbox = QtWidgets.QHBoxLayout()
        self.applyLayout.addLayout(hbox)
        # -- label
        label = QtWidgets.QLabel("Retrieve salinity/temperature:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        # -- label
        self.sal_temp = QtWidgets.QComboBox()
        self.sal_temp.addItems(["True", "False"])
        if settings.value("auto_sal_temp") == "true":
            self.sal_temp.setCurrentIndex(0)
        else:
            self.sal_temp.setCurrentIndex(1)
        # noinspection PyUnresolvedReferences
        self.sal_temp.currentIndexChanged.connect(self.changed_sal_temp)
        hbox.addWidget(self.sal_temp)

        # - TSS
        hbox = QtWidgets.QHBoxLayout()
        self.applyLayout.addLayout(hbox)
        # -- label
        label = QtWidgets.QLabel("Retrieve transducer sound speed:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        # -- label
        self.tss = QtWidgets.QComboBox()
        self.tss.addItems(["True", "False"])
        if settings.value("auto_tss") == "true":
            self.tss.setCurrentIndex(0)
        else:
            self.tss.setCurrentIndex(1)
        # noinspection PyUnresolvedReferences
        self.tss.currentIndexChanged.connect(self.changed_tss)
        hbox.addWidget(self.tss)

        # - extend
        hbox = QtWidgets.QHBoxLayout()
        self.applyLayout.addLayout(hbox)
        # -- label
        label = QtWidgets.QLabel("Extend profile data:")
        label.setFixedWidth(lbl_width)
        hbox.addWidget(label)
        # -- label
        self.extend = QtWidgets.QComboBox()
        self.extend.addItems(["True", "False"])
        if settings.value("auto_extend") == "true":
            self.extend.setCurrentIndex(0)
        else:
            self.extend.setCurrentIndex(1)
        # noinspection PyUnresolvedReferences
        self.extend.currentIndexChanged.connect(self.changed_extend)
        hbox.addWidget(self.extend)

        self.mainLayout.addStretch()

        # edit/apply
        hbox = QtWidgets.QHBoxLayout()
        hbox.addStretch()
        self.apply = QtWidgets.QPushButton("OK")
        self.apply.setFixedWidth(40)
        # noinspection PyUnresolvedReferences
        self.apply.clicked.connect(self.on_apply)
        hbox.addWidget(self.apply)
        hbox.addStretch()
        self.mainLayout.addLayout(hbox)
Ejemplo n.º 16
0
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self,
                                main_win=main_win,
                                lib=lib,
                                parent=parent)

        self.setWindowTitle("Import data from Sea-Bird SeaCAT CTD")
        self.setMinimumWidth(220)

        # create the overall layout
        self.main_layout = QtWidgets.QVBoxLayout()
        self.setLayout(self.main_layout)

        # info box
        hbox = QtWidgets.QHBoxLayout()
        self.main_layout.addLayout(hbox)
        hbox.addStretch()
        self.group_box = QtWidgets.QGroupBox("SeaCAT")
        self.group_box.setMaximumHeight(120)
        self.group_box.setFixedWidth(500)
        hbox.addWidget(self.group_box)
        hbox.addStretch()

        # image and text
        group_layout = QtWidgets.QHBoxLayout()
        self.group_box.setLayout(group_layout)
        group_layout.addStretch()
        # - image
        img_label = QtWidgets.QLabel()
        img = QtGui.QImage(os.path.join(self.media, 'seacat.png'))
        if img.isNull():
            raise RuntimeError("unable to open seacat image")
        # noinspection PyArgumentList
        img_label.setPixmap(QtGui.QPixmap.fromImage(img))
        group_layout.addWidget(img_label)
        # - text
        info_label = QtWidgets.QLabel(
            "This tool allows to directly interact with a SeaCAT instrument.\n\n"
            "The tool communicates by serial port with the sensor and makes\n"
            "possible to directly download the collected profiles.")
        info_label.setStyleSheet("color: #96A8A8;")
        info_label.setWordWrap(True)
        group_layout.addWidget(info_label)
        group_layout.addStretch()

        hbox4 = QtWidgets.QHBoxLayout()
        self.main_layout.addLayout(hbox4)
        hbox4.addStretch()  # spacer on left
        add_btn("Download All", self.on_download_all,
                "Retrieve and convert all casts in memory", hbox4)
        add_btn("Download Selected", self.on_download_selected,
                "Retrieve and convert selected casts in memory", hbox4)
        add_btn("Download Last Cast", self.on_download_last,
                "Retrieve and convert last cast in memory", hbox4)

        hbox4.addStretch()  # spacer on right

        hbox2 = QtWidgets.QHBoxLayout()
        self.main_layout.addLayout(hbox2)
        hbox2.addStretch()  # spacer on left
        add_btn("COMPORT", self.on_choose_comport,
                "Select a COM port to use with seacat", hbox2)
        add_btn("Status", self.on_status, "Retrieve and display Seacat status",
                hbox2)
        add_btn("Headers", self.on_headers,
                "Retrieve and display Seacat stored cast summary information",
                hbox2)
        add_btn("Set UTC Time", self.on_settime,
                "Set the clock on Seacat with current time in UTC", hbox2)
        add_btn("Precast Setup", self.on_precast,
                "Clear the seacat memory and reset clock (if needed)", hbox2)

        hbox2.addStretch()  # spacer on right

        hbox3 = QtWidgets.QHBoxLayout()
        self.main_layout.addLayout(hbox3)
        hbox3.addStretch()  # spacer on left
        lbl = QtWidgets.QLabel("Last used COM port info:", self)
        hbox3.addWidget(lbl)
        self.com_label = QtWidgets.QLabel("", self)
        hbox3.addWidget(self.com_label)
        hbox3.addStretch()  # spacer on right

        self.main_layout.addStretch()
Ejemplo n.º 17
0
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self,
                                main_win=main_win,
                                lib=lib,
                                parent=parent)

        self.setWindowTitle("Import multiple profiles")
        self.botton_min_width = 80

        # outline ui
        self.mainLayout = QtWidgets.QHBoxLayout()
        self.setLayout(self.mainLayout)

        # import data
        self.importLayout = QtWidgets.QVBoxLayout()
        self.mainLayout.addLayout(self.importLayout)
        # - import
        import_hbox = QtWidgets.QHBoxLayout()
        self.importLayout.addLayout(import_hbox)
        import_hbox.addStretch()
        import_label = QtWidgets.QLabel("Cast formats:")
        import_hbox.addWidget(import_label)
        import_hbox.addStretch()
        # - fmt layout
        self.fmtLayout = QtWidgets.QHBoxLayout()
        self.importLayout.addLayout(self.fmtLayout)
        # -- left
        self.leftButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.fmtLayout.addWidget(self.leftButtonBox)
        # -- middle
        self.midButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.fmtLayout.addWidget(self.midButtonBox)
        # -- right
        self.rightButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.fmtLayout.addWidget(self.rightButtonBox)
        # --- add buttons
        for idx, _ in enumerate(self.lib.name_readers):

            if len(self.lib.ext_readers[idx]) == 0:
                continue

            btn = QtWidgets.QPushButton("%s" % self.lib.desc_readers[idx])
            btn.setToolTip("Import %s format [*.%s]" %
                           (self.lib.desc_readers[idx], ", *.".join(
                               self.lib.ext_readers[idx])))
            btn.setMinimumWidth(self.botton_min_width)
            if (idx % 3) == 0:
                self.leftButtonBox.addButton(
                    btn, QtWidgets.QDialogButtonBox.ActionRole)
            elif (idx % 3) == 1:
                self.midButtonBox.addButton(
                    btn, QtWidgets.QDialogButtonBox.ActionRole)
            else:
                self.rightButtonBox.addButton(
                    btn, QtWidgets.QDialogButtonBox.ActionRole)
        # noinspection PyUnresolvedReferences
        self.leftButtonBox.clicked.connect(self.on_click_import)
        # noinspection PyUnresolvedReferences
        self.midButtonBox.clicked.connect(self.on_click_import)
        # noinspection PyUnresolvedReferences
        self.rightButtonBox.clicked.connect(self.on_click_import)
Ejemplo n.º 18
0
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self, main_win=main_win, lib=lib, parent=parent)

        self.setWindowTitle("Input data")
        self.botton_min_width = 80

        # outline ui
        self.mainLayout = QtWidgets.QHBoxLayout()
        self.setLayout(self.mainLayout)

        # import data
        self.importLayout = QtWidgets.QVBoxLayout()
        self.mainLayout.addLayout(self.importLayout)
        # - import
        import_hbox = QtWidgets.QHBoxLayout()
        self.importLayout.addLayout(import_hbox)
        import_hbox.addStretch()
        import_label = QtWidgets.QLabel("Import file:")
        import_hbox.addWidget(import_label)
        import_hbox.addStretch()
        # - fmt layout
        self.fmtLayout = QtWidgets.QHBoxLayout()
        self.importLayout.addLayout(self.fmtLayout)
        # -- left
        # noinspection PyUnresolvedReferences
        self.leftButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.fmtLayout.addWidget(self.leftButtonBox)
        # -- middle
        # noinspection PyUnresolvedReferences
        self.midButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.fmtLayout.addWidget(self.midButtonBox)
        # -- right
        # noinspection PyUnresolvedReferences
        self.rightButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.fmtLayout.addWidget(self.rightButtonBox)
        # --- add buttons
        for idx, _ in enumerate(self.lib.name_readers):

            if len(self.lib.ext_readers[idx]) == 0:
                continue

            btn = QtWidgets.QPushButton("%s" % self.lib.desc_readers[idx])
            btn.setToolTip("Import %s format [*.%s]" % (self.lib.desc_readers[idx],
                                                        ", *.".join(self.lib.ext_readers[idx])))
            btn.setMinimumWidth(self.botton_min_width)
            if (idx % 3) == 0:
                self.leftButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
            elif (idx % 3) == 1:
                self.midButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
            else:
                self.rightButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        # noinspection PyUnresolvedReferences
        self.leftButtonBox.clicked.connect(self.on_click_import)
        # noinspection PyUnresolvedReferences
        self.midButtonBox.clicked.connect(self.on_click_import)
        # noinspection PyUnresolvedReferences
        self.rightButtonBox.clicked.connect(self.on_click_import)

        self.mainLayout.addSpacing(36)

        # retrieve data
        self.retrieveLayout = QtWidgets.QVBoxLayout()
        self.mainLayout.addLayout(self.retrieveLayout)
        # - retrieve Label
        retrieve_hbox = QtWidgets.QHBoxLayout()
        self.retrieveLayout.addLayout(retrieve_hbox)
        retrieve_hbox.addStretch()
        retrieve_label = QtWidgets.QLabel("Retrieve from:")
        retrieve_hbox.addWidget(retrieve_label)
        retrieve_hbox.addStretch()
        # - retrieve Sources
        self.retrieveSources = QtWidgets.QHBoxLayout()
        self.retrieveLayout.addLayout(self.retrieveSources)

        # -- left button box
        # noinspection PyUnresolvedReferences
        self.leftRetrieveButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.leftRetrieveButtonBox.setMinimumWidth(self.botton_min_width)
        self.retrieveSources.addWidget(self.leftRetrieveButtonBox)

        # --- add buttons
        # ---- current project
        btn = QtWidgets.QPushButton("Project DB")
        self.leftRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve profile from current project DB")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_load_db)
        # ---- SIS4
        btn = QtWidgets.QPushButton("SIS")
        self.leftRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve current profile from SIS")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_sis)
        # ---- Seabird CTD
        btn = QtWidgets.QPushButton("Seabird CTD")
        self.leftRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve profiles from Seabird CTD")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_seabird_ctd)
        # --- WOA09
        btn = QtWidgets.QPushButton("WOA09 DB")
        self.leftRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from WOA09 Atlas")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_woa09)
        # --- WOA13
        btn = QtWidgets.QPushButton("WOA13 DB")
        self.leftRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from WOA13 Atlas")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_woa13)
        # -- Offline OFS
        btn = QtWidgets.QPushButton("OFS .nc")
        self.leftRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from RegOFS .nc files")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_offofs)
        # ---- RTOFS
        btn = QtWidgets.QPushButton("RTOFS")
        self.leftRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from RTOFS Atlas")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_rtofs)

        # -- mid button box
        # noinspection PyUnresolvedReferences
        self.midRetrieveButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.midRetrieveButtonBox.setMinimumWidth(self.botton_min_width)
        self.retrieveSources.addWidget(self.midRetrieveButtonBox)

        # --- add buttons
        # ---- CBOFS
        btn = QtWidgets.QPushButton("CBOFS")
        self.midRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from CBOFS Atlas")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_cbofs)
        # ---- CREOFS
        btn = QtWidgets.QPushButton("CREOFS")
        self.midRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from CREOFS Atlas")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_creofs)
        # ---- DBOFS
        btn = QtWidgets.QPushButton("DBOFS")
        self.midRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from DBOFS Atlas")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_dbofs)
        # ---- GoMOFS
        btn = QtWidgets.QPushButton("GoMOFS")
        self.midRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from GoMOFS Atlas")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_gomofs)
        # ---- LEOFS
        btn = QtWidgets.QPushButton("LEOFS")
        self.midRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from LEOFS Atlas")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_leofs)
        # ---- LHOFS
        btn = QtWidgets.QPushButton("LHOFS")
        self.midRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from LHOFS Atlas")
        # TODO: Add support for Regional OFS without regular grids
        btn.setDisabled(True)
        # -- LMOFS
        btn = QtWidgets.QPushButton("LMOFS")
        self.midRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from LMOFS Atlas")
        # TODO: Add support for Regional OFS without regular grids
        btn.setDisabled(True)

        # --- right button box
        # noinspection PyUnresolvedReferences
        self.rightRetrieveButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.rightRetrieveButtonBox.setMinimumWidth(self.botton_min_width)
        self.retrieveSources.addWidget(self.rightRetrieveButtonBox)
        # ---- LOOFS
        btn = QtWidgets.QPushButton("LOOFS")
        self.rightRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from LOOFS Atlas")
        # TODO: Add support for Regional OFS without regular grids
        btn.setDisabled(True)
        # -- LSOFS
        btn = QtWidgets.QPushButton("LSOFS")
        self.rightRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from LSOFS Atlas")
        # TODO: Add support for Regional OFS without regular grids
        btn.setDisabled(True)
        # -- NGOFS
        btn = QtWidgets.QPushButton("NGOFS")
        self.rightRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from NGOFS Atlas")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_ngofs)
        # -- NYOFS
        btn = QtWidgets.QPushButton("NYOFS")
        self.rightRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from NYOFS Atlas")
        # TODO: Add support for Regional OFS without regular grids
        btn.setDisabled(True)
        # -- SFBOFS
        btn = QtWidgets.QPushButton("SFBOFS")
        self.rightRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from SFBOFS Atlas")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_sfbofs)
        # -- SJROFS
        btn = QtWidgets.QPushButton("SJROFS")
        self.rightRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from SJROFS Atlas")
        # TODO: Add support for Regional OFS without regular grids
        btn.setDisabled(True)
        # -- TBOFS
        btn = QtWidgets.QPushButton("TBOFS")
        self.rightRetrieveButtonBox.addButton(btn, QtWidgets.QDialogButtonBox.ActionRole)
        btn.setToolTip("Retrieve synthetic data from TBOFS Atlas")
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_click_tbofs)

        self.retrieveLayout.addStretch()
Ejemplo n.º 19
0
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self,
                                main_win=main_win,
                                lib=lib,
                                parent=parent)

        # the list of selected writers passed to the library
        self.selected_writers = list()

        self.setWindowTitle("Export single profile")
        self.setMinimumWidth(160)

        settings = QtCore.QSettings()

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)

        # label
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        label = QtWidgets.QLabel("Select output formats:")
        hbox.addWidget(label)
        hbox.addStretch()
        # buttons
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        # - fmt layout
        self.fmtLayout = QtWidgets.QHBoxLayout()
        hbox.addLayout(self.fmtLayout)
        # -- left
        self.leftButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.leftButtonBox.setFixedWidth(100)
        self.fmtLayout.addWidget(self.leftButtonBox)
        # -- right
        self.rightButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.rightButtonBox.setFixedWidth(100)
        self.fmtLayout.addWidget(self.rightButtonBox)
        hbox.addStretch()
        # add buttons (retrieving name, description and extension from the library)
        for idx, name in enumerate(self.lib.name_writers):

            if len(self.lib.ext_writers[idx]) == 0:
                continue

            btn = QtWidgets.QPushButton("%s" % self.lib.desc_writers[idx])
            btn.setCheckable(True)
            btn.setToolTip("Select %s format [*.%s]" %
                           (self.lib.desc_writers[idx], ", *.".join(
                               self.lib.ext_writers[idx])))

            btn_settings = settings.value("export_single_%s" % name)
            if btn_settings is None:
                settings.setValue("export_single_%s" % name, False)
            if settings.value("export_single_%s" % name) == 'true':
                btn.setChecked(True)
                self.selected_writers.append(name)

            if (idx % 2) == 0:
                self.leftButtonBox.addButton(
                    btn, QtWidgets.QDialogButtonBox.ActionRole)
            else:
                self.rightButtonBox.addButton(
                    btn, QtWidgets.QDialogButtonBox.ActionRole)

        # noinspection PyUnresolvedReferences
        self.leftButtonBox.clicked.connect(self.on_select_writer_btn)
        # noinspection PyUnresolvedReferences
        self.rightButtonBox.clicked.connect(self.on_select_writer_btn)

        self.mainLayout.addSpacing(16)

        # option for selecting the output folder
        select_output_folder = settings.value("select_output_folder")
        if select_output_folder is None:
            settings.setValue("select_output_folder", False)
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        self.selectFolder = QtWidgets.QCheckBox('Select output folder', self)
        self.selectFolder.setChecked(
            settings.value("select_output_folder") == 'true')
        hbox.addWidget(self.selectFolder)
        hbox.addStretch()

        # option for opening the output folder
        export_open_folder = settings.value("export_open_folder")
        if export_open_folder is None:
            settings.setValue("export_open_folder", True)
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        self.openFolder = QtWidgets.QCheckBox('Open output folder', self)
        self.openFolder.setChecked(
            settings.value("export_open_folder") == 'true')
        hbox.addWidget(self.openFolder)
        hbox.addStretch()

        # export
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        btn = QtWidgets.QPushButton("Export profile")
        btn.setMinimumHeight(32)
        hbox.addWidget(btn)
        # noinspection PyUnresolvedReferences
        btn.clicked.connect(self.on_export_profile_btn)
        hbox.addStretch()
Ejemplo n.º 20
0
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self,
                                main_win=main_win,
                                lib=lib,
                                parent=parent)

        self.btn_dict = {
            "SeaBird CTD Setup": "input_buttons/seacat_plugin",
            "Reference Cast": "editor_buttons/reference",
            "Show/Edit Data Spreadsheet": "editor_buttons/spreadsheet",
            "Show/Edit Cast Metadata": "editor_buttons/metadata",
            "Filter/Smooth Data": "editor_buttons/filter",
            "Preview Thinning": "editor_buttons/thinning",
            "Restart Processing": "editor_buttons/restart",
            "Export Data": "editor_buttons/export",
            "Transmit Data": "editor_buttons/transmit",
            "Save to Database": "editor_buttons/database"
        }

        settings = QtCore.QSettings()

        self.setWindowTitle("Buttons Visibility Setup")
        self.setMinimumWidth(140)

        self.botton_min_width = 80
        lbl_width = 180

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.setLayout(self.mainLayout)

        # input file formats
        self.importLayout = QtWidgets.QVBoxLayout()
        self.mainLayout.addLayout(self.importLayout)
        # - import
        import_hbox = QtWidgets.QHBoxLayout()
        self.importLayout.addLayout(import_hbox)
        import_hbox.addStretch()
        import_label = QtWidgets.QLabel("Set/unset buttons visibility:")
        import_hbox.addWidget(import_label)
        import_hbox.addSpacing(6)
        # - fmt layout
        self.fmtLayout = QtWidgets.QHBoxLayout()
        self.importLayout.addLayout(self.fmtLayout)
        # -- middle
        self.midButtonBox = QtWidgets.QDialogButtonBox(QtCore.Qt.Vertical)
        self.fmtLayout.addWidget(self.midButtonBox)
        # --- add buttons

        for btn_label in self.btn_dict:

            btn = QtWidgets.QPushButton("%s" % btn_label)
            btn.setToolTip("Import %s format" % btn_label)
            btn.setMinimumWidth(self.botton_min_width)
            btn.setCheckable(True)

            if settings.value("%s" % self.btn_dict[btn_label], 0) == 1:
                btn.setChecked(True)

            self.midButtonBox.addButton(btn,
                                        QtWidgets.QDialogButtonBox.ActionRole)

        self.mainLayout.addSpacing(12)
        self.mainLayout.addStretch()

        # edit/apply
        hbox = QtWidgets.QHBoxLayout()
        hbox.addStretch()
        self.apply = QtWidgets.QPushButton("Apply")
        self.apply.setFixedWidth(40)
        # noinspection PyUnresolvedReferences
        self.apply.clicked.connect(self.on_apply)
        hbox.addWidget(self.apply)
        hbox.addStretch()
        self.mainLayout.addLayout(hbox)
Ejemplo n.º 21
0
    def __init__(self, main_win, lib, parent=None):
        AbstractDialog.__init__(self, main_win=main_win, lib=lib, parent=parent)

        self.oc = Oceanography()

        self.setWindowTitle("Constant-gradient Profile")
        self.setMinimumWidth(480)

        # outline ui
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.mainLayout.setContentsMargins(3, 3, 3, 3)
        self.setLayout(self.mainLayout)

        value_validator = QtGui.QDoubleValidator(0, 12000, 2, self)

        self.mainLayout.addStretch()

        # start point
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        # depth label
        self.start_depth_label = QtWidgets.QLabel("Start [m]:")
        self.start_depth_label.setFixedWidth(50)
        self.start_depth_label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        hbox.addWidget(self.start_depth_label)
        # depth value
        self.start_depth_value = QtWidgets.QLineEdit()
        self.start_depth_value.setFixedWidth(50)
        self.start_depth_value.setValidator(value_validator)
        self.start_depth_value.setText("0.0")
        # noinspection PyUnresolvedReferences
        self.start_depth_value.textEdited.connect(self.on_values_changed)
        hbox.addWidget(self.start_depth_value)
        # temp label
        self.start_temp_label = QtWidgets.QLabel("temp [°C]:")
        self.start_temp_label.setFixedWidth(70)
        self.start_temp_label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        hbox.addWidget(self.start_temp_label)
        # temp value
        self.start_temp_value = QtWidgets.QLineEdit()
        self.start_temp_value.setFixedWidth(50)
        self.start_temp_value.setValidator(value_validator)
        self.start_temp_value.setText("12.94")
        # noinspection PyUnresolvedReferences
        self.start_temp_value.textEdited.connect(self.on_values_changed)
        hbox.addWidget(self.start_temp_value)
        # sal label
        self.start_sal_label = QtWidgets.QLabel("sal [PSU]:")
        self.start_sal_label.setFixedWidth(70)
        self.start_sal_label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        hbox.addWidget(self.start_sal_label)
        # sal value
        self.start_sal_value = QtWidgets.QLineEdit()
        self.start_sal_value.setFixedWidth(50)
        self.start_sal_value.setValidator(value_validator)
        self.start_sal_value.setText("35.0")
        # noinspection PyUnresolvedReferences
        self.start_sal_value.textEdited.connect(self.on_values_changed)
        hbox.addWidget(self.start_sal_value)
        # speed label
        self.start_speed_label = QtWidgets.QLabel("speed [m/s]:")
        self.start_speed_label.setFixedWidth(70)
        self.start_speed_label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        hbox.addWidget(self.start_speed_label)
        # speed value
        self.start_speed_value = QtWidgets.QLineEdit()
        self.start_speed_value.setFixedWidth(70)
        self.start_speed_value.setValidator(value_validator)
        self.start_speed_value.setText("1500.0")
        self.start_speed_value.setDisabled(True)
        # noinspection PyUnresolvedReferences
        self.start_speed_value.textEdited.connect(self.on_values_changed)
        hbox.addWidget(self.start_speed_value)
        hbox.addStretch()

        # end point
        hbox = QtWidgets.QHBoxLayout()
        self.mainLayout.addLayout(hbox)
        hbox.addStretch()
        # depth label
        self.end_depth_label = QtWidgets.QLabel("End [m]:")
        self.end_depth_label.setFixedWidth(50)
        self.end_depth_label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        hbox.addWidget(self.end_depth_label)
        # depth value
        self.end_depth_value = QtWidgets.QLineEdit()
        self.end_depth_value.setFixedWidth(50)
        self.end_depth_value.setValidator(value_validator)
        self.end_depth_value.setText("1000.0")
        # noinspection PyUnresolvedReferences
        self.end_depth_value.textEdited.connect(self.on_values_changed)
        hbox.addWidget(self.end_depth_value)
        # temp label
        self.end_temp_label = QtWidgets.QLabel("temp [°C]:")
        self.end_temp_label.setFixedWidth(70)
        self.end_temp_label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        hbox.addWidget(self.end_temp_label)
        # temp value
        self.end_temp_value = QtWidgets.QLineEdit()
        self.end_temp_value.setFixedWidth(50)
        self.end_temp_value.setValidator(value_validator)
        self.end_temp_value.setText("12.94")
        # noinspection PyUnresolvedReferences
        self.end_temp_value.textEdited.connect(self.on_values_changed)
        hbox.addWidget(self.end_temp_value)
        # sal label
        self.end_sal_label = QtWidgets.QLabel("sal [PSU]:")
        self.end_sal_label.setFixedWidth(70)
        self.end_sal_label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        hbox.addWidget(self.end_sal_label)
        # sal value
        self.end_sal_value = QtWidgets.QLineEdit()
        self.end_sal_value.setFixedWidth(50)
        self.end_sal_value.setValidator(value_validator)
        self.end_sal_value.setText("35.0")
        # noinspection PyUnresolvedReferences
        self.end_sal_value.textEdited.connect(self.on_values_changed)
        hbox.addWidget(self.end_sal_value)
        # speed label
        self.end_speed_label = QtWidgets.QLabel("speed [m/s]:")
        self.end_speed_label.setFixedWidth(70)
        self.end_speed_label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        hbox.addWidget(self.end_speed_label)
        # speed value
        self.end_speed_value = QtWidgets.QLineEdit()
        self.end_speed_value.setFixedWidth(70)
        self.end_speed_value.setValidator(value_validator)
        self.end_speed_value.setText("1500.0")
        self.end_speed_value.setDisabled(True)
        # noinspection PyUnresolvedReferences
        self.end_speed_value.textEdited.connect(self.on_values_changed)
        hbox.addWidget(self.end_speed_value)
        hbox.addStretch()

        self.mainLayout.addSpacing(12)

        # apply
        hbox = QtWidgets.QHBoxLayout()
        hbox.addStretch()
        self.apply = QtWidgets.QPushButton("Apply")
        # self.apply.setFixedHeight(30)
        # noinspection PyUnresolvedReferences
        self.apply.clicked.connect(self.on_apply)
        hbox.addWidget(self.apply)
        hbox.addStretch()
        self.mainLayout.addLayout(hbox)

        self.mainLayout.addStretch()

        self.on_values_changed()