Просмотр исходного кода

- fixed a bug where end_xy parameter in Drilling Tool was not used
- fixed an issue in Delete All method in the app_Main.py

Marius Stanciu 5 лет назад
Родитель
Сommit
dab3a5f703
6 измененных файлов с 37 добавлено и 7 удалено
  1. 5 0
      CHANGELOG.md
  2. 10 0
      appGUI/GUIElements.py
  3. 1 1
      appObjects/FlatCAMCNCJob.py
  4. 17 3
      appTools/ToolDrilling.py
  5. 1 1
      app_Main.py
  6. 3 2
      camlib.py

+ 5 - 0
CHANGELOG.md

@@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta
 
 
 =================================================
 =================================================
 
 
+24.09.2020
+
+- fixed a bug where end_xy parameter in Drilling Tool was not used
+- fixed an issue in Delete All method in the app_Main.py
+
 23.09.2020
 23.09.2020
 
 
 - added support for virtual units in SVG parser; warning: it may require the support for units which is not implemented yet
 - added support for virtual units in SVG parser; warning: it may require the support for units which is not implemented yet

+ 10 - 0
appGUI/GUIElements.py

@@ -700,6 +700,16 @@ class NumericalEvalTupleEntry(EvalEntry):
         validator = QtGui.QRegExpValidator(regex, self)
         validator = QtGui.QRegExpValidator(regex, self)
         self.setValidator(validator)
         self.setValidator(validator)
 
 
+    def get_value(self):
+        raw = str(self.text()).strip(' ')
+        try:
+            evaled = eval(raw)
+        except Exception as e:
+            if raw != '':
+                log.error("Could not evaluate val: %s, error: %s" % (str(raw), str(e)))
+            return None
+        return evaled
+
 
 
 class FCColorEntry(QtWidgets.QFrame):
 class FCColorEntry(QtWidgets.QFrame):
 
 

+ 1 - 1
appObjects/FlatCAMCNCJob.py

@@ -221,7 +221,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
         if self.app.is_legacy is False:
         if self.app.is_legacy is False:
             self.probing_shapes = ShapeCollection(parent=self.app.plotcanvas.view.scene, layers=1)
             self.probing_shapes = ShapeCollection(parent=self.app.plotcanvas.view.scene, layers=1)
         else:
         else:
-            self.probing_shapes = ShapeCollectionLegacy(obj=self, app=self.app, name=name + "_voronoi_shapes")
+            self.probing_shapes = ShapeCollectionLegacy(obj=self, app=self.app, name=name + "_probing_shapes")
 
 
         # Attributes to be included in serialization
         # Attributes to be included in serialization
         # Always append to it because it carries contents
         # Always append to it because it carries contents

+ 17 - 3
appTools/ToolDrilling.py

@@ -9,7 +9,8 @@ from PyQt5 import QtWidgets, QtCore, QtGui
 
 
 from appTool import AppTool
 from appTool import AppTool
 from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCButton, \
 from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCButton, \
-    FCComboBox, OptionalInputSection, FCSpinner, NumericalEvalEntry, OptionalHideInputSection, FCLabel
+    FCComboBox, OptionalInputSection, FCSpinner, NumericalEvalEntry, OptionalHideInputSection, FCLabel, \
+    NumericalEvalTupleEntry
 from appParsers.ParseExcellon import Excellon
 from appParsers.ParseExcellon import Excellon
 
 
 from copy import deepcopy
 from copy import deepcopy
@@ -793,6 +794,10 @@ class ToolDrilling(AppTool, Excellon):
                 current_widget2.returnPressed.connect(self.form_to_storage)
                 current_widget2.returnPressed.connect(self.form_to_storage)
             elif isinstance(current_widget2, FCComboBox):
             elif isinstance(current_widget2, FCComboBox):
                 current_widget2.currentIndexChanged.connect(self.form_to_storage)
                 current_widget2.currentIndexChanged.connect(self.form_to_storage)
+            elif isinstance(current_widget2, NumericalEvalEntry):
+                current_widget2.editingFinished.connect(self.form_to_storage)
+            elif isinstance(current_widget2, NumericalEvalTupleEntry):
+                current_widget2.editingFinished.connect(self.form_to_storage)
 
 
         self.t_ui.order_radio.activated_custom[str].connect(self.on_order_changed)
         self.t_ui.order_radio.activated_custom[str].connect(self.on_order_changed)
 
 
@@ -862,7 +867,16 @@ class ToolDrilling(AppTool, Excellon):
                     current_widget2.currentIndexChanged.disconnect(self.form_to_storage)
                     current_widget2.currentIndexChanged.disconnect(self.form_to_storage)
                 except (TypeError, ValueError):
                 except (TypeError, ValueError):
                     pass
                     pass
-
+            elif isinstance(current_widget2, NumericalEvalEntry):
+                try:
+                    current_widget2.editingFinished.disconnect(self.form_to_storage)
+                except (TypeError, ValueError):
+                    pass
+            elif isinstance(current_widget2, NumericalEvalTupleEntry):
+                try:
+                    current_widget2.editingFinished.disconnect(self.form_to_storage)
+                except (TypeError, ValueError):
+                    pass
         try:
         try:
             self.t_ui.order_radio.activated_custom[str].disconnect()
             self.t_ui.order_radio.activated_custom[str].disconnect()
         except (TypeError, ValueError):
         except (TypeError, ValueError):
@@ -2436,7 +2450,7 @@ class DrillingUI:
               "If no value is entered then there is no move\n"
               "If no value is entered then there is no move\n"
               "on X,Y plane at the end of the job.")
               "on X,Y plane at the end of the job.")
         )
         )
-        self.endxy_entry = NumericalEvalEntry(border_color='#0069A9')
+        self.endxy_entry = NumericalEvalTupleEntry(border_color='#0069A9')
         self.endxy_entry.setPlaceholderText(_("X,Y coordinates"))
         self.endxy_entry.setPlaceholderText(_("X,Y coordinates"))
         self.endxy_entry.setObjectName("e_endxy")
         self.endxy_entry.setObjectName("e_endxy")
 
 

+ 1 - 1
app_Main.py

@@ -4609,7 +4609,7 @@ class App(QtCore.QObject):
                                 del obj_active.text_col
                                 del obj_active.text_col
                                 obj_active.annotation.clear(update=True)
                                 obj_active.annotation.clear(update=True)
                                 del obj_active.annotation
                                 del obj_active.annotation
-                                obj_active.voronoi_shapes.clear(update=True)
+                                obj_active.probing_shapes.clear(update=True)
                             except AttributeError as e:
                             except AttributeError as e:
                                 log.debug(
                                 log.debug(
                                     "App.on_delete() --> delete annotations on a FlatCAMCNCJob object. %s" % str(e)
                                     "App.on_delete() --> delete annotations on a FlatCAMCNCJob object. %s" % str(e)

+ 3 - 2
camlib.py

@@ -3164,6 +3164,7 @@ class CNCjob(Geometry):
             self.startz = None
             self.startz = None
         self.z_end = tool_dict["tools_drill_endz"]
         self.z_end = tool_dict["tools_drill_endz"]
         self.xy_end = tool_dict["tools_drill_endxy"]
         self.xy_end = tool_dict["tools_drill_endxy"]
+
         try:
         try:
             if self.xy_end == '':
             if self.xy_end == '':
                 self.xy_end = None
                 self.xy_end = None
@@ -3176,7 +3177,7 @@ class CNCjob(Geometry):
                     self.xy_end = [float(eval(a)) for a in self.xy_end.split(",")]
                     self.xy_end = [float(eval(a)) for a in self.xy_end.split(",")]
 
 
                 if self.xy_end and len(self.xy_end) != 2:
                 if self.xy_end and len(self.xy_end) != 2:
-                    self.app.inform.emit('[ERROR]%s' % _("The End X,Y format has to be (x, y)."))
+                    self.app.inform.emit('[ERROR] %s' % _("The End X,Y format has to be (x, y)."))
                     return 'fail'
                     return 'fail'
         except Exception as e:
         except Exception as e:
             log.debug("camlib.CNCJob.generate_from_excellon_by_tool() xy_end --> %s" % str(e))
             log.debug("camlib.CNCJob.generate_from_excellon_by_tool() xy_end --> %s" % str(e))
@@ -6803,7 +6804,7 @@ class CNCjob(Geometry):
         :rtype:     list
         :rtype:     list
         """
         """
 
 
-        # TODO: This takes forever. Too much data?
+        # This takes forever. Too much data?
         # self.app.inform.emit('%s: %s' % (_("Unifying Geometry from parsed Geometry segments"),
         # self.app.inform.emit('%s: %s' % (_("Unifying Geometry from parsed Geometry segments"),
         #                                  str(len(self.gcode_parsed))))
         #                                  str(len(self.gcode_parsed))))
         # self.solid_geometry = cascaded_union([geo['geom'] for geo in self.gcode_parsed])
         # self.solid_geometry = cascaded_union([geo['geom'] for geo in self.gcode_parsed])