From e54ee9b569f888027526ba434818ad2d02a45c8a Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 11 Mar 2019 19:30:38 +0200 Subject: [PATCH] - 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 --- FlatCAMApp.py | 34 +++++++++++----------------------- README.md | 1 + camlib.py | 18 ++++++++++++++---- flatcamGUI/FlatCAMGUI.py | 3 +++ 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 6c84c3ee..36103204 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -22,6 +22,8 @@ import urllib.request, urllib.parse, urllib.error from contextlib import contextmanager import gc +from xml.dom.minidom import parseString as parse_xml_string + ######################################## ## Imports part of FlatCAM ## ######################################## @@ -44,8 +46,6 @@ from flatcamTools import * from multiprocessing import Pool import tclCommands -# from ParseFont import * - import gettext import FlatCAMTranslation as fcTranslate @@ -2909,7 +2909,6 @@ class App(QtCore.QObject): def final_save(self): if self.should_we_save and self.collection.get_list(): msgbox = QtWidgets.QMessageBox() - # msgbox.setText("Save changes ...") msgbox.setText(_("There are files/objects modified in FlatCAM. " "\n" "Do you want to Save the project?")) @@ -2926,20 +2925,19 @@ class App(QtCore.QObject): elif response == QtWidgets.QMessageBox.Cancel: self.should_we_quit = False return + self.save_defaults() 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): """ @@ -5862,16 +5860,6 @@ class App(QtCore.QObject): except IOError: 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: self.worker_task.emit({'fcn': self.save_project, 'params': [filename]}) diff --git a/README.md b/README.md index 1ed5f8b3..bdeb25bc 100644 --- a/README.md +++ b/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. - grouped all the UI files in flatcamGUI folder - grouped all parsers files in flatcamParsers folder +- changes to the final_save() function 10.03.2019 diff --git a/camlib.py b/camlib.py index e4959db9..919add71 100644 --- a/camlib.py +++ b/camlib.py @@ -9,16 +9,25 @@ #import traceback from io import StringIO + +import numpy as np from numpy import arctan2, Inf, array, sqrt, pi, ceil, sin, cos, dot, float32, \ transpose from numpy.linalg import solve, norm + +import re, sys, os, platform +import math +from copy import deepcopy + import traceback from decimal import Decimal from rtree import index as rtindex +from lxml import etree as ET # 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.ops import cascaded_union, unary_union 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 import shape +import collections from collections import Iterable import rasterio from rasterio.features import shapes +import ezdxf # TODO: Commented for FlatCAM packaging with cx_freeze - # from scipy.spatial import KDTree, Delaunay from flatcamParsers.ParseSVG import * from flatcamParsers.ParseDXF import * import logging -# import pprint -import platform +import FlatCAMApp if platform.architecture()[0] == '64bit': from ortools.constraint_solver import pywrapcp @@ -63,6 +72,7 @@ import builtins if '_' not in builtins.__dict__: _ = gettext.gettext + class ParseError(Exception): pass diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index ecc944e5..42725ddb 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -2569,6 +2569,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.final_save.emit() + if self.app.should_we_quit is False: + event.ignore() + class GeneralPreferencesUI(QtWidgets.QWidget): def __init__(self, parent=None):