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

- made optional the saving of an edited object. Now the user can cancel the changes to the object.
- replaced the standard buttons in the QMessageBox's used in the app with custom ones that can have text translated
- updated the POT translation file and the MO/PO files for English and Romanian language

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

+ 134 - 95
FlatCAMApp.py

@@ -2086,15 +2086,17 @@ class App(QtCore.QObject):
         """
         """
         self.report_usage("object2editor()")
         self.report_usage("object2editor()")
 
 
-        # adjust the visibility of some of the canvas context menu
-        self.ui.popmenu_edit.setVisible(False)
-        self.ui.popmenu_save.setVisible(True)
+        edited_object = self.collection.get_active()
 
 
-        # adjust the status of the menu entries related to the editor
-        self.ui.menueditedit.setDisabled(True)
-        self.ui.menueditok.setDisabled(False)
+        if isinstance(edited_object, FlatCAMGerber) or isinstance(edited_object, FlatCAMGeometry) or \
+                isinstance(edited_object, FlatCAMExcellon):
 
 
-        edited_object = self.collection.get_active()
+            # adjust the status of the menu entries related to the editor
+            self.ui.menueditedit.setDisabled(True)
+            self.ui.menueditok.setDisabled(False)
+        else:
+            self.inform.emit(_("[WARNING_NOTCL] Select a Geometry or Excellon Object to edit."))
+            return
 
 
         if isinstance(edited_object, FlatCAMGeometry):
         if isinstance(edited_object, FlatCAMGeometry):
             # store the Geometry Editor Toolbar visibility before entering in the Editor
             # store the Geometry Editor Toolbar visibility before entering in the Editor
@@ -2131,10 +2133,6 @@ class App(QtCore.QObject):
             # set call source to the Editor we go into
             # set call source to the Editor we go into
             self.call_source = 'grb_editor'
             self.call_source = 'grb_editor'
 
 
-        else:
-            self.inform.emit(_("[WARNING_NOTCL] Select a Geometry or Excellon Object to edit."))
-            return
-
         # make sure that we can't select another object while in Editor Mode:
         # make sure that we can't select another object while in Editor Mode:
         self.collection.view.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
         self.collection.view.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
 
 
@@ -2168,60 +2166,96 @@ class App(QtCore.QObject):
             edited_obj = self.collection.get_active()
             edited_obj = self.collection.get_active()
             obj_type = ""
             obj_type = ""
 
 
-            if isinstance(edited_obj, FlatCAMGeometry):
-                obj_type = "Geometry"
-                if cleanup is None:
-                    self.geo_editor.update_fcgeometry(edited_obj)
-                    self.geo_editor.update_options(edited_obj)
-                self.geo_editor.deactivate()
-
-                # update the geo object options so it is including the bounding box values
-                try:
-                    xmin, ymin, xmax, ymax = edited_obj.bounds()
-                    edited_obj.options['xmin'] = xmin
-                    edited_obj.options['ymin'] = ymin
-                    edited_obj.options['xmax'] = xmax
-                    edited_obj.options['ymax'] = ymax
-                except AttributeError as e:
-                    self.inform.emit(_("[WARNING] Object empty after edit."))
-                    log. debug("App.editor2object() --> Geometry --> %s" % str(e))
-
-            elif isinstance(edited_obj, FlatCAMGerber):
-                new_obj = self.collection.get_active()
-                obj_type = "Gerber"
-                if cleanup is None:
-                    self.grb_editor.update_fcgerber(edited_obj)
-                    self.grb_editor.update_options(new_obj)
-                self.grb_editor.deactivate_grb_editor()
-
-                # delete the old object (the source object) if it was an empty one
-                if edited_obj.solid_geometry.is_empty:
-                    old_name = edited_obj.options['name']
-                    self.collection.set_active(old_name)
-                    self.collection.delete_active()
-                else:
-                    # update the geo object options so it is including the bounding box values
-                    # but don't do this for objects that are made out of empty source objects, it will fail
-                    try:
-                        xmin, ymin, xmax, ymax = new_obj.bounds()
-                        new_obj.options['xmin'] = xmin
-                        new_obj.options['ymin'] = ymin
-                        new_obj.options['xmax'] = xmax
-                        new_obj.options['ymax'] = ymax
-                    except Exception as e:
-                        self.inform.emit(_("[WARNING] Object empty after edit."))
-                        log.debug("App.editor2object() --> Gerber --> %s" % str(e))
-
-            elif isinstance(edited_obj, FlatCAMExcellon):
-                obj_type = "Excellon"
-                if cleanup is None:
-                    self.exc_editor.update_fcexcellon(edited_obj)
-                    self.exc_editor.update_options(edited_obj)
-                self.exc_editor.deactivate()
+            if cleanup is None:
+                msgbox = QtWidgets.QMessageBox()
+                msgbox.setText(_("Do you want to save the edited object?"))
+                msgbox.setWindowTitle(_("Close Editor"))
+                msgbox.setWindowIcon(QtGui.QIcon('share/save_as.png'))
+
+                bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
+                bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
+                bt_cancel = msgbox.addButton(_('Cancel'), QtWidgets.QMessageBox.RejectRole)
+
+                msgbox.setDefaultButton(bt_yes)
+                msgbox.exec_()
+                response = msgbox.clickedButton()
+
+                if response == bt_yes:
+                    if isinstance(edited_obj, FlatCAMGeometry):
+                        obj_type = "Geometry"
+                        if cleanup is None:
+                            self.geo_editor.update_fcgeometry(edited_obj)
+                            self.geo_editor.update_options(edited_obj)
+                        self.geo_editor.deactivate()
+
+                        # update the geo object options so it is including the bounding box values
+                        try:
+                            xmin, ymin, xmax, ymax = edited_obj.bounds()
+                            edited_obj.options['xmin'] = xmin
+                            edited_obj.options['ymin'] = ymin
+                            edited_obj.options['xmax'] = xmax
+                            edited_obj.options['ymax'] = ymax
+                        except AttributeError as e:
+                            self.inform.emit(_("[WARNING] Object empty after edit."))
+                            log.debug("App.editor2object() --> Geometry --> %s" % str(e))
+                    elif isinstance(edited_obj, FlatCAMGerber):
+                        new_obj = self.collection.get_active()
+                        obj_type = "Gerber"
+                        if cleanup is None:
+                            self.grb_editor.update_fcgerber(edited_obj)
+                            self.grb_editor.update_options(new_obj)
+                        self.grb_editor.deactivate_grb_editor()
+
+                        # delete the old object (the source object) if it was an empty one
+                        if edited_obj.solid_geometry.is_empty:
+                            old_name = edited_obj.options['name']
+                            self.collection.set_active(old_name)
+                            self.collection.delete_active()
+                        else:
+                            # update the geo object options so it is including the bounding box values
+                            # but don't do this for objects that are made out of empty source objects, it will fail
+                            try:
+                                xmin, ymin, xmax, ymax = new_obj.bounds()
+                                new_obj.options['xmin'] = xmin
+                                new_obj.options['ymin'] = ymin
+                                new_obj.options['xmax'] = xmax
+                                new_obj.options['ymax'] = ymax
+                            except Exception as e:
+                                self.inform.emit(_("[WARNING] Object empty after edit."))
+                                log.debug("App.editor2object() --> Gerber --> %s" % str(e))
+                    elif isinstance(edited_obj, FlatCAMExcellon):
+                        obj_type = "Excellon"
+                        if cleanup is None:
+                            self.exc_editor.update_fcexcellon(edited_obj)
+                            self.exc_editor.update_options(edited_obj)
+                        self.exc_editor.deactivate()
+                    else:
+                        self.inform.emit(_("[WARNING_NOTCL] Select a Gerber, Geometry or Excellon Object to update."))
+                        return
 
 
+                    self.inform.emit(_("[selected] %s is updated, returning to App...") % obj_type)
+                elif response == bt_no:
+                    if isinstance(edited_obj, FlatCAMGeometry):
+                        self.geo_editor.deactivate()
+                    elif isinstance(edited_obj, FlatCAMGerber):
+                        self.grb_editor.deactivate_grb_editor()
+                    elif isinstance(edited_obj, FlatCAMExcellon):
+                        self.exc_editor.deactivate()
+                    else:
+                        self.inform.emit(_("[WARNING_NOTCL] Select a Gerber, Geometry or Excellon Object to update."))
+                        return
+                elif response == bt_cancel:
+                    return
             else:
             else:
-                self.inform.emit(_("[WARNING_NOTCL] Select a Gerber, Geometry or Excellon Object to update."))
-                return
+                if isinstance(edited_obj, FlatCAMGeometry):
+                    self.geo_editor.deactivate()
+                elif isinstance(edited_obj, FlatCAMGerber):
+                    self.grb_editor.deactivate_grb_editor()
+                elif isinstance(edited_obj, FlatCAMExcellon):
+                    self.exc_editor.deactivate()
+                else:
+                    self.inform.emit(_("[WARNING_NOTCL] Select a Gerber, Geometry or Excellon Object to update."))
+                    return
 
 
             # if notebook is hidden we show it
             # if notebook is hidden we show it
             if self.ui.splitter.sizes()[0] == 0:
             if self.ui.splitter.sizes()[0] == 0:
@@ -2233,11 +2267,7 @@ class App(QtCore.QObject):
             edited_obj.plot()
             edited_obj.plot()
             self.ui.plot_tab_area.setTabText(0, "Plot Area")
             self.ui.plot_tab_area.setTabText(0, "Plot Area")
             self.ui.plot_tab_area.protectTab(0)
             self.ui.plot_tab_area.protectTab(0)
-            self.inform.emit(_("[selected] %s is updated, returning to App...") % obj_type)
 
 
-            # reset the Object UI to original settings
-            # edited_obj.set_ui(edited_obj.ui_type())
-            # edited_obj.build_ui()
             # make sure that we reenable the selection on Project Tab after returning from Editor Mode:
             # make sure that we reenable the selection on Project Tab after returning from Editor Mode:
             self.collection.view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
             self.collection.view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
 
 
@@ -3222,17 +3252,19 @@ class App(QtCore.QObject):
                            "Do you want to Save the project?"))
                            "Do you want to Save the project?"))
             msgbox.setWindowTitle(_("Save changes"))
             msgbox.setWindowTitle(_("Save changes"))
             msgbox.setWindowIcon(QtGui.QIcon('share/save_as.png'))
             msgbox.setWindowIcon(QtGui.QIcon('share/save_as.png'))
-            msgbox.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No |
-                                      QtWidgets.QMessageBox.Cancel)
-            msgbox.setDefaultButton(QtWidgets.QMessageBox.Yes)
+            bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
+            bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
+            bt_cancel = msgbox.addButton(_('Cancel'), QtWidgets.QMessageBox.RejectRole)
 
 
-            response = msgbox.exec_()
+            msgbox.setDefaultButton(bt_yes)
+            msgbox.exec_()
+            response = msgbox.clickedButton()
 
 
-            if response == QtWidgets.QMessageBox.Yes:
+            if response == bt_yes:
                 self.on_file_saveprojectas(thread=True, quit=True)
                 self.on_file_saveprojectas(thread=True, quit=True)
-            elif response == QtWidgets.QMessageBox.No:
+            elif response == bt_no:
                 self.quit_application()
                 self.quit_application()
-            elif response == QtWidgets.QMessageBox.Cancel:
+            elif response == bt_cancel:
                 return
                 return
         else:
         else:
             self.quit_application()
             self.quit_application()
@@ -3553,12 +3585,14 @@ class App(QtCore.QObject):
         msgbox.setText("<B>Change project units ...</B>")
         msgbox.setText("<B>Change project units ...</B>")
         msgbox.setInformativeText("Changing the units of the project causes all geometrical "
         msgbox.setInformativeText("Changing the units of the project causes all geometrical "
                                   "properties of all objects to be scaled accordingly.\nContinue?")
                                   "properties of all objects to be scaled accordingly.\nContinue?")
-        msgbox.setStandardButtons(QtWidgets.QMessageBox.Cancel | QtWidgets.QMessageBox.Ok)
-        msgbox.setDefaultButton(QtWidgets.QMessageBox.Ok)
+        bt_ok = msgbox.addButton(_('Ok'), QtWidgets.QMessageBox.AcceptRole)
+        bt_cancel = msgbox.addButton(_('Cancel'), QtWidgets.QMessageBox.RejectRole)
 
 
-        response = msgbox.exec_()
+        msgbox.setDefaultButton(bt_ok)
+        msgbox.exec_()
+        response = msgbox.clickedButton()
 
 
-        if response == QtWidgets.QMessageBox.Ok:
+        if response == bt_ok:
             self.options_read_form()
             self.options_read_form()
             scale_options(factor)
             scale_options(factor)
             self.options_write_form()
             self.options_write_form()
@@ -4316,8 +4350,9 @@ class App(QtCore.QObject):
                                    "Go to Preferences -> General - Show Advanced Options."))
                                    "Go to Preferences -> General - Show Advanced Options."))
                     msgbox.setWindowTitle("Tool adding ...")
                     msgbox.setWindowTitle("Tool adding ...")
                     msgbox.setWindowIcon(QtGui.QIcon('share/warning.png'))
                     msgbox.setWindowIcon(QtGui.QIcon('share/warning.png'))
-                    msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
-                    msgbox.setDefaultButton(QtWidgets.QMessageBox.Ok)
+                    bt_ok = msgbox.addButton(_('Ok'), QtWidgets.QMessageBox.AcceptRole)
+
+                    msgbox.setDefaultButton(bt_ok)
                     msgbox.exec_()
                     msgbox.exec_()
 
 
         # work only if the notebook tab on focus is the Tools_Tab
         # work only if the notebook tab on focus is the Tools_Tab
@@ -5526,17 +5561,20 @@ class App(QtCore.QObject):
                            "Do you want to Save the project?"))
                            "Do you want to Save the project?"))
             msgbox.setWindowTitle(_("Save changes"))
             msgbox.setWindowTitle(_("Save changes"))
             msgbox.setWindowIcon(QtGui.QIcon('share/save_as.png'))
             msgbox.setWindowIcon(QtGui.QIcon('share/save_as.png'))
-            msgbox.setStandardButtons(QtWidgets.QMessageBox.Cancel | QtWidgets.QMessageBox.Yes |
-                                      QtWidgets.QMessageBox.No)
-            msgbox.setDefaultButton(QtWidgets.QMessageBox.Ok)
+            bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
+            bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
+            bt_cancel = msgbox.addButton(_('Cancel'), QtWidgets.QMessageBox.RejectRole)
 
 
-            response = msgbox.exec_()
+            msgbox.setDefaultButton(bt_yes)
+            msgbox.exec_()
+            response = msgbox.clickedButton()
 
 
-            if response == QtWidgets.QMessageBox.Yes:
+            if response == bt_yes:
                 self.on_file_saveprojectas()
                 self.on_file_saveprojectas()
-            elif response == QtWidgets.QMessageBox.Cancel:
+            elif response == bt_cancel:
                 return
                 return
-            self.on_file_new()
+            elif response == bt_no:
+                self.on_file_new()
         else:
         else:
             self.on_file_new()
             self.on_file_new()
         self.inform.emit(_("[success] New Project created..."))
         self.inform.emit(_("[success] New Project created..."))
@@ -5788,8 +5826,8 @@ class App(QtCore.QObject):
             msg = _("Please Select a Geometry object to export")
             msg = _("Please Select a Geometry object to export")
             msgbox = QtWidgets.QMessageBox()
             msgbox = QtWidgets.QMessageBox()
             msgbox.setInformativeText(msg)
             msgbox.setInformativeText(msg)
-            msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
-            msgbox.setDefaultButton(QtWidgets.QMessageBox.Ok)
+            bt_ok = msgbox.addButton(_('Ok'), QtWidgets.QMessageBox.AcceptRole)
+            msgbox.setDefaultButton(bt_ok)
             msgbox.exec_()
             msgbox.exec_()
             return
             return
 
 
@@ -5799,8 +5837,8 @@ class App(QtCore.QObject):
             msg = _("[ERROR_NOTCL] Only Geometry, Gerber and CNCJob objects can be used.")
             msg = _("[ERROR_NOTCL] Only Geometry, Gerber and CNCJob objects can be used.")
             msgbox = QtWidgets.QMessageBox()
             msgbox = QtWidgets.QMessageBox()
             msgbox.setInformativeText(msg)
             msgbox.setInformativeText(msg)
-            msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
-            msgbox.setDefaultButton(QtWidgets.QMessageBox.Ok)
+            bt_ok = msgbox.addButton(_('Ok'), QtWidgets.QMessageBox.AcceptRole)
+            msgbox.setDefaultButton(bt_ok)
             msgbox.exec_()
             msgbox.exec_()
             return
             return
 
 
@@ -5985,8 +6023,8 @@ class App(QtCore.QObject):
             msg = _("Please Select a Geometry object to export")
             msg = _("Please Select a Geometry object to export")
             msgbox = QtWidgets.QMessageBox()
             msgbox = QtWidgets.QMessageBox()
             msgbox.setInformativeText(msg)
             msgbox.setInformativeText(msg)
-            msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
-            msgbox.setDefaultButton(QtWidgets.QMessageBox.Ok)
+            bt_ok = msgbox.addButton(_('Ok'), QtWidgets.QMessageBox.AcceptRole)
+            msgbox.setDefaultButton(bt_ok)
             msgbox.exec_()
             msgbox.exec_()
             return
             return
 
 
@@ -5995,9 +6033,10 @@ class App(QtCore.QObject):
             msg = _("[ERROR_NOTCL] Only Geometry objects can be used.")
             msg = _("[ERROR_NOTCL] Only Geometry objects can be used.")
             msgbox = QtWidgets.QMessageBox()
             msgbox = QtWidgets.QMessageBox()
             msgbox.setInformativeText(msg)
             msgbox.setInformativeText(msg)
-            msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
-            msgbox.setDefaultButton(QtWidgets.QMessageBox.Ok)
+            bt_ok = msgbox.addButton(_('Ok'), QtWidgets.QMessageBox.AcceptRole)
+            msgbox.setDefaultButton(bt_ok)
             msgbox.exec_()
             msgbox.exec_()
+
             return
             return
 
 
         name = self.collection.get_active().options["name"]
         name = self.collection.get_active().options["name"]

+ 6 - 4
FlatCAMTranslation.py

@@ -86,12 +86,14 @@ def on_language_apply_click(app, restart=False):
         msgbox.setInformativeText("Are you sure do you want to change the current language to %s?" % name.capitalize())
         msgbox.setInformativeText("Are you sure do you want to change the current language to %s?" % name.capitalize())
         msgbox.setWindowTitle("Apply Language ...")
         msgbox.setWindowTitle("Apply Language ...")
         msgbox.setWindowIcon(QtGui.QIcon('share/language32.png'))
         msgbox.setWindowIcon(QtGui.QIcon('share/language32.png'))
-        msgbox.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Cancel)
-        msgbox.setDefaultButton(QtWidgets.QMessageBox.Yes)
+        bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
+        bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
 
 
-        response = msgbox.exec_()
+        msgbox.setDefaultButton(bt_yes)
+        msgbox.exec_()
+        response = msgbox.clickedButton()
 
 
-        if response == QtWidgets.QMessageBox.Cancel:
+        if response == bt_no:
             return
             return
         else:
         else:
             settings = QSettings("Open Source", "FlatCAM")
             settings = QSettings("Open Source", "FlatCAM")

+ 3 - 0
README.md

@@ -23,6 +23,9 @@ CAD program, and create G-Code for Isolation routing.
 - when adding an aperture with code '0' (zero) it will automatically be set with size zero and type: 'REG' (from region); here we store all the regions from a Gerber file, the ones without a declared aperture
 - when adding an aperture with code '0' (zero) it will automatically be set with size zero and type: 'REG' (from region); here we store all the regions from a Gerber file, the ones without a declared aperture
 - Gerber Editor: added support for Gerber polarity change commands (LPD, LPC)
 - Gerber Editor: added support for Gerber polarity change commands (LPD, LPC)
 - moved the polarity change processing from FlatCAMGrbEditor() class to camlib.Gerber().parse_lines()
 - moved the polarity change processing from FlatCAMGrbEditor() class to camlib.Gerber().parse_lines()
+- made optional the saving of an edited object. Now the user can cancel the changes to the object.
+- replaced the standard buttons in the QMessageBox's used in the app with custom ones that can have text translated
+- updated the POT translation file and the MO/PO files for English and Romanian language
 
 
 11.04.2019
 11.04.2019
 
 

+ 8 - 0
flatcamEditors/FlatCAMExcEditor.py

@@ -1604,6 +1604,10 @@ class FlatCAMExcEditor(QtCore.QObject):
         if self.app.ui.grid_snap_btn.isChecked() is False:
         if self.app.ui.grid_snap_btn.isChecked() is False:
             self.app.ui.grid_snap_btn.trigger()
             self.app.ui.grid_snap_btn.trigger()
 
 
+        # adjust the visibility of some of the canvas context menu
+        self.app.ui.popmenu_edit.setVisible(False)
+        self.app.ui.popmenu_save.setVisible(True)
+
         # Tell the App that the editor is active
         # Tell the App that the editor is active
         self.editor_active = True
         self.editor_active = True
 
 
@@ -1657,6 +1661,10 @@ class FlatCAMExcEditor(QtCore.QObject):
         self.app.ui.g_editor_cmenu.setEnabled(False)
         self.app.ui.g_editor_cmenu.setEnabled(False)
         self.app.ui.e_editor_cmenu.setEnabled(False)
         self.app.ui.e_editor_cmenu.setEnabled(False)
 
 
+        # adjust the visibility of some of the canvas context menu
+        self.app.ui.popmenu_edit.setVisible(True)
+        self.app.ui.popmenu_save.setVisible(False)
+
         # Show original geometry
         # Show original geometry
         if self.exc_obj:
         if self.exc_obj:
             self.exc_obj.visible = True
             self.exc_obj.visible = True

+ 16 - 5
flatcamEditors/FlatCAMGeoEditor.py

@@ -2864,6 +2864,10 @@ class FlatCAMGeoEditor(QtCore.QObject):
         for w in sel_tab_widget_list:
         for w in sel_tab_widget_list:
             w.setEnabled(False)
             w.setEnabled(False)
 
 
+        # adjust the visibility of some of the canvas context menu
+        self.app.ui.popmenu_edit.setVisible(False)
+        self.app.ui.popmenu_save.setVisible(True)
+
         # Tell the App that the editor is active
         # Tell the App that the editor is active
         self.editor_active = True
         self.editor_active = True
 
 
@@ -2915,6 +2919,18 @@ class FlatCAMGeoEditor(QtCore.QObject):
         # Tell the app that the editor is no longer active
         # Tell the app that the editor is no longer active
         self.editor_active = False
         self.editor_active = False
 
 
+        # adjust the visibility of some of the canvas context menu
+        self.app.ui.popmenu_edit.setVisible(True)
+        self.app.ui.popmenu_save.setVisible(False)
+
+        try:
+            # re-enable all the widgets in the Selected Tab that were disabled after entering in Edit Geometry Mode
+            sel_tab_widget_list = self.app.ui.selected_tab.findChildren(QtWidgets.QWidget)
+            for w in sel_tab_widget_list:
+                w.setEnabled(True)
+        except Exception as e:
+            log.debug("FlatCAMGeoEditor.deactivate() --> %s" % str(e))
+
         # Show original geometry
         # Show original geometry
         if self.fcgeometry:
         if self.fcgeometry:
             self.fcgeometry.visible = True
             self.fcgeometry.visible = True
@@ -3637,11 +3653,6 @@ class FlatCAMGeoEditor(QtCore.QObject):
             for shape in self.storage.get_objects():
             for shape in self.storage.get_objects():
                 fcgeometry.solid_geometry.append(shape.geo)
                 fcgeometry.solid_geometry.append(shape.geo)
 
 
-        # re-enable all the widgets in the Selected Tab that were disabled after entering in Edit Geometry Mode
-        sel_tab_widget_list = self.app.ui.selected_tab.findChildren(QtWidgets.QWidget)
-        for w in sel_tab_widget_list:
-            w.setEnabled(True)
-
     def update_options(self, obj):
     def update_options(self, obj):
         if self.paint_tooldia:
         if self.paint_tooldia:
             obj.options['cnctooldia'] = self.paint_tooldia
             obj.options['cnctooldia'] = self.paint_tooldia

+ 8 - 0
flatcamEditors/FlatCAMGrbEditor.py

@@ -1767,6 +1767,10 @@ class FlatCAMGrbEditor(QtCore.QObject):
         if self.app.ui.grid_snap_btn.isChecked() is False:
         if self.app.ui.grid_snap_btn.isChecked() is False:
             self.app.ui.grid_snap_btn.trigger()
             self.app.ui.grid_snap_btn.trigger()
 
 
+        # adjust the visibility of some of the canvas context menu
+        self.app.ui.popmenu_edit.setVisible(False)
+        self.app.ui.popmenu_save.setVisible(True)
+
         # Tell the App that the editor is active
         # Tell the App that the editor is active
         self.editor_active = True
         self.editor_active = True
 
 
@@ -1821,6 +1825,10 @@ class FlatCAMGrbEditor(QtCore.QObject):
         self.app.ui.grb_editor_cmenu.setEnabled(False)
         self.app.ui.grb_editor_cmenu.setEnabled(False)
         self.app.ui.e_editor_cmenu.setEnabled(False)
         self.app.ui.e_editor_cmenu.setEnabled(False)
 
 
+        # adjust the visibility of some of the canvas context menu
+        self.app.ui.popmenu_edit.setVisible(True)
+        self.app.ui.popmenu_save.setVisible(False)
+
         # Show original geometry
         # Show original geometry
         if self.gerber_obj:
         if self.gerber_obj:
             self.gerber_obj.visible = True
             self.gerber_obj.visible = True

+ 8 - 7
flatcamGUI/FlatCAMGUI.py

@@ -223,7 +223,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
         # Separator
         # Separator
         self.menuedit.addSeparator()
         self.menuedit.addSeparator()
         self.menueditedit = self.menuedit.addAction(QtGui.QIcon('share/edit16.png'), _('Edit Object\tE'))
         self.menueditedit = self.menuedit.addAction(QtGui.QIcon('share/edit16.png'), _('Edit Object\tE'))
-        self.menueditok = self.menuedit.addAction(QtGui.QIcon('share/edit_ok16.png'), _('Save && Close Editor\tCTRL+S'))
+        self.menueditok = self.menuedit.addAction(QtGui.QIcon('share/edit_ok16.png'), _('Close Editor\tCTRL+S'))
 
 
         # adjust the initial state of the menu entries related to the editor
         # adjust the initial state of the menu entries related to the editor
         self.menueditedit.setDisabled(False)
         self.menueditedit.setDisabled(False)
@@ -1546,7 +1546,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
         self.popmenu_copy = self.popMenu.addAction(QtGui.QIcon('share/copy32.png'), _("Copy"))
         self.popmenu_copy = self.popMenu.addAction(QtGui.QIcon('share/copy32.png'), _("Copy"))
         self.popmenu_delete = self.popMenu.addAction(QtGui.QIcon('share/delete32.png'), _("Delete"))
         self.popmenu_delete = self.popMenu.addAction(QtGui.QIcon('share/delete32.png'), _("Delete"))
         self.popmenu_edit = self.popMenu.addAction(QtGui.QIcon('share/edit32.png'), _("Edit"))
         self.popmenu_edit = self.popMenu.addAction(QtGui.QIcon('share/edit32.png'), _("Edit"))
-        self.popmenu_save = self.popMenu.addAction(QtGui.QIcon('share/floppy32.png'), _("Save && Close Edit"))
+        self.popmenu_save = self.popMenu.addAction(QtGui.QIcon('share/floppy32.png'), _("Close Editor"))
         self.popmenu_save.setVisible(False)
         self.popmenu_save.setVisible(False)
         self.popMenu.addSeparator()
         self.popMenu.addSeparator()
 
 
@@ -3534,18 +3534,19 @@ class GeneralGUISetGroupUI(OptionsGroupUI):
 
 
     def handle_clear(self):
     def handle_clear(self):
         msgbox = QtWidgets.QMessageBox()
         msgbox = QtWidgets.QMessageBox()
-        # msgbox.setText("<B>Save changes ...</B>")
         msgbox.setText(_("Are you sure you want to delete the GUI Settings? "
         msgbox.setText(_("Are you sure you want to delete the GUI Settings? "
                        "\n")
                        "\n")
                        )
                        )
         msgbox.setWindowTitle(_("Clear GUI Settings"))
         msgbox.setWindowTitle(_("Clear GUI Settings"))
         msgbox.setWindowIcon(QtGui.QIcon('share/trash32.png'))
         msgbox.setWindowIcon(QtGui.QIcon('share/trash32.png'))
-        msgbox.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
-        msgbox.setDefaultButton(QtWidgets.QMessageBox.No)
+        bt_yes = msgbox.addButton(_('Yes'), QtWidgets.QMessageBox.YesRole)
+        bt_no = msgbox.addButton(_('No'), QtWidgets.QMessageBox.NoRole)
 
 
-        response = msgbox.exec_()
+        msgbox.setDefaultButton(bt_no)
+        msgbox.exec_()
+        response = msgbox.clickedButton()
 
 
-        if response == QtWidgets.QMessageBox.Yes:
+        if response == bt_yes:
             settings = QSettings("Open Source", "FlatCAM")
             settings = QSettings("Open Source", "FlatCAM")
             for key in settings.allKeys():
             for key in settings.allKeys():
                 settings.remove(key)
                 settings.remove(key)

BIN
locale/en/LC_MESSAGES/strings.mo


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


BIN
locale/ro/LC_MESSAGES/strings.mo


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


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


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