Prechádzať zdrojové kódy

- fixed selection by dragging a selection shape in Geometry Editor

Marius Stanciu 6 rokov pred
rodič
commit
82b39d64d2
3 zmenil súbory, kde vykonal 31 pridanie a 15 odobranie
  1. 1 0
      README.md
  2. 24 9
      flatcamEditors/FlatCAMGeoEditor.py
  3. 6 6
      flatcamTools/ToolPaint.py

+ 1 - 0
README.md

@@ -14,6 +14,7 @@ CAD program, and create G-Code for Isolation routing.
 - modified CutOut Tool so now the manual gaps adding will continue until the user is clicking the RMB
 - added ability to turn on/of the grid snapping and to jump to a location while in CutOut Tool manual gap adding action
 - made PlotCanvas class inherit from VisPy Canvas instead of creating an instance of it (work of JP)
+- fixed selection by dragging a selection shape in Geometry Editor
 
 23.08.2019
 

+ 24 - 9
flatcamEditors/FlatCAMGeoEditor.py

@@ -3768,19 +3768,34 @@ class FlatCAMGeoEditor(QtCore.QObject):
         """
         poly_selection = Polygon([start_pos, (end_pos[0], start_pos[1]), end_pos, (start_pos[0], end_pos[1])])
 
+        key_modifier = QtWidgets.QApplication.keyboardModifiers()
+
+        if key_modifier == QtCore.Qt.ShiftModifier:
+            mod_key = 'Shift'
+        elif key_modifier == QtCore.Qt.ControlModifier:
+            mod_key = 'Control'
+        else:
+            mod_key = None
+
         self.app.delete_selection_shape()
+
+        sel_objects_list = []
         for obj in self.storage.get_objects():
             if (sel_type is True and poly_selection.contains(obj.geo)) or (sel_type is False and
                                                                            poly_selection.intersects(obj.geo)):
-                    if self.key == self.app.defaults["global_mselect_key"]:
-                        if obj in self.selected:
-                            self.selected.remove(obj)
-                        else:
-                            # add the object to the selected shapes
-                            self.selected.append(obj)
-                    else:
-                        if obj not in self.selected:
-                            self.selected.append(obj)
+                sel_objects_list.append(obj)
+
+        if mod_key == self.app.defaults["global_mselect_key"]:
+            for obj in sel_objects_list:
+                if obj in self.selected:
+                    self.selected.remove(obj)
+                else:
+                    # add the object to the selected shapes
+                    self.selected.append(obj)
+        else:
+            self.selected = []
+            self.selected = sel_objects_list
+
         self.replot()
 
     def draw_utility_geometry(self, geo):

+ 6 - 6
flatcamTools/ToolPaint.py

@@ -281,12 +281,12 @@ class ToolPaint(FlatCAMTool, Gerber):
         # Polygon selection
         selectlabel = QtWidgets.QLabel('%s:' % _('Selection'))
         selectlabel.setToolTip(
-            _("How to select the polygons to paint.<BR>"
-              "Options:<BR>"
-              "- <B>Single Polygons</B>: left mouse click on the polygon to be painted.<BR>"
-              "- <B>Area Selection</B>: left mouse click to start selection of the area to be painted.<BR>"
-              "- <B>All Polygons</B>: paint all polygons.<BR>"
-              "- <B>Reference Object</B>: paint an area described by an external reference object.")
+            _("How to select Polygons to be painted.\n\n"
+              "- 'Area Selection' - left mouse click to start selection of the area to be painted.\n"
+              "Keeping a modifier key pressed (CTRL or SHIFT) will allow to add multiple areas.\n"
+              "- 'All Polygons' - the Paint will start after click.\n"
+              "- 'Reference Object' -  will do non copper clearing within the area\n"
+              "specified by another object.")
         )
         grid3.addWidget(selectlabel, 7, 0)
         # grid3 = QtWidgets.QGridLayout()