Commit c766adb7 authored by James Harle's avatar James Harle
Browse files

final QT4 > QT5 updates to make GUI work + addition of tide_model

namelist entry to the variable info for the GUI
......@@ -43,15 +43,15 @@ class InputWindow(QtWidgets.QDialog):
self.mpl_widget.set_mask_settings(float(setup.settings['mask_max_depth']), float(setup.settings['mask_shelfbreak_dist']))
splitter = QtGui.QSplitter(Qt.Horizontal)
splitter = QtWidgets.QSplitter(Qt.Horizontal)
splitter.addWidget(self.nl_editor)
splitter.addWidget(self.mpl_widget)
hbox = QtGui.QHBoxLayout()
hbox = QtWidgets.QHBoxLayout()
hbox.addWidget(splitter)
self.setLayout(hbox)
#set the Dialog title
self.setWindowTitle("PyNEMO Settings Editor")
QtGui.QApplication.setStyle(QtGui.QStyleFactory.create('Cleanlooks'))
QtWidgets.QApplication.setStyle(QtWidgets.QStyleFactory.create('Cleanlooks'))
#show the window
self.show()
......@@ -51,7 +51,7 @@ class MatplotlibWidget(QtWidgets.QWidget):
self.toolbar.drawing_tool.connect(self.drawing_tool_callback)
self.axes = self.figure.add_subplot(111)
self.cbar = None
layout = QtGui.QVBoxLayout()
layout = QtWidgets.QVBoxLayout()
layout.addWidget(self.toolbar)
layout.addWidget(self.canvas)
self.setLayout(layout)
......
......@@ -35,25 +35,25 @@ class NameListEditor(QtWidgets.QWidget):
'''
Initialises the UI components of the GUI
'''
client = QtGui.QWidget(self)
client = QtWidgets.QWidget(self)
# Create the Layout to Grid
grid = QtGui.QGridLayout()
grid = QtWidgets.QGridLayout()
# Loop through the settings and create widgets for each setting
index = 0
for setting in self.settings:
# initialises setting Widget
label = QtGui.QLabel(setting)
qlabel = QtGui.QPushButton("")
qlabel.setIcon(self.style().standardIcon(QtGui.QStyle.SP_MessageBoxQuestion))
label = QtWidgets.QLabel(setting)
qlabel = QtWidgets.QPushButton("")
qlabel.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MessageBoxQuestion))
if type(self.settings[setting]).__name__ in ['str', 'float', 'double',
'int', 'time', 'dict']:
text = QtGui.QLineEdit(self)
text = QtWidgets.QLineEdit(self)
text.setText(str(self.settings[setting]))
text.textChanged.connect(lambda value=setting,\
var_name=setting: self.label_changed(value, var_name))
if setting in self.bool_settings:
chkbox = QtGui.QCheckBox(self)
chkbox = QtWidgets.QCheckBox(self)
chkbox.setChecked(self.bool_settings[setting])
chkbox.stateChanged.connect(lambda value=setting,\
var_name=setting:\
......@@ -61,7 +61,7 @@ class NameListEditor(QtWidgets.QWidget):
grid.addWidget(chkbox, index, 0)
elif type(self.settings[setting]).__name__ == 'bool':
text = QtGui.QComboBox(self)
text = QtWidgets.QComboBox(self)
text.insertItem(0, 'True')
text.insertItem(1, 'False')
if self.settings[setting]:
......@@ -84,22 +84,22 @@ class NameListEditor(QtWidgets.QWidget):
client.setLayout(grid)
#scrollbars
scroll_area = QtGui.QScrollArea(self)
scroll_area = QtWidgets.QScrollArea(self)
#scroll_area.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
scroll_area.setWidget(client)
#save cancel buttons
btn_widget = QtGui.QWidget(self)
hbox_layout = QtGui.QHBoxLayout(self)
btn_save = QtGui.QPushButton('Save')
btn_widget = QtWidgets.QWidget(self)
hbox_layout = QtWidgets.QHBoxLayout(self)
btn_save = QtWidgets.QPushButton('Save')
btn_save.clicked.connect(self._btn_save_callback)
self.btn_cancel = QtGui.QPushButton('Close')
self.btn_cancel = QtWidgets.QPushButton('Close')
self.btn_cancel.clicked.connect(self._btn_cancel_callback)
hbox_layout.addWidget(btn_save)
hbox_layout.addWidget(self.btn_cancel)
btn_widget.setLayout(hbox_layout)
box_layout = QtGui.QVBoxLayout(self)
box_layout = QtWidgets.QVBoxLayout(self)
box_layout.addWidget(scroll_area)
box_layout.addWidget(btn_widget)
btn_widget.setMaximumWidth(400)
......
......@@ -5,7 +5,7 @@ Created on 7 Jan 2015
'''
# pylint: disable=E1103
# pylint: disable=no-name-in-module
from PyQt5 import QtGui
from PyQt5 import QtGui, QtWidgets
from .gui.nemo_bdy_input_window import InputWindow
from . import nemo_bdy_setup
......@@ -16,7 +16,7 @@ def open_settings_window(fname):
""" Main method which starts a Qt application and gives user
an option to pick a namelist.bdy file to edit. Once user selects it
it will open a dialog box where users can edit the parameters"""
app = QtGui.QApplication(sys.argv)
app = QtWidgets.QApplication(sys.argv)
if fname is None:
fname = QtGui.QFileDialog.getOpenFileName(None, 'Open file')
......@@ -29,7 +29,7 @@ def open_settings_dialog(setup):
""" This method is to start the settings window using the setup settings provided
in the input. On clicking the cancel button it doesn't shutdown the applicaiton
but carries on with the execution"""
app = QtGui.QApplication(sys.argv)
app = QtWidgets.QApplication(sys.argv)
ex = InputWindow(setup)
ex.nl_editor.btn_cancel.clicked.connect(app.quit)
return app.exec_(), ex.mpl_widget.mask
......
......@@ -28,6 +28,7 @@ ln_tra = boundary conditions for T and S
ln_ice = ice boundary condition
nn_rimwidth = width of the relaxation zone
ln_tide = if .true. : produce bdy tidal conditions
sn_tide_model = 'FES'
clname(0) = constituent name
ln_trans =
nn_year_000 = year start
......@@ -47,4 +48,4 @@ nn_alpha = Euler rotation angle
nn_beta = Euler rotation angle
nn_gamma = Euler rotation angle
rn_mask_max_depth = Maximum depth to be ignored for the mask
rn_mask_shelfbreak_dist = Distance from the shelf break
\ No newline at end of file
rn_mask_shelfbreak_dist = Distance from the shelf break
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment