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

- fixed bug that crashed the app when trying to add a tool without a tool diameter value

Marius Stanciu 6 лет назад
Родитель
Сommit
7bca0678ea
3 измененных файлов с 21 добавлено и 5 удалено
  1. 10 3
      FlatCAMObj.py
  2. 1 0
      README.md
  3. 10 2
      flatcamGUI/ObjectUI.py

+ 10 - 3
FlatCAMObj.py

@@ -3583,7 +3583,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                     tooldia = float(self.ui.addtool_entry.get_value().replace(',', '.'))
                 except ValueError:
                     change_message = True
-                    tooldia = self.options["cnctooldia"][0]
+                    tooldia = float(self.options["cnctooldia"][0])
 
             if tooldia is None:
                 self.build_ui()
@@ -3668,10 +3668,14 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         else:
             change_message = False
             self.app.inform.emit(_(
-                "[ERROR_NOTCL] Default Tool added. Wrong value format entered."
+                "[WARNING_NOTCL] Default Tool added. Wrong value format entered."
             ))
         self.build_ui()
 
+        # if there is no tool left in the Tools Table, enable the parameters GUI
+        if self.ui.geo_tools_table.rowCount() != 0:
+            self.ui.geo_param_frame.setDisabled(False)
+
     def on_tool_copy(self, all=None):
         self.ui_disconnect()
 
@@ -3775,7 +3779,6 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         self.build_ui()
 
     def on_tool_delete(self, all=None):
-
         self.ui_disconnect()
 
         if all is None:
@@ -3855,6 +3858,10 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                 obj_active.options['xmax'] = 0
                 obj_active.options['ymax'] = 0
 
+        # if there is no tool left in the Tools Table, disable the parameters GUI
+        if self.ui.geo_tools_table.rowCount() == 0:
+            self.ui.geo_param_frame.setDisabled(True)
+
     def on_row_selection_change(self):
         self.update_ui()
 

+ 1 - 0
README.md

@@ -12,6 +12,7 @@ CAD program, and create G-Code for Isolation routing.
 30.07.2019
 
 - fixed bug that crashed the software when trying to edit a GUI value in Geometry selected tab without having a tool in the Tools Table
+- fixed bug that crashed the app when trying to add a tool without a tool diameter value
 
 28.07.2019
 

+ 10 - 2
flatcamGUI/ObjectUI.py

@@ -1030,8 +1030,16 @@ class GeometryObjectUI(ObjectUI):
         )
         self.geo_tools_box.addWidget(self.tool_data_label)
 
+        self.geo_param_frame = QtWidgets.QFrame()
+        self.geo_param_frame.setContentsMargins(0, 0, 0, 0)
+        self.geo_tools_box.addWidget(self.geo_param_frame)
+
+        self.geo_param_box = QtWidgets.QVBoxLayout()
+        self.geo_param_box.setContentsMargins(0, 0, 0, 0)
+        self.geo_param_frame.setLayout(self.geo_param_box)
+
         self.grid3 = QtWidgets.QGridLayout()
-        self.geo_tools_box.addLayout(self.grid3)
+        self.geo_param_box.addLayout(self.grid3)
 
         # Tip Dia
         self.tipdialabel = QtWidgets.QLabel(_('V-Tip Dia:'))
@@ -1292,7 +1300,7 @@ class GeometryObjectUI(ObjectUI):
                 "Generate the CNC Job object."
             )
         )
-        self.geo_tools_box.addWidget(self.generate_cnc_button)
+        self.geo_param_box.addWidget(self.generate_cnc_button)
 
         # ##############
         # Paint area ##