Parcourir la source

wxGUI/import: check all layers by default (#1018)

Anna Petrasova il y a 4 ans
Parent
commit
161c42cfeb
2 fichiers modifiés avec 12 ajouts et 12 suppressions
  1. 9 12
      gui/wxpython/gui_core/widgets.py
  2. 3 0
      gui/wxpython/modules/import_export.py

+ 9 - 12
gui/wxpython/gui_core/widgets.py

@@ -1067,27 +1067,24 @@ class GListCtrl(ListCtrl, listmix.ListCtrlAutoWidthMixin,
         self.PopupMenu(menu)
         menu.Destroy()
 
-    def OnSelectAll(self, event):
-        """Select all items"""
+    def SelectAll(self, select=True):
+        """Check or uncheck all items"""
         item = -1
-
         while True:
             item = self.GetNextItem(item)
             if item == -1:
                 break
-            self.CheckItem(item, True)
+            self.CheckItem(item, select)
+
+    def OnSelectAll(self, event):
+        """Check all items"""
+        self.SelectAll(select=True)
 
         event.Skip()
 
     def OnSelectNone(self, event):
-        """Deselect items"""
-        item = -1
-
-        while True:
-            item = self.GetNextItem(item, wx.LIST_STATE_SELECTED)
-            if item == -1:
-                break
-            self.CheckItem(item, False)
+        """Uncheck items"""
+        self.SelectAll(select=False)
 
         event.Skip()
 

+ 3 - 0
gui/wxpython/modules/import_export.py

@@ -464,6 +464,7 @@ class GdalImportDialog(ImportDialog):
     def reload(self, data, listData):
 
         self.list.LoadData(listData)
+        self.list.SelectAll(select=True)
         self.layersData = data
 
     def OnRun(self, event):
@@ -614,6 +615,7 @@ class OgrImportDialog(ImportDialog):
     def reload(self, data, listData):
 
         self.list.LoadData(listData)
+        self.list.SelectAll(select=True)
         self.layersData = data
 
     def OnRun(self, event):
@@ -955,6 +957,7 @@ class ReprojectionDialog(wx.Dialog):
             self.list.SetColumnWidth(col=i, width=width[i])
 
         self.list.LoadData(data)
+        self.list.SelectAll(True)
 
         self.labelText = StaticText(parent=self.panel, id=wx.ID_ANY, label=_(
             "Projection of following layers do not match with projection of current location. "))