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

- fixed the Properties Project menu entry to work on the new way
- in Properties tool now the Gerber apertures show the number of polygons in 'solid_geometry' instead of listing the objects

Marius Stanciu 6 лет назад
Родитель
Сommit
e54ee9b569
4 измененных файлов с 29 добавлено и 27 удалено
  1. 11 23
      FlatCAMApp.py
  2. 1 0
      README.md
  3. 14 4
      camlib.py
  4. 3 0
      flatcamGUI/FlatCAMGUI.py

+ 11 - 23
FlatCAMApp.py

@@ -22,6 +22,8 @@ import urllib.request, urllib.parse, urllib.error
 from contextlib import contextmanager
 from contextlib import contextmanager
 import gc
 import gc
 
 
+from xml.dom.minidom import parseString as parse_xml_string
+
 ########################################
 ########################################
 ##      Imports part of FlatCAM       ##
 ##      Imports part of FlatCAM       ##
 ########################################
 ########################################
@@ -44,8 +46,6 @@ from flatcamTools import *
 from multiprocessing import Pool
 from multiprocessing import Pool
 import tclCommands
 import tclCommands
 
 
-# from ParseFont import *
-
 import gettext
 import gettext
 import FlatCAMTranslation as fcTranslate
 import FlatCAMTranslation as fcTranslate
 
 
@@ -2909,7 +2909,6 @@ class App(QtCore.QObject):
     def final_save(self):
     def final_save(self):
         if self.should_we_save and self.collection.get_list():
         if self.should_we_save and self.collection.get_list():
             msgbox = QtWidgets.QMessageBox()
             msgbox = QtWidgets.QMessageBox()
-            # msgbox.setText("<B>Save changes ...</B>")
             msgbox.setText(_("There are files/objects modified in FlatCAM. "
             msgbox.setText(_("There are files/objects modified in FlatCAM. "
                            "\n"
                            "\n"
                            "Do you want to Save the project?"))
                            "Do you want to Save the project?"))
@@ -2926,20 +2925,19 @@ class App(QtCore.QObject):
             elif response == QtWidgets.QMessageBox.Cancel:
             elif response == QtWidgets.QMessageBox.Cancel:
                 self.should_we_quit = False
                 self.should_we_quit = False
                 return
                 return
+
         self.save_defaults()
         self.save_defaults()
         log.debug("App.final_save() --> App Defaults saved.")
         log.debug("App.final_save() --> App Defaults saved.")
 
 
-        if self.should_we_quit is True:
-
-            # save toolbar state to file
-            settings = QSettings("Open Source", "FlatCAM")
-            settings.setValue('saved_gui_state', self.ui.saveState())
-            settings.setValue('maximized_gui', self.ui.isMaximized())
+        # save toolbar state to file
+        settings = QSettings("Open Source", "FlatCAM")
+        settings.setValue('saved_gui_state', self.ui.saveState())
+        settings.setValue('maximized_gui', self.ui.isMaximized())
 
 
-            # This will write the setting to the platform specific storage.
-            del settings
-            log.debug("App.final_save() --> App UI state saved.")
-            QtWidgets.qApp.quit()
+        # This will write the setting to the platform specific storage.
+        del settings
+        log.debug("App.final_save() --> App UI state saved.")
+        QtWidgets.qApp.quit()
 
 
     def on_toggle_shell(self):
     def on_toggle_shell(self):
         """
         """
@@ -5862,16 +5860,6 @@ class App(QtCore.QObject):
         except IOError:
         except IOError:
             exists = False
             exists = False
 
 
-        # msg = "Project file exists. Overwrite?"
-        # if exists:
-        #     msgbox = QtWidgets.QMessageBox()
-        #     msgbox.setInformativeText(msg)
-        #     msgbox.setStandardButtons(QtWidgets.QMessageBox.Cancel |QtWidgets.QMessageBox.Ok)
-        #     msgbox.setDefaultButton(QtWidgets.QMessageBox.Cancel)
-        #     result = msgbox.exec_()
-        #     if result ==QtWidgets.QMessageBox.Cancel:
-        #         return
-
         if thread is True:
         if thread is True:
             self.worker_task.emit({'fcn': self.save_project,
             self.worker_task.emit({'fcn': self.save_project,
                                    'params': [filename]})
                                    'params': [filename]})

+ 1 - 0
README.md

@@ -17,6 +17,7 @@ CAD program, and create G-Code for Isolation routing.
 - added a visual cue in Menu -> Edit about the entries to enter the Editor and to Save & Exit Editor. When one is enabled the other is disabled.
 - added a visual cue in Menu -> Edit about the entries to enter the Editor and to Save & Exit Editor. When one is enabled the other is disabled.
 - grouped all the UI files in flatcamGUI folder
 - grouped all the UI files in flatcamGUI folder
 - grouped all parsers files in flatcamParsers folder
 - grouped all parsers files in flatcamParsers folder
+- changes to the final_save() function
 
 
 10.03.2019
 10.03.2019
 
 

+ 14 - 4
camlib.py

@@ -9,16 +9,25 @@
 #import traceback
 #import traceback
 
 
 from io import StringIO
 from io import StringIO
+
+import numpy as np
 from numpy import arctan2, Inf, array, sqrt, pi, ceil, sin, cos, dot, float32, \
 from numpy import arctan2, Inf, array, sqrt, pi, ceil, sin, cos, dot, float32, \
     transpose
     transpose
 from numpy.linalg import solve, norm
 from numpy.linalg import solve, norm
+
+import re, sys, os, platform
+import math
+from copy import deepcopy
+
 import traceback
 import traceback
 from decimal import Decimal
 from decimal import Decimal
 
 
 from rtree import index as rtindex
 from rtree import index as rtindex
+from lxml import etree as ET
 
 
 # See: http://toblerity.org/shapely/manual.html
 # See: http://toblerity.org/shapely/manual.html
-from shapely.geometry import Polygon
+from shapely.geometry import Polygon, LineString, Point, LinearRing, MultiLineString
+from shapely.geometry import MultiPoint, MultiPolygon
 from shapely.geometry import box as shply_box
 from shapely.geometry import box as shply_box
 from shapely.ops import cascaded_union, unary_union
 from shapely.ops import cascaded_union, unary_union
 import shapely.affinity as affinity
 import shapely.affinity as affinity
@@ -27,21 +36,21 @@ from shapely.wkt import dumps as sdumps
 from shapely.geometry.base import BaseGeometry
 from shapely.geometry.base import BaseGeometry
 from shapely.geometry import shape
 from shapely.geometry import shape
 
 
+import collections
 from collections import Iterable
 from collections import Iterable
 
 
 import rasterio
 import rasterio
 from rasterio.features import shapes
 from rasterio.features import shapes
+import ezdxf
 
 
 # TODO: Commented for FlatCAM packaging with cx_freeze
 # TODO: Commented for FlatCAM packaging with cx_freeze
-
 # from scipy.spatial import KDTree, Delaunay
 # from scipy.spatial import KDTree, Delaunay
 
 
 from flatcamParsers.ParseSVG import *
 from flatcamParsers.ParseSVG import *
 from flatcamParsers.ParseDXF import *
 from flatcamParsers.ParseDXF import *
 
 
 import logging
 import logging
-# import pprint
-import platform
+import FlatCAMApp
 
 
 if platform.architecture()[0] == '64bit':
 if platform.architecture()[0] == '64bit':
     from ortools.constraint_solver import pywrapcp
     from ortools.constraint_solver import pywrapcp
@@ -63,6 +72,7 @@ import builtins
 if '_' not in builtins.__dict__:
 if '_' not in builtins.__dict__:
     _ = gettext.gettext
     _ = gettext.gettext
 
 
+
 class ParseError(Exception):
 class ParseError(Exception):
     pass
     pass
 
 

+ 3 - 0
flatcamGUI/FlatCAMGUI.py

@@ -2569,6 +2569,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
 
 
         self.final_save.emit()
         self.final_save.emit()
 
 
+        if self.app.should_we_quit is False:
+            event.ignore()
+
 
 
 class GeneralPreferencesUI(QtWidgets.QWidget):
 class GeneralPreferencesUI(QtWidgets.QWidget):
     def __init__(self, parent=None):
     def __init__(self, parent=None):