- 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
This commit is contained in:
Marius Stanciu
2020-04-05 21:11:48 +03:00
committed by Marius
parent 836122ca24
commit fdd5344581
4 changed files with 10 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
import sys import sys
import os import os
from PyQt5 import QtWidgets, QtGui from PyQt5 import QtWidgets
from PyQt5.QtCore import QSettings, Qt from PyQt5.QtCore import QSettings, Qt
from FlatCAMApp import App from FlatCAMApp import App
from flatcamGUI import VisPyPatches from flatcamGUI import VisPyPatches

View File

@@ -9543,7 +9543,7 @@ class App(QtCore.QObject):
_filter_ = "Gerber Files (*.gbr *.ger *.gtl *.gbl *.gts *.gbs *.gtp *.gbp *.gto *.gbo *.gm1 *.gml *.gm3 *" \ _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" \ ".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);;" \ "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 " \ "Eagle Files (*.cmp *.sol *.stc *.sts *.plc *.pls *.crc *.crs *.tsm *.bsm *.ly2 *.ly15 *.dim " \
"*.mil);;" \ "*.mil);;" \
@@ -9570,8 +9570,7 @@ class App(QtCore.QObject):
color=QtGui.QColor("gray")) color=QtGui.QColor("gray"))
if len(filenames) == 0: if len(filenames) == 0:
self.inform.emit('[WARNING_NOTCL] %s' % self.inform.emit('[WARNING_NOTCL] %s' % _("Open Gerber cancelled."))
_("Open Gerber cancelled."))
else: else:
for filename in filenames: for filename in filenames:
if filename != '': if filename != '':

View File

@@ -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 - 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 - 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) - 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 4.04.2020

View File

@@ -1,4 +1,4 @@
from PyQt5 import QtWidgets
from camlib import Geometry, arc, arc_angle, ApertureMacro from camlib import Geometry, arc, arc_angle, ApertureMacro
import FlatCAMApp import FlatCAMApp
@@ -1416,6 +1416,8 @@ class Gerber(Geometry):
# ######### Line did not match any pattern. Warn user. ########## # ######### Line did not match any pattern. Warn user. ##########
# ################################################################ # ################################################################
log.warning("Line ignored (%d): %s" % (line_num, gline)) 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: try:
path_length = len(path) path_length = len(path)
@@ -1475,7 +1477,7 @@ class Gerber(Geometry):
sol_geo_length = 1 sol_geo_length = 1
try: 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.") log.error("Object is not Gerber file or empty. Aborting Object creation.")
return 'fail' return 'fail'
except TypeError as e: except TypeError as e: