diff --git a/FlatCAM.py b/FlatCAM.py index 546877a3..33b2b7c7 100644 --- a/FlatCAM.py +++ b/FlatCAM.py @@ -1,7 +1,7 @@ import sys import os -from PyQt5 import QtWidgets, QtGui +from PyQt5 import QtWidgets from PyQt5.QtCore import QSettings, Qt from FlatCAMApp import App from flatcamGUI import VisPyPatches diff --git a/FlatCAMApp.py b/FlatCAMApp.py index e3d570d2..cc33ca1b 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -9543,7 +9543,7 @@ class App(QtCore.QObject): _filter_ = "Gerber Files (*.gbr *.ger *.gtl *.gbl *.gts *.gbs *.gtp *.gbp *.gto *.gbo *.gm1 *.gml *.gm3 *" \ ".gko *.cmp *.sol *.stc *.sts *.plc *.pls *.crc *.crs *.tsm *.bsm *.ly2 *.ly15 *.dim *.mil *.grb" \ - "*.top *.bot *.smt *.smb *.sst *.ssb *.spt *.spb *.pho *.gdo *.art *.gbd *.gb*);;" \ + "*.top *.bot *.smt *.smb *.sst *.ssb *.spt *.spb *.pho *.gdo *.art *.gbd);;" \ "Protel Files (*.gtl *.gbl *.gts *.gbs *.gto *.gbo *.gtp *.gbp *.gml *.gm1 *.gm3 *.gko);;" \ "Eagle Files (*.cmp *.sol *.stc *.sts *.plc *.pls *.crc *.crs *.tsm *.bsm *.ly2 *.ly15 *.dim " \ "*.mil);;" \ @@ -9570,8 +9570,7 @@ class App(QtCore.QObject): color=QtGui.QColor("gray")) if len(filenames) == 0: - self.inform.emit('[WARNING_NOTCL] %s' % - _("Open Gerber cancelled.")) + self.inform.emit('[WARNING_NOTCL] %s' % _("Open Gerber cancelled.")) else: for filename in filenames: if filename != '': diff --git a/README.md b/README.md index e38cf11e..8fe6e57d 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ CAD program, and create G-Code for Isolation routing. - fix for contextual menus on canvas when using PyQt versions > 5.12.1 - decision on which mouse button to use for panning is done now once when setting the plotcanvas - fix to work with Python 3.8 (closing the application) +- fixed bug in Gerber parser that allowed loading as Gerber of a file that is not a Gerber +- fixed a bug in extension detection for Gerber files that allowed in the filtered list files that extension *.gb* +- added a processEvents method in the Gerber parser parse_lines() method 4.04.2020 diff --git a/flatcamParsers/ParseGerber.py b/flatcamParsers/ParseGerber.py index deba943e..bad7b97d 100644 --- a/flatcamParsers/ParseGerber.py +++ b/flatcamParsers/ParseGerber.py @@ -1,4 +1,4 @@ - +from PyQt5 import QtWidgets from camlib import Geometry, arc, arc_angle, ApertureMacro import FlatCAMApp @@ -1416,6 +1416,8 @@ class Gerber(Geometry): # ######### Line did not match any pattern. Warn user. ########## # ################################################################ log.warning("Line ignored (%d): %s" % (line_num, gline)) + # provide the app with a way to process the GUI events when in a blocking loop + QtWidgets.QApplication.processEvents() try: path_length = len(path) @@ -1475,7 +1477,7 @@ class Gerber(Geometry): sol_geo_length = 1 try: - if buff_length == 0 and sol_geo_length == 0: + if buff_length == 0 and sol_geo_length in [0, 1]: log.error("Object is not Gerber file or empty. Aborting Object creation.") return 'fail' except TypeError as e: