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

Merged master into consolidate

Kamil Sopko 10 лет назад
Родитель
Сommit
0f83e9e5be
2 измененных файлов с 31 добавлено и 18 удалено
  1. 15 7
      FlatCAMApp.py
  2. 16 11
      FlatCAMObj.py

+ 15 - 7
FlatCAMApp.py

@@ -2648,7 +2648,9 @@ class App(QtCore.QObject):
                      'feedrate': float,
                      'tooldia': float,
                      'outname': str,
-                     'spindlespeed': int
+                     'spindlespeed': int,
+                     'multidepth' : bool,
+                     'depthperpass' : float
                      }
 
             for key in kwa:
@@ -3219,13 +3221,15 @@ class App(QtCore.QObject):
             'cncjob': {
                 'fcn': cncjob,
                 'help': 'Generates a CNC Job from a Geometry Object.\n' +
-                        '> cncjob <name> [-z_cut <c>] [-z_move <m>] [-feedrate <f>] [-tooldia <t>] [-spindlespeed (int)] [-outname <n>]\n' +
+                        '> cncjob <name> [-z_cut <c>] [-z_move <float>] [-feedrate <float>] [-tooldia <float>] [-spindlespeed <int>] [-multidepth <bool>] [-depthperpass <float>] [-outname <str>]\n' +
                         '   name: Name of the source object\n' +
                         '   z_cut: Z-axis cutting position\n' +
                         '   z_move: Z-axis moving position\n' +
                         '   feedrate: Moving speed when cutting\n' +
                         '   tooldia: Tool diameter to show on screen\n' +
                         '   spindlespeed: Speed of the spindle in rpm (example: 4000)\n' +
+                        '   multidepth: Use or not multidepth cnccut\n'+
+                        '   depthperpass: Height of one layer for multidepth\n'+
                         '   outname: Name of the output object'
             },
             'write_gcode': {
@@ -3424,13 +3428,17 @@ class App(QtCore.QObject):
         for recent in self.recent:
             filename = recent['filename'].split('/')[-1].split('\\')[-1]
 
-            action = QtGui.QAction(QtGui.QIcon(icons[recent["kind"]]), filename, self)
+            try:
+                action = QtGui.QAction(QtGui.QIcon(icons[recent["kind"]]), filename, self)
+
+                # Attach callback
+                o = make_callback(openers[recent["kind"]], recent['filename'])
+                action.triggered.connect(o)
 
-            # Attach callback
-            o = make_callback(openers[recent["kind"]], recent['filename'])
-            action.triggered.connect(o)
+                self.ui.recent.addAction(action)
 
-            self.ui.recent.addAction(action)
+            except KeyError:
+                App.log.error("Unsupported file type: %s" % recent["kind"])
 
         # self.builder.get_object('open_recent').set_submenu(recent_menu)
         # self.ui.menufilerecent.set_submenu(recent_menu)

+ 16 - 11
FlatCAMObj.py

@@ -144,7 +144,6 @@ class FlatCAMObj(QtCore.QObject):
             except:
                 self.app.log.warning("Unexpected error:", sys.exc_info())
 
-
     def build_ui(self):
         """
         Sets up the UI/form for this object. Show the UI
@@ -199,16 +198,22 @@ class FlatCAMObj(QtCore.QObject):
         :type option: str
         :return: None
         """
-        #try read field only when option have equivalent in form_fields
-        if option in self.form_fields:
-            option_type=type(self.options[option])
-            try:
-                value=self.form_fields[option].get_value()
-            #catch per option as it was ignored anyway, also when syntax error (probably uninitialized field),don't read either.
-            except (KeyError,SyntaxError):
-                self.app.log.warning("Failed to read option from field: %s" % option)
-        else:
-            self.app.log.warning("Form fied does not exists: %s" % option)
+
+        try:
+            self.options[option] = self.form_fields[option].get_value()
+        except KeyError:
+            self.app.log.warning("Failed to read option from field: %s" % option)
+
+        # #try read field only when option have equivalent in form_fields
+        # if option in self.form_fields:
+        #     option_type=type(self.options[option])
+        #     try:
+        #         value=self.form_fields[option].get_value()
+        #     #catch per option as it was ignored anyway, also when syntax error (probably uninitialized field),don't read either.
+        #     except (KeyError,SyntaxError):
+        #         self.app.log.warning("Failed to read option from field: %s" % option)
+        # else:
+        #     self.app.log.warning("Form fied does not exists: %s" % option)
 
     def plot(self):
         """