Procházet zdrojové kódy

wxGUI/vdigit: fix attribute dialog blocking window on MacOSX with wxpython 3

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@65606 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová před 9 roky
rodič
revize
6fc3403ab8
2 změnil soubory, kde provedl 13 přidání a 33 odebrání
  1. 4 2
      gui/wxpython/dbmgr/dialogs.py
  2. 9 31
      gui/wxpython/vdigit/mapwindow.py

+ 4 - 2
gui/wxpython/dbmgr/dialogs.py

@@ -310,8 +310,10 @@ class DisplayAttributesDialog(wx.Dialog):
         elif frame.IsAutoRendered():
             frame.RemoveQueryLayer()
             self.parent.UpdateMap(render = True)
-
-        self.Destroy()
+        if self.IsModal():
+            self.EndModal(wx.ID_OK)
+        else:
+            self.Destroy()
 
     def OnSubmit(self, event):
         """Submit records"""

+ 9 - 31
gui/wxpython/vdigit/mapwindow.py

@@ -194,22 +194,11 @@ class VDigitWindow(BufferedMapWindow):
                     for fid in fids:
                         self._geomAttrb(fid, addRecordDlg, 'area')
                         self._geomAttrb(fid, addRecordDlg, 'perimeter')
-                
-                if addRecordDlg.IsFound() and \
-                        addRecordDlg.ShowModal() == wx.ID_OK:
-                    sqlfile = tempfile.NamedTemporaryFile(mode = "w")
-                    for sql in addRecordDlg.GetSQLString():
-                        sqlfile.file.write(sql + ";\n")
-                    sqlfile.file.flush()
-                    
-                    RunCommand('db.execute',
-                               parent = self,
-                               quiet = True, 
-                               input = sqlfile.name)
-                
-                if addRecordDlg.mapDBInfo:
-                    self._updateATM()
-        
+
+                if addRecordDlg.IsFound():
+                    addRecordDlg.ShowModal()
+                addRecordDlg.Destroy()
+
         elif self.toolbar.GetAction('type') in ["line", "boundary", "area"]:
             # add new point to the line
             self.polycoords.append(self.Pixel2Cell(event.GetPositionTuple()[:]))
@@ -945,21 +934,10 @@ class VDigitWindow(BufferedMapWindow):
                         self._geomAttrb(fid, addRecordDlg, 'area')
                         self._geomAttrb(fid, addRecordDlg, 'perimeter')
 
-                    
-                    if addRecordDlg.mapDBInfo and \
-                            addRecordDlg.ShowModal() == wx.ID_OK:
-                        sqlfile = tempfile.NamedTemporaryFile(mode = "w")
-                        for sql in addRecordDlg.GetSQLString():
-                            sqlfile.file.write(sql + ";\n")
-                        sqlfile.file.flush()
-                        RunCommand('db.execute',
-                                   parent = True,
-                                   quiet = True,
-                                   input = sqlfile.name)
-                        
-                    if addRecordDlg.mapDBInfo:
-                        self._updateATM()
-            
+                    if addRecordDlg.IsFound():
+                        addRecordDlg.ShowModal()
+                    addRecordDlg.Destroy()
+
         elif action == "deleteLine":
             # -> delete selected vector features
             if self.digit.DeleteSelectedLines() < 0: