Skip to content

Commit

Permalink
added optional SeaCAT button
Browse files Browse the repository at this point in the history
  • Loading branch information
giumas committed Apr 10, 2018
1 parent 1633fdf commit 10b5b67
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 16 deletions.
2 changes: 1 addition & 1 deletion hyo/soundspeed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())

__version__ = '2018.1.19'
__version__ = '2018.1.20'
__doc__ = "Sound Speed"
__author__ = '[email protected]; [email protected]; [email protected]; ' \
'[email protected]'
Expand Down
2 changes: 1 addition & 1 deletion hyo/soundspeedmanager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())

__version__ = '2018.1.19'
__version__ = '2018.1.20'
__doc__ = "Sound Speed Manager"
__author__ = '[email protected]; [email protected]; [email protected]; ' \
'[email protected]'
Expand Down
25 changes: 13 additions & 12 deletions hyo/soundspeedmanager/dialogs/buttons_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ def __init__(self, main_win, lib, parent=None):
AbstractDialog.__init__(self, main_win=main_win, lib=lib, parent=parent)

self.btn_dict = {
"Reference Cast": "reference",
"Show/Edit Data Spreadsheet": "spreadsheet",
"Show/Edit Cast Metadata": "metadata",
"Filter/Smooth Data": "filter",
"Preview Thinning": "thinning",
"Restart Processing": "restart",
"Export Data": "export",
"Transmit Data": "transmit",
"Save to Database": "database"
"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()
Expand Down Expand Up @@ -61,7 +62,7 @@ def __init__(self, main_win, lib, parent=None):
btn.setMinimumWidth(self.botton_min_width)
btn.setCheckable(True)

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

self.midButtonBox.addButton(btn, QtGui.QDialogButtonBox.ActionRole)
Expand All @@ -86,9 +87,9 @@ def on_apply(self):
settings = QtCore.QSettings()
for b in self.midButtonBox.buttons():
if b.isChecked():
settings.setValue("editor_buttons/%s" % self.btn_dict[b.text()], 1)
settings.setValue("%s" % self.btn_dict[b.text()], 1)
else:
settings.setValue("editor_buttons/%s" % self.btn_dict[b.text()], 0)
settings.setValue("%s" % self.btn_dict[b.text()], 0)

msg = "The new visibility settings for the buttons have been saved. \n" \
"Close and re-open the app to apply the changes!"
Expand Down
22 changes: 22 additions & 0 deletions hyo/soundspeedmanager/widgets/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from hyo.soundspeedmanager.dialogs.metadata_dialog import MetadataDialog
from hyo.soundspeedmanager.dialogs.export_single_profile_dialog import ExportSingleProfileDialog
from hyo.soundspeedmanager.widgets.dataplots import DataPlots
from hyo.soundspeedmanager.dialogs.seacat_dialog import SeacatDialog

from hyo.soundspeed.profile.dicts import Dicts

Expand All @@ -28,6 +29,7 @@ def __init__(self, main_win, lib):
AbstractWidget.__init__(self, main_win=main_win, lib=lib)

settings = QtCore.QSettings()
settings.setValue("input_buttons/seacat_plugin", settings.value("input_buttons/seacat_plugin", 0))
settings.setValue("editor_buttons/reference", settings.value("editor_buttons/reference", 1))
settings.setValue("editor_buttons/spreadsheet", settings.value("editor_buttons/spreadsheet", 0))
settings.setValue("editor_buttons/metadata", settings.value("editor_buttons/metadata", 1))
Expand Down Expand Up @@ -70,6 +72,16 @@ def __init__(self, main_win, lib):
self.input_bar.addAction(self.set_ref_act)
self.main_win.file_menu.addAction(self.set_ref_act)

# seacat
self.seacat_act = QtGui.QAction(QtGui.QIcon(os.path.join(self.media, 'seacat.png')),
'Seabird CTD setup', self)
self.seacat_act.setShortcut('Alt+B')
# noinspection PyUnresolvedReferences
self.seacat_act.triggered.connect(self.on_seacat)
if settings.value("input_buttons/seacat_plugin", 1) == 1:
self.input_bar.addAction(self.seacat_act)
self.main_win.file_menu.addAction(self.seacat_act)

self.process_bar = self.addToolBar('Process')
self.process_bar.setIconSize(QtCore.QSize(40, 40))

Expand Down Expand Up @@ -268,6 +280,16 @@ def on_clear_data(self):
self.lib.clear_data()
self.main_win.data_cleared()

def on_seacat(self):
logger.debug("Open Seabird CTD dialog")
dlg = SeacatDialog(lib=self.lib, main_win=self.main_win, parent=self)
ret = dlg.exec_()
if ret != QtGui.QDialog.Accepted:
logger.info("Seabird CTD dialog closed without selection")
return

self.accept()

def on_set_ref(self):
logger.debug('user wants to set as a reference')

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

__version__ = '2018.1.19'
__version__ = '2018.1.20'
__doc__ = "Sound Speed Settings"
__author__ = '[email protected]; [email protected]; [email protected]; ' \
'[email protected]'
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def txt_read(*paths):
setup_args = dict()

setup_args['name'] = 'hyo.soundspeed'
setup_args['version'] = '2018.1.18'
setup_args['version'] = '2018.1.20'
setup_args['url'] = 'https://bitbucket.org/ccomjhc/hyo_soundspeed/'
setup_args['license'] = 'LGPLv2.1 or CCOM-UNH Industrial Associate license'
setup_args['author'] = 'Giuseppe Masetti(UNH,CCOM); Barry Gallagher(NOAA,OCS); ' \
Expand Down

0 comments on commit 10b5b67

Please sign in to comment.