Sfoglia il codice sorgente

- fixed a bug that did not allow to edit GUI elements of type FCDoubleSpinner if it contained the percent symbol
- some small optimizations in the GUI of Cutout Tool

Marius Stanciu 5 anni fa
parent
commit
49fa926d50
4 ha cambiato i file con 26 aggiunte e 13 eliminazioni
  1. 5 0
      README.md
  2. 9 1
      flatcamGUI/GUIElements.py
  3. 10 10
      flatcamTools/ToolCutOut.py
  4. 2 2
      flatcamTools/ToolSolderPaste.py

+ 5 - 0
README.md

@@ -9,6 +9,11 @@ CAD program, and create G-Code for Isolation routing.
 
 
 =================================================
 =================================================
 
 
+19.04.2020 
+
+- fixed a bug that did not allow to edit GUI elements of type FCDoubleSpinner if it contained the percent symbol
+- some small optimizations in the GUI of Cutout Tool
+
 15.04.2020 
 15.04.2020 
 
 
 - made sure that the Tcl commands descriptions listed on help command are aligned
 - made sure that the Tcl commands descriptions listed on help command are aligned

+ 9 - 1
flatcamGUI/GUIElements.py

@@ -726,6 +726,14 @@ class FCSpinner(QtWidgets.QSpinBox):
             self.readyToEdit = True
             self.readyToEdit = True
             self.prev_readyToEdit = True
             self.prev_readyToEdit = True
 
 
+    def valueFromText(self, text: str) -> int:
+        txt = text.strip('%%')
+        try:
+            ret_val = int(txt)
+        except ValueError:
+            ret_val = 0
+        return ret_val
+
     def get_value(self):
     def get_value(self):
         return int(self.value())
         return int(self.value())
 
 
@@ -847,11 +855,11 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox):
 
 
     def valueFromText(self, p_str):
     def valueFromText(self, p_str):
         text = p_str.replace(',', '.')
         text = p_str.replace(',', '.')
+        text = text.strip('%%')
         try:
         try:
             ret_val = float(text)
             ret_val = float(text)
         except ValueError:
         except ValueError:
             ret_val = 0.0
             ret_val = 0.0
-
         return ret_val
         return ret_val
 
 
     def validate(self, p_str, p_int):
     def validate(self, p_str, p_int):

+ 10 - 10
flatcamTools/ToolCutOut.py

@@ -240,11 +240,11 @@ class CutOut(FlatCAMTool):
         title_param_label.setToolTip(
         title_param_label.setToolTip(
             _("This section handle creation of automatic bridge gaps.")
             _("This section handle creation of automatic bridge gaps.")
         )
         )
-        self.layout.addWidget(title_param_label)
+        grid0.addWidget(title_param_label, 18, 0, 1, 2)
 
 
         # Form Layout
         # Form Layout
         form_layout_2 = QtWidgets.QFormLayout()
         form_layout_2 = QtWidgets.QFormLayout()
-        self.layout.addLayout(form_layout_2)
+        grid0.addLayout(form_layout_2, 19, 0, 1, 2)
 
 
         # Gaps
         # Gaps
         gaps_label = QtWidgets.QLabel('%s:' % _('Gaps'))
         gaps_label = QtWidgets.QLabel('%s:' % _('Gaps'))
@@ -260,7 +260,7 @@ class CutOut(FlatCAMTool):
               "- 2tb  - 2*top + 2*bottom\n"
               "- 2tb  - 2*top + 2*bottom\n"
               "- 8     - 2*left + 2*right +2*top + 2*bottom")
               "- 8     - 2*left + 2*right +2*top + 2*bottom")
         )
         )
-        gaps_label.setMinimumWidth(60)
+        # gaps_label.setMinimumWidth(60)
 
 
         self.gaps = FCComboBox()
         self.gaps = FCComboBox()
         gaps_items = ['None', 'LR', 'TB', '4', '2LR', '2TB', '8']
         gaps_items = ['None', 'LR', 'TB', '4', '2LR', '2TB', '8']
@@ -282,7 +282,7 @@ class CutOut(FlatCAMTool):
                             font-weight: bold;
                             font-weight: bold;
                         }
                         }
                         """)
                         """)
-        self.layout.addWidget(self.ff_cutout_object_btn)
+        grid0.addWidget(self.ff_cutout_object_btn, 20, 0, 1, 2)
 
 
         self.rect_cutout_object_btn = QtWidgets.QPushButton(_("Generate Rectangular Geometry"))
         self.rect_cutout_object_btn = QtWidgets.QPushButton(_("Generate Rectangular Geometry"))
         self.rect_cutout_object_btn.setToolTip(
         self.rect_cutout_object_btn.setToolTip(
@@ -302,7 +302,7 @@ class CutOut(FlatCAMTool):
         separator_line = QtWidgets.QFrame()
         separator_line = QtWidgets.QFrame()
         separator_line.setFrameShape(QtWidgets.QFrame.HLine)
         separator_line.setFrameShape(QtWidgets.QFrame.HLine)
         separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
         separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
-        self.layout.addWidget(separator_line)
+        grid0.addWidget(separator_line, 21, 0, 1, 2)
 
 
         # Title5
         # Title5
         title_manual_label = QtWidgets.QLabel("<font size=4><b>%s</b></font>" % _('B. Manual Bridge Gaps'))
         title_manual_label = QtWidgets.QLabel("<font size=4><b>%s</b></font>" % _('B. Manual Bridge Gaps'))
@@ -311,11 +311,11 @@ class CutOut(FlatCAMTool):
               "This is done by mouse clicking on the perimeter of the\n"
               "This is done by mouse clicking on the perimeter of the\n"
               "Geometry object that is used as a cutout object. ")
               "Geometry object that is used as a cutout object. ")
         )
         )
-        self.layout.addWidget(title_manual_label)
+        grid0.addWidget(title_manual_label, 22, 0, 1, 2)
 
 
         # Form Layout
         # Form Layout
         form_layout_3 = QtWidgets.QFormLayout()
         form_layout_3 = QtWidgets.QFormLayout()
-        self.layout.addLayout(form_layout_3)
+        grid0.addLayout(form_layout_3, 23, 0, 1, 2)
 
 
         # Manual Geo Object
         # Manual Geo Object
         self.man_object_combo = FCComboBox()
         self.man_object_combo = FCComboBox()
@@ -328,7 +328,7 @@ class CutOut(FlatCAMTool):
         self.man_object_label.setToolTip(
         self.man_object_label.setToolTip(
             _("Geometry object used to create the manual cutout.")
             _("Geometry object used to create the manual cutout.")
         )
         )
-        self.man_object_label.setMinimumWidth(60)
+        # self.man_object_label.setMinimumWidth(60)
 
 
         form_layout_3.addRow(self.man_object_label)
         form_layout_3.addRow(self.man_object_label)
         form_layout_3.addRow(self.man_object_combo)
         form_layout_3.addRow(self.man_object_combo)
@@ -348,7 +348,7 @@ class CutOut(FlatCAMTool):
                             font-weight: bold;
                             font-weight: bold;
                         }
                         }
                         """)
                         """)
-        self.layout.addWidget(self.man_geo_creation_btn)
+        grid0.addWidget(self.man_geo_creation_btn, 24, 0, 1, 2)
 
 
         self.man_gaps_creation_btn = QtWidgets.QPushButton(_("Manual Add Bridge Gaps"))
         self.man_gaps_creation_btn = QtWidgets.QPushButton(_("Manual Add Bridge Gaps"))
         self.man_gaps_creation_btn.setToolTip(
         self.man_gaps_creation_btn.setToolTip(
@@ -364,7 +364,7 @@ class CutOut(FlatCAMTool):
                             font-weight: bold;
                             font-weight: bold;
                         }
                         }
                         """)
                         """)
-        self.layout.addWidget(self.man_gaps_creation_btn)
+        grid0.addWidget(self.man_gaps_creation_btn, 27, 0, 1, 2)
 
 
         self.layout.addStretch()
         self.layout.addStretch()
 
 

+ 2 - 2
flatcamTools/ToolSolderPaste.py

@@ -343,8 +343,8 @@ class SolderPaste(FlatCAMTool):
         self.gcode_form_layout.addRow(pp_label, self.pp_combo)
         self.gcode_form_layout.addRow(pp_label, self.pp_combo)
 
 
         # ## Buttons
         # ## Buttons
-        grid1 = QtWidgets.QGridLayout()
-        self.gcode_box.addLayout(grid1)
+        # grid1 = QtWidgets.QGridLayout()
+        # self.gcode_box.addLayout(grid1)
 
 
         self.solder_gcode_btn = QtWidgets.QPushButton(_("Generate GCode"))
         self.solder_gcode_btn = QtWidgets.QPushButton(_("Generate GCode"))
         self.solder_gcode_btn.setToolTip(
         self.solder_gcode_btn.setToolTip(