Ver código fonte

wxGUI: fix for not closing of attribute dialog with wxPython 3 (https://trac.osgeo.org/grass/ticket/2162)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@58725 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 11 anos atrás
pai
commit
5938aca127
1 arquivos alterados com 6 adições e 5 exclusões
  1. 6 5
      gui/wxpython/dbmgr/dialogs.py

+ 6 - 5
gui/wxpython/dbmgr/dialogs.py

@@ -156,7 +156,8 @@ class DisplayAttributesDialog(wx.Dialog):
         # bindigs
         btnReset.Bind(wx.EVT_BUTTON, self.OnReset)
         btnSubmit.Bind(wx.EVT_BUTTON, self.OnSubmit)
-        btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
+        btnCancel.Bind(wx.EVT_BUTTON, self.OnClose)
+        self.Bind(wx.EVT_CLOSE, self.OnClose)
 
         self.SetSizer(mainSizer)
         mainSizer.Fit(self)
@@ -297,8 +298,8 @@ class DisplayAttributesDialog(wx.Dialog):
                     if name != key and id != wx.NOT_FOUND:
                         self.FindWindowById(id).SetValue(str(value))
 
-    def OnCancel(self, event):
-        """!Cancel button pressed
+    def OnClose(self, event):
+        """!Closes dialog and removes query layer.
         """
         frame = self.parent.parent
         frame.dialogs['attributes'] = None
@@ -310,7 +311,7 @@ class DisplayAttributesDialog(wx.Dialog):
             frame.RemoveQueryLayer()
             self.parent.UpdateMap(render = True)
 
-        self.Close()
+        self.Destroy()
 
     def OnSubmit(self, event):
         """!Submit records"""
@@ -340,7 +341,7 @@ class DisplayAttributesDialog(wx.Dialog):
             layer += 1
         
         if close and self.closeDialog.IsChecked():
-            self.OnCancel(event)
+            self.OnClose(event)
 
     def OnFeature(self, event):
         self.fid = int(event.GetString())