Skip to content

Commit

Permalink
additional work on the navigation toolbar for Matplotlib
Browse files Browse the repository at this point in the history
  • Loading branch information
giumas committed May 11, 2024
1 parent 786235b commit 4289ec8
Show file tree
Hide file tree
Showing 38 changed files with 536 additions and 524 deletions.
2 changes: 1 addition & 1 deletion docs/user_manual_installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ If you decide to install the package in a Python environment, the dependencies a
* `scipy <https://github.com/scipy/scipy>`_
* `pyproj <https://github.com/jswhit/pyproj>`_
* `pyserial <https://github.com/pyserial/pyserial>`_
* `PySide2 <https://github.com/pyside/pyside2-setup>`_ *(only for the application)*
* `PySide6 <https://github.com/qtproject/pyside-pyside-setup>`_ *(only for the application)*

If you want to install the last stable version (from PyPI):

Expand Down
2 changes: 1 addition & 1 deletion examples/soundspeed/ex_read_and_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# test readers/writers
logger.info('test: *** START ***')
filters = ["valeport", ]
formats = ["caris", "csv", "elac", "hypack", "ixblue", "asvp", "qps", "sonardyne", "unb", ]
formats = ["caris", "csv", "elac", "hypack", "ixblue", "asvp/ssp", "qps", "sonardyne", "unb", ]
data_outputs = dict()
for format in formats:
data_outputs[format] = data_output
Expand Down
4 changes: 2 additions & 2 deletions examples/soundspeed/ex_read_and_write_abs_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
# test readers/writers
logger.info('test: *** START ***')
filters = ["castaway", ]
formats = ["asvp", ]
formats = ["asvp/ssp", ]
data_outputs = dict()
data_outputs["asvp"] = data_output
data_outputs["asvp/ssp"] = data_output
tests = testing.input_dict_test_files(inclusive_filters=filters)
# print(tests)

Expand Down
4 changes: 2 additions & 2 deletions examples/soundspeedmanager/ex_multi_selection_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from hyo2.ssm2.app.gui.soundspeedmanager.dialogs.multi_selection_dialog import MultiSelectionDialog
from hyo2.abc.lib.logging import set_logging

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

logger = logging.getLogger(__name__)
Expand All @@ -15,7 +15,7 @@
profiles = ["prof 1", "prof 2", "prof 3", "prof 4"]
ms_dlg = MultiSelectionDialog(title="Sea-Bird Seacat profiles", message="Select profiles:", items=profiles)
ret = ms_dlg.exec_()
if ret == QtWidgets.QDialog.Accepted:
if ret == QtWidgets.QDialog.DialogCode.Accepted:
print(ms_dlg.selected_items())

# app.exec_()
4 changes: 2 additions & 2 deletions examples/soundspeedmanager/ex_run_qt_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from hyo2.ssm2.app.gui.soundspeedmanager.mainwin import MainWin
from hyo2.abc.lib.logging import set_logging

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

logger = logging.getLogger(__name__)
Expand All @@ -18,4 +18,4 @@
# print(mw.lib.cb.ask_location())
# print(mw.lib.cb.ask_date())
print(mw.lib.cb.ask_text_with_flag())
app.exec_()
app.exec()
4 changes: 2 additions & 2 deletions examples/soundspeedmanager/ex_run_qt_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from PySide6 import QtWidgets

from hyo2.abc.app.qt_progress import QtProgress
from hyo2.abc2.app.qt_progress import QtProgress

app = QtWidgets.QApplication([])

Expand All @@ -24,4 +24,4 @@

progress.end()

# app.exec_()
# app.exec()
2 changes: 1 addition & 1 deletion examples/soundspeedmanager/ex_text_editor_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from hyo2.ssm2.lib.soundspeed import SoundSpeedLibrary
from hyo2.abc.lib.logging import set_logging

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

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion hyo2/ssm2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
logger.addHandler(logging.NullHandler())

name = "Sound Speed"
__version__ = '2024.0.5'
__version__ = '2024.1.0'
__copyright__ = 'Copyright 2024 University of New Hampshire, Center for Coastal and Ocean Mapping'

pkg_info = PkgInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,5 @@ def on_apply(self):
msg = "The new visibility settings for the buttons have been saved. \n" \
"Close and re-open the app to apply the changes!"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.information(self, "Buttons visibility", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.information(self, "Buttons visibility", msg, QtWidgets.QMessageBox.StandardButton.Ok)
self.accept()
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def on_apply(self):
if not success:
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Database", "Unable to load profile #%s!" % pk,
QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.StandardButton.Ok)
continue

# apply changes
Expand All @@ -187,15 +187,15 @@ def on_apply(self):
except RuntimeError as e:
msg = "Issue in apply changes\n%s" % e
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.critical(self, "Metadata error", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.critical(self, "Metadata error", msg, QtWidgets.QMessageBox.StandardButton.Ok)
continue

# we store the metadata to the db
if not self.lib.store_data():
msg = "Unable to save to db!"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Database warning for profile #%s" % pk, msg,
QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.StandardButton.Ok)
continue

self.main_win.data_stored()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def on_apply(self):
except Exception as e:
msg = "Issue in depth fields!\n\n%s" % e
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Constant-gradient profile", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Constant-gradient profile", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return

try:
Expand All @@ -208,7 +208,7 @@ def on_apply(self):
except Exception as e:
msg = "Issue in temperature fields!\n\n%s" % e
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Constant-gradient profile", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Constant-gradient profile", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return

try:
Expand All @@ -220,7 +220,7 @@ def on_apply(self):
except Exception as e:
msg = "Issue in salinity fields!\n\n%s" % e
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Constant-gradient profile", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Constant-gradient profile", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return

try:
Expand All @@ -232,7 +232,7 @@ def on_apply(self):
except Exception as e:
msg = "Issue in speed fields!\n\n%s" % e
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Constant-gradient profile", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Constant-gradient profile", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return

try:
Expand All @@ -245,7 +245,7 @@ def on_apply(self):
traceback.print_exc()
msg = "Issue in creating the profile:\n\n> %s" % e
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.critical(self, "Creation error", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.critical(self, "Creation error", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return

self.accept()
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def on_export_profile_btn(self):
if len(self.selected_writers) == 0:
msg = "Select output formats before data export!"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return

settings = QtCore.QSettings()
Expand Down Expand Up @@ -180,7 +180,7 @@ def on_export_profile_btn(self):
"Do you want to remove it to avoid possible profile duplications?"
# noinspection PyCallByClass,PyArgumentList
ret = QtWidgets.QMessageBox.question(self, "CARIS export", msg,
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.StandardButton.No)
if ret == QtWidgets.QMessageBox.Yes:
os.remove(caris_path)
break
Expand All @@ -202,7 +202,7 @@ def on_export_profile_btn(self):
if not success:
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Database", "Unable to load profile #%02d!" % pk,
QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.StandardButton.Ok)
continue

# special case: synthetic profile and NCEI
Expand All @@ -215,7 +215,7 @@ def on_export_profile_btn(self):
if self.lib.ssp.l[0].meta.sensor_type == Dicts.sensor_types['Synthetic']:
msg = "Attempt to export a synthetic profile in NCEI format!"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.StandardButton.Ok)
skip_export = True
continue

Expand All @@ -226,7 +226,7 @@ def on_export_profile_btn(self):
if self.lib.setup.noaa_tools:
msg += "\n\nRecommend in project_survey format, e.g. OPR-P999-RA-17_H12345"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.StandardButton.Ok)
skip_export = True
continue

Expand All @@ -238,7 +238,7 @@ def on_export_profile_btn(self):
"Rename the project in the Database tab!\n\n" \
"Recommend \"project_survey\" format, e.g. OPR-P999-RA-17_H12345"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.StandardButton.Ok)
skip_export = True
continue

Expand All @@ -250,7 +250,7 @@ def on_export_profile_btn(self):
"- Load the profile (if not already loaded)\n" \
"- Set the missing values using the Metadata button on the Editor tool bar\n"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.StandardButton.Ok)
skip_export = True
continue

Expand Down Expand Up @@ -290,7 +290,7 @@ def on_export_profile_btn(self):
self.progress.end()
msg = "Issue in exporting the data for profile #%02d.\nReason: %s" % (pk, e)
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.critical(self, "Export error", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.critical(self, "Export error", msg, QtWidgets.QMessageBox.StandardButton.Ok)
continue
self.progress.end()

Expand All @@ -305,10 +305,10 @@ def on_export_profile_btn(self):
if all_exported:
msg = "Profiles successfully exported!"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.information(self, "Export profile", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.information(self, "Export profile", msg, QtWidgets.QMessageBox.StandardButton.Ok)
else:
msg = "At least one profile had issues in being exported!"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Export profile", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Export profile", msg, QtWidgets.QMessageBox.StandardButton.Ok)

self.accept()
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def on_export_btn(self):
if len(self.fmt_outputs) == 0:
msg = "Select output formats before metadata export!"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return

filter_fields = None
Expand Down Expand Up @@ -128,7 +128,7 @@ def on_export_btn(self):
# except RuntimeError as e:
# self.progress.end()
# msg = "Issue in exporting the metadata.\nReason: %s" % e
# QtWidgets.QMessageBox.critical(self, "Export error", msg, QtWidgets.QMessageBox.Ok)
# QtWidgets.QMessageBox.critical(self, "Export error", msg, QtWidgets.QMessageBox.StandardButton.Ok)
# return

if success:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def on_export_profile_btn(self):
if len(self.selected_writers) == 0:
msg = "Select output formats before data export!"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return

# special case for Fugro ISS format
Expand All @@ -152,7 +152,7 @@ def on_export_profile_btn(self):
if self.lib.ssp.l[0].meta.sensor_type == Dicts.sensor_types['Synthetic']:
msg = "Attempt to export a synthetic profile in NCEI format!"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return

if self.lib.current_project == 'default':
Expand All @@ -161,7 +161,7 @@ def on_export_profile_btn(self):
if self.lib.setup.noaa_tools:
msg += "\n\nRecommend in project_survey format, e.g. OPR-P999-RA-17_H12345"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return

if self.lib.setup.noaa_tools and self.lib.not_noaa_project(self.lib.current_project):
Expand All @@ -171,7 +171,7 @@ def on_export_profile_btn(self):
"Rename the project in the Database tab!\n\n" \
"Recommend \"project_survey\" format, e.g. OPR-P999-RA-17_H12345"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return

if not self.lib.ssp.cur.meta.survey or \
Expand All @@ -182,7 +182,7 @@ def on_export_profile_btn(self):
"- Load the profile (if not already loaded)\n" \
"- Set the missing values using the Metadata button on the Editor tool bar\n"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Export warning", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return

# special case for Fugro ISS format with NCEI format
Expand Down Expand Up @@ -248,7 +248,7 @@ def on_export_profile_btn(self):
self.progress.end()
msg = "Issue in exporting the data.\nReason: %s" % e
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.critical(self, "Export error", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.critical(self, "Export error", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return

# opening the output folder
Expand All @@ -267,6 +267,6 @@ def on_export_profile_btn(self):
self.progress.end()
msg = "Profile successfully exported!"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.information(self, "Export profile", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.information(self, "Export profile", msg, QtWidgets.QMessageBox.StandardButton.Ok)

self.accept()
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def on_import(self):
if len(path) == 0:
msg = "Set the path to the project db!"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Import warning", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Import warning", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return
logger.debug('input db: %s' % path)

Expand All @@ -75,12 +75,12 @@ def on_import(self):
if len(pk_issues) == 0:
msg = "Successfully imported %d profile(s)" % len(pk_done)
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.information(self, "Import data", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.information(self, "Import data", msg, QtWidgets.QMessageBox.StandardButton.Ok)
self.accept()

else:
msg = "Issue in importing %s profile(s)\n" % ", ".join(["#%02d" % pk for pk in pk_issues])
msg += "Possible primary key duplication!"
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.warning(self, "Import warning", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.warning(self, "Import warning", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def on_click_import(self, btn):
% desc
# noinspection PyCallByClass,PyArgumentList
ret = QtWidgets.QMessageBox.warning(self, "Pre-processed source warning", msg,
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
if ret == QtWidgets.QMessageBox.No:
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.StandardButton.No)
if ret == QtWidgets.QMessageBox.StandardButton.No:
return

# ask the file path to the user
Expand Down Expand Up @@ -115,7 +115,7 @@ def on_click_import(self, btn):
self.progress.end()
msg = "Issue in importing the file #%s: %s\n\n> %s" % (i, selection, e)
# noinspection PyCallByClass,PyArgumentList
QtWidgets.QMessageBox.critical(self, "Import error", msg, QtWidgets.QMessageBox.Ok)
QtWidgets.QMessageBox.critical(self, "Import error", msg, QtWidgets.QMessageBox.StandardButton.Ok)
return

self.progress.end()
Expand Down
Loading

0 comments on commit 4289ec8

Please sign in to comment.