- added a new option for the Gerber objects: on the project context menu now can be chosen a color for the selected Gerber object

This commit is contained in:
Marius Stanciu
2019-12-22 06:52:45 +02:00
committed by Marius
parent 73d41816d6
commit 612666d01a
14 changed files with 251 additions and 32 deletions

View File

@@ -15,7 +15,9 @@ from shapely.geometry import Point, Polygon, MultiPolygon, MultiLineString, Line
from shapely.ops import cascaded_union
import shapely.affinity as affinity
from copy import deepcopy, copy
from copy import deepcopy
from copy import copy
from io import StringIO
import traceback
import inspect # TODO: For debugging only.
@@ -30,6 +32,8 @@ from flatcamParsers.ParseGerber import Gerber
from camlib import Geometry, CNCjob
import FlatCAMApp
from flatcamGUI.VisPyVisuals import ShapeCollection
import tkinter as tk
import os, sys, itertools
import ezdxf
@@ -104,9 +108,13 @@ class FlatCAMObj(QtCore.QObject):
if self.app.is_legacy is False:
self.shapes = self.app.plotcanvas.new_shape_group()
# self.shapes = ShapeCollection(parent=self.app.plotcanvas.view.scene, pool=self.app.pool, layers=2)
else:
self.shapes = ShapeCollectionLegacy(obj=self, app=self.app, name=name)
self.fill_color = self.app.defaults['global_plot_fill']
self.outline_color = self.app.defaults['global_plot_line']
self.mark_shapes = dict()
self.item = None # Link with project view item
@@ -1665,12 +1673,12 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
if 'color' in kwargs:
color = kwargs['color']
else:
color = self.app.defaults['global_plot_line']
color = self.outline_color
if 'face_color' in kwargs:
face_color = kwargs['face_color']
else:
face_color = self.app.defaults['global_plot_fill']
face_color = self.fill_color
if 'visible' not in kwargs:
visible = self.options['plot']
@@ -1740,7 +1748,10 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
for el in g:
self.add_shape(shape=el, color=random_color() if self.options['multicolored'] else 'black',
visible=visible)
self.shapes.redraw()
self.shapes.redraw(
# update_colors=(self.fill_color, self.outline_color),
# indexes=self.app.plotcanvas.shape_collection.data.keys()
)
except (ObjectDeleted, AttributeError):
self.shapes.clear(update=True)
except Exception as e: