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

Issue #188: Adopted the solution suggested by JP to not use the operator module when performing the sorting on exobj,tools and use instead the lambda function.

Marius Stanciu 10 лет назад
Родитель
Сommit
1be364d065
1 измененных файлов с 1 добавлено и 3 удалено
  1. 1 3
      camlib.py

+ 1 - 3
camlib.py

@@ -55,8 +55,6 @@ from svgparse import *
 
 
 import logging
 import logging
 
 
-import operator
-
 log = logging.getLogger('base2')
 log = logging.getLogger('base2')
 log.setLevel(logging.DEBUG)
 log.setLevel(logging.DEBUG)
 # log.setLevel(logging.WARNING)
 # log.setLevel(logging.WARNING)
@@ -2713,7 +2711,7 @@ class CNCjob(Geometry):
         
         
         # sort the tools list by the second item in tuple (here we have a dict with diameter of the tool)
         # sort the tools list by the second item in tuple (here we have a dict with diameter of the tool)
         # so we actually are sorting the tools by diameter
         # so we actually are sorting the tools by diameter
-        sorted_tools = sorted(exobj.tools.items(), key = operator.itemgetter(1))    
+        sorted_tools = sorted(exobj.tools.items(), key = (lambda x: x[1]))
         if tools == "all":
         if tools == "all":
             tools = str([i[0] for i in sorted_tools])   # we get a string of ordered tools
             tools = str([i[0] for i in sorted_tools])   # we get a string of ordered tools
             log.debug("Tools 'all' and sorted are: %s" % str(tools))
             log.debug("Tools 'all' and sorted are: %s" % str(tools))