answer = dlg.ShowModal()
if answer == wx.ID_OK:
self.changeStatusbar("Loading data ...")
pathlist = dlg.GetPaths()
dlg.Destroy()
if answer == wx.ID_CANCEL:
return
When we have the answer we can later on use it to check if the answer was a cancel request. If it was we can return( or break the execution) to avoid further evaluation which would cause the popup. On all four methods the best place to exit is just after the dlg.Destroy() command.
On the first menu "File' the menu items
You get an unnessary and incorrect popup when the operation is canceled. This can all be corrected with the same principle (here for Open File) https://github.com/geomagpy/magpy/blob/ae91462f1644ebf89fbe570ce1cf67d1d89eb926/magpy/gui/magpy_gui.py#L2272-L2276 We can replace it by following code
When we have the answer we can later on use it to check if the answer was a cancel request. If it was we can return( or break the execution) to avoid further evaluation which would cause the popup. On all four methods the best place to exit is just after the dlg.Destroy() command.