Skip to content

Commit

Permalink
wxGUI Vector Network Analysis Tool: fix destroy open dialog (#432)
Browse files Browse the repository at this point in the history
when wxGUI is closed
  • Loading branch information
tmszi committed Mar 20, 2020
1 parent 70a9f9a commit b81cebe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 8 additions & 2 deletions gui/wxpython/mapdisp/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ def __init__(self, parent, giface, title=_("GRASS GIS - Map display"),
# Emitted when closing display by closing its window.
self.closingDisplay = Signal("MapFrame.closingDisplay")

# Emitted when closing display by closing its window.
self.closingVNETDialog = Signal("MapFrame.closingVNETDialog")

# properties are shared in other objects, so defining here
self.mapWindowProperties = MapWindowProperties()
self.mapWindowProperties.setValuesFromUserSettings()
Expand Down Expand Up @@ -744,7 +747,7 @@ def _DToRastDone():
self._giface.WriteError(_('Failed to run d.to.rast:\n') + messages)
grass.try_remove(pngFile)
return

# alignExtent changes only region variable
oldRegion = self.GetMap().GetCurrentRegion().copy()
self.GetMap().AlignExtentFromDisplay()
Expand Down Expand Up @@ -777,7 +780,7 @@ def _DToRastDone():
pngFile = grass.tempfile(create=False) + '.png'
dOutFileCmd = ['d.out.file', 'output=' + pngFile, 'format=png']
self.DOutFile(dOutFileCmd, callback=_DToRastDone)



def DToRastOptData(self, dcmd, layer, params, propwin):
Expand Down Expand Up @@ -843,6 +846,8 @@ def CleanUp(self):
self.RemoveNviz()
if hasattr(self, 'rdigit') and self.rdigit:
self.rdigit.CleanUp()
if self.dialogs['vnet']:
self.closingVNETDialog.emit()
self._mgr.UnInit()

def OnCloseWindow(self, event):
Expand Down Expand Up @@ -1484,6 +1489,7 @@ def OnVNet(self, event):

from vnet.dialogs import VNETDialog
self.dialogs['vnet'] = VNETDialog(parent=self, giface=self._giface)
self.closingVNETDialog.connect(self.dialogs['vnet'].OnCloseDialog)
self.dialogs['vnet'].CenterOnScreen()
self.dialogs['vnet'].Show()

Expand Down
4 changes: 1 addition & 3 deletions gui/wxpython/vnet/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@
# - when layer tree of is changed, tmp result map is removed from render list
# - optimization of map drawing
# - tmp maps - add number of process
# - destructor problem - when GRASS GIS is closed with open VNETDialog,
# it's destructor is not called


class VNETDialog(wx.Dialog):
Expand Down Expand Up @@ -817,7 +815,7 @@ def _parseMapStr(self, vectMapStr):

return mapName, mapSet

def OnCloseDialog(self, event):
def OnCloseDialog(self, event=None):
"""Cancel dialog"""
self.vnet_mgr.CleanUp()
self._mgr.UnInit()
Expand Down

0 comments on commit b81cebe

Please sign in to comment.