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

- now the Edit command (either from Menu Edit ->Edit Object) or through the shortcut key (E key) or project tab context menu works also for the CNCJob objects (will open a text Editor with the GCode)

Marius Stanciu 5 лет назад
Родитель
Сommit
18e128c57b
3 измененных файлов с 15 добавлено и 5 удалено
  1. 1 0
      CHANGELOG.md
  2. 11 3
      FlatCAMApp.py
  3. 3 2
      flatcamObjects/ObjectCollection.py

+ 1 - 0
CHANGELOG.md

@@ -14,6 +14,7 @@ CHANGELOG for FlatCAM beta
 - solved the issue with the GUI in the Notebook being expanded too much in width due of the FCDoubleSpinner and FCSpinner sizeHint by setting the sizePolicy to Ignored value
 - fixed the workspace being always A4
 - added a label in the status bar to show if the workplace is active and what size it is
+- now the Edit command (either from Menu Edit ->Edit Object) or through the shortcut key (E key) or project tab context menu works also for the CNCJob objects (will open a text Editor with the GCode)
 
 16.05.2020
 

+ 11 - 3
FlatCAMApp.py

@@ -2134,7 +2134,7 @@ class App(QtCore.QObject):
 
     def object2editor(self):
         """
-        Send the current Geometry or Excellon object (if any) into the it's editor.
+        Send the current Geometry, Gerber, Excellon object or CNCJob (if any) into the it's editor.
 
         :return: None
         """
@@ -2146,10 +2146,10 @@ class App(QtCore.QObject):
         edited_object = self.collection.get_active()
 
         if isinstance(edited_object, GerberObject) or isinstance(edited_object, GeometryObject) or \
-                isinstance(edited_object, ExcellonObject):
+                isinstance(edited_object, ExcellonObject) or isinstance(edited_object, CNCJobObject):
             pass
         else:
-            self.inform.emit('[WARNING_NOTCL] %s' % _("Select a Geometry, Gerber or Excellon Object to edit."))
+            self.inform.emit('[WARNING_NOTCL] %s' % _("Select a Geometry, Gerber, Excellon or CNCJob Object to edit."))
             return
 
         if isinstance(edited_object, GeometryObject):
@@ -2213,6 +2213,14 @@ class App(QtCore.QObject):
             edited_object.ui_build = False
             edited_object.build_aperture_storage = False
 
+        elif isinstance(edited_object, CNCJobObject):
+
+            if self.ui.splitter.sizes()[0] == 0:
+                self.ui.splitter.setSizes([1, 1])
+
+            edited_object.on_edit_code_click()
+            return
+
         # make sure that we can't select another object while in Editor Mode:
         # self.collection.view.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
         self.ui.project_frame.setDisabled(True)

+ 3 - 2
flatcamObjects/ObjectCollection.py

@@ -382,8 +382,9 @@ class ObjectCollection(QtCore.QAbstractItemModel):
 
                 if type(obj) != GeometryObject:
                     self.app.ui.menuprojectgeneratecnc.setVisible(False)
-                if type(obj) != GeometryObject and type(obj) != ExcellonObject and type(obj) != GerberObject:
-                    self.app.ui.menuprojectedit.setVisible(False)
+                # if type(obj) != GeometryObject and type(obj) != ExcellonObject and type(obj) != GerberObject or \
+                #         type(obj) != CNCJobObject:
+                #     self.app.ui.menuprojectedit.setVisible(False)
                 if type(obj) != GerberObject and type(obj) != ExcellonObject and type(obj) != CNCJobObject:
                     self.app.ui.menuprojectviewsource.setVisible(False)
                 if type(obj) != GerberObject and type(obj) != GeometryObject and type(obj) != ExcellonObject and \