Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 41 additions & 3 deletions mslib/msui/multiple_flightpath_dockwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,38 @@ def remove(self):


class MultipleFlightpathControlWidget(QtWidgets.QWidget, ui.Ui_MultipleViewWidget):

def cleanup_connections(self):
try:
self.listFlightTracks.model().rowsInserted.disconnect(self.wait)
except Exception:
pass

try:
self.listFlightTracks.model().rowsRemoved.disconnect(self.flighttrackRemoved)
except Exception:
pass

try:
self.ui.signal_activate_flighttrack1.disconnect(self.get_active)
except Exception:
pass

try:
self.list_flighttrack.itemChanged.disconnect(self.flagop)
except Exception:
pass

try:
self.ui.signal_ft_vertices_color_change.disconnect(self.ft_vertices_color)
except Exception:
pass

try:
self.ui.signal_login_mscolab.disconnect(self.login)
except Exception:
pass

"""
This class provides the interface for plotting Multiple Flighttracks
on the TopView canvas.
Expand Down Expand Up @@ -220,7 +252,12 @@ def __init__(self, parent=None, view=None, listFlightTracks=None,
self.connect_mscolab_server()

if parent is not None:
parent.viewCloses.connect(lambda: self.signal_parent_closes.emit())
parent.viewCloses.connect(self.handle_parent_close)

def handle_parent_close(self):
self.cleanup_connections()
self.signal_parent_closes.emit()


# Load flighttracks
for index in range(self.listFlightTracks.count()):
Expand Down Expand Up @@ -258,8 +295,9 @@ def connect_mscolab_server(self):
self.listOperationsMSC, self.view)
self.obb.append(self.operations)

self.ui.signal_permission_revoked.connect(lambda op_id: self.operations.permission_revoked(op_id))
self.ui.signal_render_new_permission.connect(lambda op_id, path: self.operations.render_permission(op_id, path))
self.ui.signal_permission_revoked.connect(self.operations.permission_revoked)
self.ui.signal_render_new_permission.connect(self.operations.render_permission)

# Signal emitted, on activation of operation from MSUI
self.ui.signal_activate_operation.connect(self.update_op_id)
self.ui.signal_operation_added.connect(self.add_operation_slot)
Expand Down
5 changes: 5 additions & 0 deletions mslib/msui/topview.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ def __init__(self, parent=None, settings=None, wms_connected=False):
palette.setColor(QtGui.QPalette.Button, colour)
button.setPalette(palette)

self.cbAltitudeColor = QtWidgets.QCheckBox("Color flight track by altitude")
self.layout().addWidget(self.cbAltitudeColor)

# Connect colour button signals.
self.btWaterColour.clicked.connect(functools.partial(self.setColour, "water"))
self.btLandColour.clicked.connect(functools.partial(self.setColour, "land"))
Expand Down Expand Up @@ -173,6 +176,8 @@ def get_settings(self):
QtGui.QPalette(self.btVerticesColour.palette()).color(QtGui.QPalette.Button).getRgbF(),
"colour_ft_waypoints":
QtGui.QPalette(self.btWaypointsColour.palette()).color(QtGui.QPalette.Button).getRgbF(),
"color_by_altitude": self.cbAltitudeColor.isChecked(),

}
return settings

Expand Down
18 changes: 11 additions & 7 deletions mslib/utils/mssautoplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,13 +663,17 @@ def draw(no_of_plots):
return False
except Exception as e:
if "times" in str(e):
print("Invalid times and/or levels requested")
elif "LAYER" in str(e):
print(f"Invalid LAYER '{layer}' requested")
elif "404 Client Error" in str(e) or "NOT FOUND for url" in str(e):
print("Invalid STYLE and/or URL requested")
else:
print(str(e))
print("Invalid times and/or levels requested")

elif "LAYER" in str(e):
print("Invalid LAYER '{}' requested".format(layer))

elif "404 Client Error" in str(e) or "NOT FOUND for url" in str(e):
print("Invalid STYLE and/or URL requested")

else:
print(str(e))

else:
print("Plot downloaded!")
return True
Expand Down
6 changes: 5 additions & 1 deletion mslib/utils/netCDF4tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ class MFDatasetCommonDims(netCDF4.MFDataset):

def __init__(self, files, exclude=None, skip_dim_check=None,
require_dim_num=False):
super(MFDatasetCommonDims, self).__init__(files)

super().__init__(files)

"""
Open a Dataset spanning multiple files sharing common dimensions but
containing different record variables, making it look as if it was a
Expand Down Expand Up @@ -247,7 +251,7 @@ def __init__(self, files, exclude=None, skip_dim_check=None,

# Open the master again, this time as a classic CDF instance. This will avoid
# calling methods of the CDFMF subclass when querying the master file.
cdfm = netCDF4.Dataset(master)

# copy attributes from master.
self.__dict__.update(cdfm.__dict__)

Expand Down
23 changes: 19 additions & 4 deletions mslib/utils/ogcwms.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,25 @@ class WebMapService(wms111.WebMapService_1_1_1):
Implements IWebMapService.
"""

def __init__(self, url, version=None, xml=None, username=None, password=None,
parse_remote_metadata=False, headers=None,
timeout=config_loader(dataset="WMS_request_timeout"),
auth=None):
def __init__(self, url, version=None, xml=None, username=None, password=None,
parse_remote_metadata=False, headers=None,
timeout=config_loader(dataset="WMS_request_timeout"),
auth=None):

super().__init__(
url,
version=version,
xml=xml,
username=username,
password=password,
parse_remote_metadata=parse_remote_metadata,
headers=headers,
timeout=timeout,
auth=auth
)

# existing custom code yaha se niche rahega

"""Initialize."""

if auth:
Expand Down