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

- fixed a whole load of PyQT signal problems generated by recent changes to the usage of SpinBoxes; added a signal returnPressed for the FCSpinner and for FCDoubleSpinner
- fixed issue in Paint Tool where the first added tool was expected to have a float diameter but it was a string
- updated the translation files to the latest state in the app

Marius Stanciu 6 лет назад
Родитель
Сommit
5f769105bc

+ 12 - 12
FlatCAMApp.py

@@ -6222,22 +6222,22 @@ class App(QtCore.QObject):
         if state:
             # first try to disconnect
             try:
-                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry.editingFinished.\
+                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry.returnPressed.\
                     disconnect(self.on_excellon_format_changed)
             except TypeError:
                 pass
             try:
-                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry.editingFinished.\
+                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry.returnPressed.\
                     disconnect(self.on_excellon_format_changed)
             except TypeError:
                 pass
             try:
-                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry.editingFinished.\
+                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry.returnPressed.\
                     disconnect(self.on_excellon_format_changed)
             except TypeError:
                 pass
             try:
-                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry.editingFinished.\
+                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry.returnPressed.\
                     disconnect(self.on_excellon_format_changed)
             except TypeError:
                 pass
@@ -6254,13 +6254,13 @@ class App(QtCore.QObject):
                 pass
 
             # the connect them
-            self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry.editingFinished.connect(
+            self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry.returnPressed.connect(
                 self.on_excellon_format_changed)
-            self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry.editingFinished.connect(
+            self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry.returnPressed.connect(
                 self.on_excellon_format_changed)
-            self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry.editingFinished.connect(
+            self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry.returnPressed.connect(
                 self.on_excellon_format_changed)
-            self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry.editingFinished.connect(
+            self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry.returnPressed.connect(
                 self.on_excellon_format_changed)
             self.ui.excellon_defaults_form.excellon_gen_group.excellon_zeros_radio.activated_custom.connect(
                 self.on_excellon_zeros_changed)
@@ -6269,22 +6269,22 @@ class App(QtCore.QObject):
         else:
             # disconnect the signals
             try:
-                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry.editingFinished. \
+                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_in_entry.returnPressed. \
                     disconnect(self.on_excellon_format_changed)
             except TypeError:
                 pass
             try:
-                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry.editingFinished. \
+                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_in_entry.returnPressed. \
                     disconnect(self.on_excellon_format_changed)
             except TypeError:
                 pass
             try:
-                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry.editingFinished. \
+                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_upper_mm_entry.returnPressed. \
                     disconnect(self.on_excellon_format_changed)
             except TypeError:
                 pass
             try:
-                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry.editingFinished. \
+                self.ui.excellon_defaults_form.excellon_gen_group.excellon_format_lower_mm_entry.returnPressed. \
                     disconnect(self.on_excellon_format_changed)
             except TypeError:
                 pass

+ 14 - 7
FlatCAMObj.py

@@ -184,7 +184,7 @@ class FlatCAMObj(QtCore.QObject):
         except (TypeError, AttributeError):
             pass
         try:
-            self.ui.scale_entry.editingFinished.connect(self.on_scale_button_click)
+            self.ui.scale_entry.returnPressed.connect(self.on_scale_button_click)
         except (TypeError, AttributeError):
             pass
         # self.ui.skew_button.clicked.connect(self.on_skew_button_click)
@@ -3796,7 +3796,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
         self.ui.generate_cnc_button.clicked.connect(self.on_generatecnc_button_click)
         self.ui.paint_tool_button.clicked.connect(lambda: self.app.paint_tool.run(toggle=False))
         self.ui.pp_geometry_name_cb.activated.connect(self.on_pp_changed)
-        self.ui.addtool_entry.editingFinished.connect(lambda: self.on_tool_add())
+        self.ui.addtool_entry.returnPressed.connect(lambda: self.on_tool_add())
 
     def set_tool_offset_visibility(self, current_row):
         if current_row is None:
@@ -3856,6 +3856,8 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
             elif isinstance(current_widget, FloatEntry) or isinstance(current_widget, LengthEntry) or \
                     isinstance(current_widget, FCEntry) or isinstance(current_widget, IntEntry):
                 current_widget.editingFinished.connect(self.gui_form_to_storage)
+            elif isinstance(current_widget, FCSpinner) or isinstance(current_widget, FCDoubleSpinner):
+                current_widget.returnPressed.connect(self.gui_form_to_storage)
 
         for row in range(self.ui.geo_tools_table.rowCount()):
             for col in [2, 3, 4]:
@@ -3870,7 +3872,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
 
         self.ui.geo_tools_table.currentItemChanged.connect(self.on_row_selection_change)
         self.ui.geo_tools_table.itemChanged.connect(self.on_tool_edit)
-        self.ui.tool_offset_entry.editingFinished.connect(self.on_offset_value_edited)
+        self.ui.tool_offset_entry.returnPressed.connect(self.on_offset_value_edited)
 
         for row in range(self.ui.geo_tools_table.rowCount()):
             self.ui.geo_tools_table.cellWidget(row, 6).clicked.connect(self.on_plot_cb_click_table)
@@ -3898,6 +3900,11 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
                     self.ui.grid3.itemAt(i).widget().editingFinished.disconnect(self.gui_form_to_storage)
                 except (TypeError, AttributeError):
                     pass
+            elif isinstance(current_widget, FCSpinner) or isinstance(current_widget, FCDoubleSpinner):
+                try:
+                    self.ui.grid3.itemAt(i).widget().returnPressed.disconnect(self.gui_form_to_storage)
+                except TypeError:
+                    pass
 
         for row in range(self.ui.geo_tools_table.rowCount()):
             for col in [2, 3, 4]:
@@ -3932,7 +3939,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
             pass
 
         try:
-            self.ui.tool_offset_entry.editingFinished.disconnect()
+            self.ui.tool_offset_entry.returnPressed.disconnect()
         except (TypeError, AttributeError):
             pass
 
@@ -6793,7 +6800,7 @@ class FlatCAMDocument(FlatCAMObj):
         )
 
         self.ui.autocomplete_cb.stateChanged.connect(self.on_autocomplete_changed)
-        self.ui.tab_size_spinner.editingFinished.connect(self.on_tab_size_change)
+        self.ui.tab_size_spinner.returnPressed.connect(self.on_tab_size_change)
         # #######################################################################
 
         self.ui.font_color_entry.set_value(self.app.defaults['document_font_color'])
@@ -6854,7 +6861,7 @@ class FlatCAMDocument(FlatCAMObj):
 
     def on_tab_size_change(self, val=None):
         try:
-            self.ui.tab_size_spinner.editingFinished.disconnect(self.on_tab_size_change)
+            self.ui.tab_size_spinner.returnPressed.disconnect(self.on_tab_size_change)
         except TypeError:
             pass
 
@@ -6865,7 +6872,7 @@ class FlatCAMDocument(FlatCAMObj):
         self.document_editor_tab.code_editor.setTabStopWidth(tab_balue)
         self.app.defaults['document_tab_size'] = tab_balue
 
-        self.ui.tab_size_spinner.editingFinished.connect(self.on_tab_size_change)
+        self.ui.tab_size_spinner.returnPressed.connect(self.on_tab_size_change)
 
     def on_text_changed(self):
         self.source_file = self.document_editor_tab.code_editor.toHtml()

+ 3 - 0
README.md

@@ -23,6 +23,9 @@ CAD program, and create G-Code for Isolation routing.
 - since the CNCjob geometry creation is only useful for graphical purposes and have no impact on the GCode creation I have removed the cascaded union on the GCode geometry therefore speeding up the Gcode display by many factors (perhaps hundreds of times faster)
 - added a secondary link in the bookmark manager
 - fixed the bookmark manager order of bookmark links; first two links are always protected from deletion or drag-and-drop to other positions
+- fixed a whole load of PyQT signal problems generated by recent changes to the usage of SpinBoxes; added a signal returnPressed for the FCSpinner and for FCDoubleSpinner
+- fixed issue in Paint Tool where the first added tool was expected to have a float diameter but it was a string
+- updated the translation files to the latest state in the app
 
 13.10.2019
 

+ 20 - 0
flatcamGUI/GUIElements.py

@@ -512,6 +512,9 @@ class EvalEntry2(QtWidgets.QLineEdit):
 
 
 class FCSpinner(QtWidgets.QSpinBox):
+
+    returnPressed = pyqtSignal()
+
     def __init__(self, parent=None):
         super(FCSpinner, self).__init__(parent)
         self.readyToEdit = True
@@ -528,6 +531,13 @@ class FCSpinner(QtWidgets.QSpinBox):
             return True
         return False
 
+    def keyPressEvent(self, event):
+        if event.key() == Qt.Key_Enter:
+            self.returnPressed.emit()
+            self.clearFocus()
+        else:
+            super().keyPressEvent(event)
+
     def wheelEvent(self, *args, **kwargs):
         # should work only there is a focus in the lineedit of the SpinBox
         if self.readyToEdit is False:
@@ -569,6 +579,9 @@ class FCSpinner(QtWidgets.QSpinBox):
 
 
 class FCDoubleSpinner(QtWidgets.QDoubleSpinBox):
+
+    returnPressed = pyqtSignal()
+
     def __init__(self, parent=None):
         super(FCDoubleSpinner, self).__init__(parent)
         self.readyToEdit = True
@@ -594,6 +607,13 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox):
             return True
         return False
 
+    def keyPressEvent(self, event):
+        if event.key() == Qt.Key_Enter:
+            self.returnPressed.emit()
+            self.clearFocus()
+        else:
+            super().keyPressEvent(event)
+
     def wheelEvent(self, *args, **kwargs):
         # should work only there is a focus in the lineedit of the SpinBox
         if self.readyToEdit is False:

+ 3 - 3
flatcamTools/ToolCalculators.py

@@ -231,9 +231,9 @@ class ToolCalculator(FlatCAMTool):
 
         # ## Signals
         self.cutDepth_entry.valueChanged.connect(self.on_calculate_tool_dia)
-        self.cutDepth_entry.editingFinished.connect(self.on_calculate_tool_dia)
-        self.tipDia_entry.editingFinished.connect(self.on_calculate_tool_dia)
-        self.tipAngle_entry.editingFinished.connect(self.on_calculate_tool_dia)
+        self.cutDepth_entry.returnPressed.connect(self.on_calculate_tool_dia)
+        self.tipDia_entry.returnPressed.connect(self.on_calculate_tool_dia)
+        self.tipAngle_entry.returnPressed.connect(self.on_calculate_tool_dia)
         self.calculate_vshape_button.clicked.connect(self.on_calculate_tool_dia)
 
         self.mm_entry.editingFinished.connect(self.on_calculate_inch_units)

+ 1 - 1
flatcamTools/ToolNonCopperClear.py

@@ -520,7 +520,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
         # ############################ SGINALS ########################################
         # #############################################################################
         self.addtool_btn.clicked.connect(self.on_tool_add)
-        self.addtool_entry.editingFinished.connect(self.on_tool_add)
+        self.addtool_entry.returnPressed.connect(self.on_tool_add)
         self.deltool_btn.clicked.connect(self.on_tool_delete)
         self.generate_ncc_button.clicked.connect(self.on_ncc_click)
 

+ 15 - 33
flatcamTools/ToolPaint.py

@@ -417,7 +417,7 @@ class ToolPaint(FlatCAMTool, Gerber):
         # ################################# Signals ###################################
         # #############################################################################
         self.addtool_btn.clicked.connect(self.on_tool_add)
-        self.addtool_entry.editingFinished.connect(self.on_tool_add)
+        self.addtool_entry.returnPressed.connect(self.on_tool_add)
         # self.copytool_btn.clicked.connect(lambda: self.on_tool_copy())
         self.tools_table.itemChanged.connect(self.on_tool_edit)
         self.deltool_btn.clicked.connect(self.on_tool_delete)
@@ -574,28 +574,28 @@ class ToolPaint(FlatCAMTool, Gerber):
         self.default_data.update({
             "name": '_paint',
             "plot": self.app.defaults["geometry_plot"],
-            "cutz": self.app.defaults["geometry_cutz"],
+            "cutz": float(self.app.defaults["geometry_cutz"]),
             "vtipdia": 0.1,
             "vtipangle": 30,
-            "travelz": self.app.defaults["geometry_travelz"],
-            "feedrate": self.app.defaults["geometry_feedrate"],
-            "feedrate_z": self.app.defaults["geometry_feedrate_z"],
-            "feedrate_rapid": self.app.defaults["geometry_feedrate_rapid"],
+            "travelz": float(self.app.defaults["geometry_travelz"]),
+            "feedrate": float(self.app.defaults["geometry_feedrate"]),
+            "feedrate_z": float(self.app.defaults["geometry_feedrate_z"]),
+            "feedrate_rapid": float(self.app.defaults["geometry_feedrate_rapid"]),
             "dwell": self.app.defaults["geometry_dwell"],
-            "dwelltime": self.app.defaults["geometry_dwelltime"],
+            "dwelltime": float(self.app.defaults["geometry_dwelltime"]),
             "multidepth": self.app.defaults["geometry_multidepth"],
             "ppname_g": self.app.defaults["geometry_ppname_g"],
-            "depthperpass": self.app.defaults["geometry_depthperpass"],
+            "depthperpass": float(self.app.defaults["geometry_depthperpass"]),
             "extracut": self.app.defaults["geometry_extracut"],
             "toolchange": self.app.defaults["geometry_toolchange"],
-            "toolchangez": self.app.defaults["geometry_toolchangez"],
-            "endz": self.app.defaults["geometry_endz"],
+            "toolchangez": float(self.app.defaults["geometry_toolchangez"]),
+            "endz": float(self.app.defaults["geometry_endz"]),
             "spindlespeed": self.app.defaults["geometry_spindlespeed"],
             "toolchangexy": self.app.defaults["geometry_toolchangexy"],
             "startz": self.app.defaults["geometry_startz"],
 
-            "tooldia": self.app.defaults["tools_painttooldia"],
-            "paintmargin": self.app.defaults["tools_paintmargin"],
+            "tooldia": float(self.app.defaults["tools_painttooldia"]),
+            "paintmargin": float(self.app.defaults["tools_paintmargin"]),
             "paintmethod": self.app.defaults["tools_paintmethod"],
             "selectmethod": self.app.defaults["tools_selectmethod"],
             "pathconnect": self.app.defaults["tools_pathconnect"],
@@ -605,7 +605,7 @@ class ToolPaint(FlatCAMTool, Gerber):
 
         # call on self.on_tool_add() counts as an call to self.build_ui()
         # through this, we add a initial row / tool in the tool_table
-        self.on_tool_add(self.app.defaults["tools_painttooldia"], muted=True)
+        self.on_tool_add(float(self.app.defaults["tools_painttooldia"]), muted=True)
 
         # if the Paint Method is "Single" disable the tool table context menu
         if self.default_data["selectmethod"] == "single":
@@ -715,16 +715,7 @@ class ToolPaint(FlatCAMTool, Gerber):
         if dia:
             tool_dia = dia
         else:
-            try:
-                tool_dia = float(self.addtool_entry.get_value())
-            except ValueError:
-                # try to convert comma to decimal point. if it's still not working error message and return
-                try:
-                    tool_dia = float(self.addtool_entry.get_value().replace(',', '.'))
-                except ValueError:
-                    self.app.inform.emit('[ERROR_NOTCL] %s' %
-                                         _("Wrong value format entered, use a number."))
-                    return
+            tool_dia = float(self.addtool_entry.get_value())
 
             if tool_dia is None:
                 self.build_ui()
@@ -938,16 +929,7 @@ class ToolPaint(FlatCAMTool, Gerber):
         # #####################################################
         self.app.inform.emit(_("Paint Tool. Reading parameters."))
 
-        try:
-            self.overlap = float(self.paintoverlap_entry.get_value())
-        except ValueError:
-            # try to convert comma to decimal point. if it's still not working error message and return
-            try:
-                self.overlap = float(self.paintoverlap_entry.get_value().replace(',', '.'))
-            except ValueError:
-                self.app.inform.emit('[ERROR_NOTCL] %s' %
-                                     _("Wrong value format entered, use a number."))
-                return
+        self.overlap = float(self.paintoverlap_entry.get_value())
 
         if self.overlap >= 1 or self.overlap < 0:
             self.app.inform.emit('[ERROR_NOTCL] %s' %

+ 7 - 7
flatcamTools/ToolTransform.py

@@ -333,13 +333,13 @@ class ToolTransform(FlatCAMTool):
         self.flipy_button.clicked.connect(self.on_flipy)
         self.flip_ref_button.clicked.connect(self.on_flip_add_coords)
 
-        self.rotate_entry.editingFinished.connect(self.on_rotate)
-        self.skewx_entry.editingFinished.connect(self.on_skewx)
-        self.skewy_entry.editingFinished.connect(self.on_skewy)
-        self.scalex_entry.editingFinished.connect(self.on_scalex)
-        self.scaley_entry.editingFinished.connect(self.on_scaley)
-        self.offx_entry.editingFinished.connect(self.on_offx)
-        self.offy_entry.editingFinished.connect(self.on_offy)
+        self.rotate_entry.returnPressed.connect(self.on_rotate)
+        self.skewx_entry.returnPressed.connect(self.on_skewx)
+        self.skewy_entry.returnPressed.connect(self.on_skewy)
+        self.scalex_entry.returnPressed.connect(self.on_scalex)
+        self.scaley_entry.returnPressed.connect(self.on_scaley)
+        self.offx_entry.returnPressed.connect(self.on_offx)
+        self.offy_entry.returnPressed.connect(self.on_offy)
 
     def run(self, toggle=True):
         self.app.report_usage("ToolTransform()")

BIN
locale/de/LC_MESSAGES/strings.mo


Разница между файлами не показана из-за своего большого размера
+ 200 - 181
locale/de/LC_MESSAGES/strings.po


BIN
locale/en/LC_MESSAGES/strings.mo


Разница между файлами не показана из-за своего большого размера
+ 234 - 203
locale/en/LC_MESSAGES/strings.po


BIN
locale/es/LC_MESSAGES/strings.mo


Разница между файлами не показана из-за своего большого размера
+ 200 - 181
locale/es/LC_MESSAGES/strings.po


BIN
locale/fr/LC_MESSAGES/strings.mo


Разница между файлами не показана из-за своего большого размера
+ 200 - 181
locale/fr/LC_MESSAGES/strings.po


BIN
locale/pt_BR/LC_MESSAGES/strings.mo


Разница между файлами не показана из-за своего большого размера
+ 200 - 181
locale/pt_BR/LC_MESSAGES/strings.po


BIN
locale/ro/LC_MESSAGES/strings.mo


Разница между файлами не показана из-за своего большого размера
+ 247 - 216
locale/ro/LC_MESSAGES/strings.po


BIN
locale/ru/LC_MESSAGES/strings.mo


Разница между файлами не показана из-за своего большого размера
+ 199 - 180
locale/ru/LC_MESSAGES/strings.po


Разница между файлами не показана из-за своего большого размера
+ 234 - 213
locale_template/strings.pot


Некоторые файлы не были показаны из-за большого количества измененных файлов