- fixed an issue in Isolation Tool when running the app in Basic mode;
- fixed Paint, Isolation and NCC Tools such the translated comboboxes values are now stored as indexes instead of translated words as before - in Geometry Object made sure that the widgets in the Tool Table gets populated regardless of encountering non-recognizable translated values - in Paint Tool found a small bug and fixed it
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
from PyQt5 import QtWidgets, QtCore, QtGui
|
||||
|
||||
from appTool import AppTool
|
||||
from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCInputDialog, FCButton, \
|
||||
FCComboBox, OptionalInputSection, FCSpinner, FCLabel, FCInputDialogSpinnerButton
|
||||
from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCButton, \
|
||||
FCComboBox, OptionalInputSection, FCSpinner, FCLabel, FCInputDialogSpinnerButton, FCComboBox2
|
||||
from appParsers.ParseGerber import Gerber
|
||||
from camlib import grace
|
||||
|
||||
@@ -813,14 +813,12 @@ class ToolIsolation(AppTool, Gerber):
|
||||
obj_type = self.ui.reference_combo_type.currentIndex()
|
||||
self.ui.reference_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
|
||||
self.ui.reference_combo.setCurrentIndex(0)
|
||||
self.ui.reference_combo.obj_type = {
|
||||
_("Gerber"): "Gerber", _("Excellon"): "Excellon", _("Geometry"): "Geometry"
|
||||
}[self.ui.reference_combo_type.get_value()]
|
||||
self.ui.reference_combo.obj_type = {0: "Gerber", 1: "Excellon", 2: "Geometry"}[obj_type]
|
||||
|
||||
def on_toggle_reference(self):
|
||||
val = self.ui.select_combo.get_value()
|
||||
|
||||
if val == _("All"):
|
||||
if val == 0: # ALl
|
||||
self.ui.reference_combo.hide()
|
||||
self.ui.reference_combo_label.hide()
|
||||
self.ui.reference_combo_type.hide()
|
||||
@@ -831,7 +829,7 @@ class ToolIsolation(AppTool, Gerber):
|
||||
|
||||
# disable rest-machining for area painting
|
||||
self.ui.rest_cb.setDisabled(False)
|
||||
elif val == _("Area Selection"):
|
||||
elif val == 1: # Area Selection
|
||||
self.ui.reference_combo.hide()
|
||||
self.ui.reference_combo_label.hide()
|
||||
self.ui.reference_combo_type.hide()
|
||||
@@ -843,7 +841,7 @@ class ToolIsolation(AppTool, Gerber):
|
||||
# disable rest-machining for area isolation
|
||||
self.ui.rest_cb.set_value(False)
|
||||
self.ui.rest_cb.setDisabled(True)
|
||||
elif val == _("Polygon Selection"):
|
||||
elif val == 2: # Polygon Selection
|
||||
self.ui.reference_combo.hide()
|
||||
self.ui.reference_combo_label.hide()
|
||||
self.ui.reference_combo_type.hide()
|
||||
@@ -851,7 +849,7 @@ class ToolIsolation(AppTool, Gerber):
|
||||
self.ui.area_shape_label.hide()
|
||||
self.ui.area_shape_radio.hide()
|
||||
self.ui.poly_int_cb.show()
|
||||
else:
|
||||
else: # Reference Object
|
||||
self.ui.reference_combo.show()
|
||||
self.ui.reference_combo_label.show()
|
||||
self.ui.reference_combo_type.show()
|
||||
@@ -1445,9 +1443,9 @@ class ToolIsolation(AppTool, Gerber):
|
||||
"""
|
||||
selection = self.ui.select_combo.get_value()
|
||||
|
||||
if selection == _("All"):
|
||||
if selection == 0: # ALL
|
||||
self.isolate(isolated_obj=isolated_obj)
|
||||
elif selection == _("Area Selection"):
|
||||
elif selection == 1: # Area Selection
|
||||
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Click the start point of the area."))
|
||||
|
||||
if self.app.is_legacy is False:
|
||||
@@ -1466,7 +1464,7 @@ class ToolIsolation(AppTool, Gerber):
|
||||
# disconnect flags
|
||||
self.area_sel_disconnect_flag = True
|
||||
|
||||
elif selection == _("Polygon Selection"):
|
||||
elif selection == 2: # Polygon Selection
|
||||
# disengage the grid snapping since it may be hard to click on polygons with grid snapping on
|
||||
if self.app.ui.grid_snap_btn.isChecked():
|
||||
self.grid_status_memory = True
|
||||
@@ -1487,7 +1485,7 @@ class ToolIsolation(AppTool, Gerber):
|
||||
# disconnect flags
|
||||
self.poly_sel_disconnect_flag = True
|
||||
|
||||
elif selection == _("Reference Object"):
|
||||
elif selection == 3: # Reference Object
|
||||
ref_obj = self.app.collection.get_by_name(self.ui.reference_combo.get_value())
|
||||
ref_geo = unary_union(ref_obj.solid_geometry)
|
||||
use_geo = unary_union(isolated_obj.solid_geometry).difference(ref_geo)
|
||||
@@ -3388,7 +3386,7 @@ class IsoUI:
|
||||
"- 'Polygon Selection' -> Isolate a selection of polygons.\n"
|
||||
"- 'Reference Object' - will process the area specified by another object.")
|
||||
)
|
||||
self.select_combo = FCComboBox()
|
||||
self.select_combo = FCComboBox2()
|
||||
self.select_combo.addItems(
|
||||
[_("All"), _("Area Selection"), _("Polygon Selection"), _("Reference Object")]
|
||||
)
|
||||
@@ -3402,7 +3400,7 @@ class IsoUI:
|
||||
_("The type of FlatCAM object to be used as non copper clearing reference.\n"
|
||||
"It can be Gerber, Excellon or Geometry.")
|
||||
)
|
||||
self.reference_combo_type = FCComboBox()
|
||||
self.reference_combo_type = FCComboBox2()
|
||||
self.reference_combo_type.addItems([_("Gerber"), _("Excellon"), _("Geometry")])
|
||||
|
||||
self.grid3.addWidget(self.reference_combo_type_label, 36, 0)
|
||||
|
||||
@@ -9,7 +9,7 @@ from PyQt5 import QtWidgets, QtCore, QtGui
|
||||
|
||||
from appTool import AppTool
|
||||
from appGUI.GUIElements import FCCheckBox, FCDoubleSpinner, RadioSet, FCTable, FCInputDialog, FCButton,\
|
||||
FCComboBox, OptionalInputSection, FCLabel, FCInputDialogSpinnerButton
|
||||
FCComboBox, OptionalInputSection, FCLabel, FCInputDialogSpinnerButton, FCComboBox2
|
||||
from appParsers.ParseGerber import Gerber
|
||||
|
||||
from camlib import grace
|
||||
@@ -815,9 +815,7 @@ class NonCopperClear(AppTool, Gerber):
|
||||
obj_type = self.ui.reference_combo_type.currentIndex()
|
||||
self.ui.reference_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
|
||||
self.ui.reference_combo.setCurrentIndex(0)
|
||||
self.ui.reference_combo.obj_type = {
|
||||
_("Gerber"): "Gerber", _("Excellon"): "Excellon", _("Geometry"): "Geometry"
|
||||
}[self.ui.reference_combo_type.get_value()]
|
||||
self.ui.reference_combo.obj_type = {0: "Gerber", 1: "Excellon", 2: "Geometry"}[obj_type]
|
||||
|
||||
def on_order_changed(self, order):
|
||||
if order != 'no':
|
||||
@@ -1362,7 +1360,7 @@ class NonCopperClear(AppTool, Gerber):
|
||||
self.o_name = '%s_ncc' % self.obj_name
|
||||
|
||||
self.select_method = self.ui.select_combo.get_value()
|
||||
if self.select_method == _('Itself'):
|
||||
if self.select_method == 0: # Itself
|
||||
self.bound_obj_name = self.ui.object_combo.currentText()
|
||||
# Get source object.
|
||||
try:
|
||||
@@ -1376,7 +1374,7 @@ class NonCopperClear(AppTool, Gerber):
|
||||
isotooldia=self.iso_dia_list,
|
||||
outname=self.o_name,
|
||||
tools_storage=self.ncc_tools)
|
||||
elif self.select_method == _("Area Selection"):
|
||||
elif self.select_method == 1: # Area Selection
|
||||
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Click the start point of the area."))
|
||||
|
||||
if self.app.is_legacy is False:
|
||||
@@ -1395,7 +1393,7 @@ class NonCopperClear(AppTool, Gerber):
|
||||
# disconnect flags
|
||||
self.area_sel_disconnect_flag = True
|
||||
|
||||
elif self.select_method == _("Reference Object"):
|
||||
elif self.select_method == 2: # Reference Object
|
||||
self.bound_obj_name = self.ui.reference_combo.currentText()
|
||||
# Get source object.
|
||||
try:
|
||||
@@ -1976,7 +1974,7 @@ class NonCopperClear(AppTool, Gerber):
|
||||
|
||||
cp = None
|
||||
|
||||
if ncc_method == _("Standard"):
|
||||
if ncc_method == 0: # standard
|
||||
try:
|
||||
cp = self.clear_polygon(pol, tooldia,
|
||||
steps_per_circle=self.circle_steps,
|
||||
@@ -1987,7 +1985,7 @@ class NonCopperClear(AppTool, Gerber):
|
||||
return "fail"
|
||||
except Exception as ee:
|
||||
log.debug("NonCopperClear.clear_polygon_worker() Standard --> %s" % str(ee))
|
||||
elif ncc_method == _("Seed"):
|
||||
elif ncc_method == 1: # seed
|
||||
try:
|
||||
cp = self.clear_polygon2(pol, tooldia,
|
||||
steps_per_circle=self.circle_steps,
|
||||
@@ -1998,7 +1996,7 @@ class NonCopperClear(AppTool, Gerber):
|
||||
return "fail"
|
||||
except Exception as ee:
|
||||
log.debug("NonCopperClear.clear_polygon_worker() Seed --> %s" % str(ee))
|
||||
elif ncc_method == _("Lines"):
|
||||
elif ncc_method == 2: # Lines
|
||||
try:
|
||||
cp = self.clear_polygon3(pol, tooldia,
|
||||
steps_per_circle=self.circle_steps,
|
||||
@@ -2009,7 +2007,7 @@ class NonCopperClear(AppTool, Gerber):
|
||||
return "fail"
|
||||
except Exception as ee:
|
||||
log.debug("NonCopperClear.clear_polygon_worker() Lines --> %s" % str(ee))
|
||||
elif ncc_method == _("Combo"):
|
||||
elif ncc_method == 3: # Combo
|
||||
try:
|
||||
self.app.inform.emit(_("Clearing the polygon with the method: lines."))
|
||||
cp = self.clear_polygon3(pol, tooldia,
|
||||
@@ -2135,7 +2133,7 @@ class NonCopperClear(AppTool, Gerber):
|
||||
|
||||
app_obj.poly_not_cleared = False # flag for polygons not cleared
|
||||
|
||||
if ncc_select == _("Reference Object"):
|
||||
if ncc_select == 2: # Reference Object
|
||||
bbox_geo, bbox_kind = self.calculate_bounding_box(
|
||||
ncc_obj=ncc_obj, box_obj=sel_obj, ncc_select=ncc_select)
|
||||
else:
|
||||
@@ -2263,11 +2261,11 @@ class NonCopperClear(AppTool, Gerber):
|
||||
|
||||
# check if there is a geometry at all in the cleared geometry
|
||||
if cleared_geo:
|
||||
formatted_tool = self.app.dec_format(tool, self.decimals)
|
||||
# find the tooluid associated with the current tool_dia so we know where to add the tool
|
||||
# solid_geometry
|
||||
for k, v in tools_storage.items():
|
||||
if float('%.*f' % (self.decimals, v['tooldia'])) == float('%.*f' % (self.decimals,
|
||||
tool)):
|
||||
if self.app.dec_format(v['tooldia'], self.decimals) == formatted_tool:
|
||||
current_uid = int(k)
|
||||
|
||||
# add the solid_geometry to the current too in self.paint_tools dictionary
|
||||
@@ -2369,7 +2367,7 @@ class NonCopperClear(AppTool, Gerber):
|
||||
# repurposed flag for final object, geo_obj. True if it has any solid_geometry, False if not.
|
||||
app_obj.poly_not_cleared = True
|
||||
|
||||
if ncc_select == _("Reference Object"):
|
||||
if ncc_select == 2: # Reference Object
|
||||
env_obj, box_obj_kind = self.calculate_bounding_box(
|
||||
ncc_obj=ncc_obj, box_obj=sel_obj, ncc_select=ncc_select)
|
||||
else:
|
||||
@@ -2720,7 +2718,7 @@ class NonCopperClear(AppTool, Gerber):
|
||||
self.app.inform.emit(_("NCC Tool. Preparing non-copper polygons."))
|
||||
|
||||
try:
|
||||
if sel_obj is None or sel_obj == _('Itself'):
|
||||
if sel_obj is None or sel_obj == 0: # sel_obj == 'itself'
|
||||
ncc_sel_obj = ncc_obj
|
||||
else:
|
||||
ncc_sel_obj = sel_obj
|
||||
@@ -2729,7 +2727,7 @@ class NonCopperClear(AppTool, Gerber):
|
||||
return 'fail'
|
||||
|
||||
bounding_box = None
|
||||
if ncc_select == _('Itself'):
|
||||
if ncc_select == 0: # itself
|
||||
geo_n = ncc_sel_obj.solid_geometry
|
||||
|
||||
try:
|
||||
@@ -2748,7 +2746,7 @@ class NonCopperClear(AppTool, Gerber):
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s' % _("No object available."))
|
||||
return 'fail'
|
||||
|
||||
elif ncc_select == 'area':
|
||||
elif ncc_select == 1: # area
|
||||
geo_n = unary_union(self.sel_rect)
|
||||
try:
|
||||
__ = iter(geo_n)
|
||||
@@ -2765,7 +2763,7 @@ class NonCopperClear(AppTool, Gerber):
|
||||
|
||||
bounding_box = unary_union(geo_buff_list)
|
||||
|
||||
elif ncc_select == _("Reference Object"):
|
||||
elif ncc_select == 2: # Reference Object
|
||||
geo_n = ncc_sel_obj.solid_geometry
|
||||
if ncc_sel_obj.kind == 'geometry':
|
||||
try:
|
||||
@@ -3056,13 +3054,13 @@ class NonCopperClear(AppTool, Gerber):
|
||||
try:
|
||||
for pol in p:
|
||||
if pol is not None and isinstance(pol, Polygon):
|
||||
if ncc_method == 'standard':
|
||||
if ncc_method == 0: # standard
|
||||
cp = self.clear_polygon(pol, tool,
|
||||
self.circle_steps,
|
||||
overlap=overlap, contour=contour,
|
||||
connect=connect,
|
||||
prog_plot=False)
|
||||
elif ncc_method == 'seed':
|
||||
elif ncc_method == 1: # seed
|
||||
cp = self.clear_polygon2(pol, tool,
|
||||
self.circle_steps,
|
||||
overlap=overlap, contour=contour,
|
||||
@@ -3085,11 +3083,11 @@ class NonCopperClear(AppTool, Gerber):
|
||||
"It is: %s" % str(type(pol)))
|
||||
except TypeError:
|
||||
if isinstance(p, Polygon):
|
||||
if ncc_method == 'standard':
|
||||
if ncc_method == 0: # standard
|
||||
cp = self.clear_polygon(p, tool, self.circle_steps,
|
||||
overlap=overlap, contour=contour, connect=connect,
|
||||
prog_plot=False)
|
||||
elif ncc_method == 'seed':
|
||||
elif ncc_method == 1: # seed
|
||||
cp = self.clear_polygon2(p, tool, self.circle_steps,
|
||||
overlap=overlap, contour=contour, connect=connect,
|
||||
prog_plot=False)
|
||||
@@ -3452,12 +3450,12 @@ class NonCopperClear(AppTool, Gerber):
|
||||
|
||||
if isinstance(p, Polygon):
|
||||
try:
|
||||
if ncc_method == 'standard':
|
||||
if ncc_method == 0: # standard
|
||||
cp = self.clear_polygon(p, tool_used,
|
||||
self.circle_steps,
|
||||
overlap=overlap, contour=contour, connect=connect,
|
||||
prog_plot=False)
|
||||
elif ncc_method == 'seed':
|
||||
elif ncc_method == 1: # seed
|
||||
cp = self.clear_polygon2(p, tool_used,
|
||||
self.circle_steps,
|
||||
overlap=overlap, contour=contour, connect=connect,
|
||||
@@ -3481,13 +3479,13 @@ class NonCopperClear(AppTool, Gerber):
|
||||
QtWidgets.QApplication.processEvents()
|
||||
|
||||
try:
|
||||
if ncc_method == 'standard':
|
||||
if ncc_method == 0: # 'standard'
|
||||
cp = self.clear_polygon(poly_p, tool_used,
|
||||
self.circle_steps,
|
||||
overlap=overlap, contour=contour,
|
||||
connect=connect,
|
||||
prog_plot=False)
|
||||
elif ncc_method == 'seed':
|
||||
elif ncc_method == 1: # 'seed'
|
||||
cp = self.clear_polygon2(poly_p, tool_used,
|
||||
self.circle_steps,
|
||||
overlap=overlap, contour=contour,
|
||||
@@ -4138,7 +4136,7 @@ class NccUI:
|
||||
# {"label": _("Straight lines"), "value": "lines"}
|
||||
# ], orientation='vertical', stretch=False)
|
||||
|
||||
self.ncc_method_combo = FCComboBox()
|
||||
self.ncc_method_combo = FCComboBox2()
|
||||
self.ncc_method_combo.addItems(
|
||||
[_("Standard"), _("Seed"), _("Lines"), _("Combo")]
|
||||
)
|
||||
@@ -4305,13 +4303,8 @@ class NccUI:
|
||||
|
||||
self.rest_ois_ncc_offset = OptionalInputSection(self.rest_ncc_choice_offset_cb, [self.rest_ncc_offset_spinner])
|
||||
|
||||
# ## Reference
|
||||
# self.select_radio = RadioSet([
|
||||
# {'label': _('Itself'), 'value': 'itself'},
|
||||
# {"label": _("Area Selection"), "value": "area"},
|
||||
# {'label': _("Reference Object"), 'value': 'box'}
|
||||
# ], orientation='vertical', stretch=False)
|
||||
self.select_combo = FCComboBox()
|
||||
# Reference Selection Combo
|
||||
self.select_combo = FCComboBox2()
|
||||
self.select_combo.addItems(
|
||||
[_("Itself"), _("Area Selection"), _("Reference Object")]
|
||||
)
|
||||
@@ -4335,7 +4328,7 @@ class NccUI:
|
||||
_("The type of FlatCAM object to be used as non copper clearing reference.\n"
|
||||
"It can be Gerber, Excellon or Geometry.")
|
||||
)
|
||||
self.reference_combo_type = FCComboBox()
|
||||
self.reference_combo_type = FCComboBox2()
|
||||
self.reference_combo_type.addItems([_("Gerber"), _("Excellon"), _("Geometry")])
|
||||
|
||||
form1.addRow(self.reference_combo_type_label, self.reference_combo_type)
|
||||
@@ -4449,7 +4442,7 @@ class NccUI:
|
||||
def on_toggle_reference(self):
|
||||
sel_combo = self.select_combo.get_value()
|
||||
|
||||
if sel_combo == _("Itself"):
|
||||
if sel_combo == 0: # itself
|
||||
self.reference_combo.hide()
|
||||
self.reference_combo_label.hide()
|
||||
self.reference_combo_type.hide()
|
||||
@@ -4459,7 +4452,7 @@ class NccUI:
|
||||
|
||||
# disable rest-machining for area painting
|
||||
self.ncc_rest_cb.setDisabled(False)
|
||||
elif sel_combo == _("Area Selection"):
|
||||
elif sel_combo == 1: # area selection
|
||||
self.reference_combo.hide()
|
||||
self.reference_combo_label.hide()
|
||||
self.reference_combo_type.hide()
|
||||
|
||||
@@ -14,7 +14,7 @@ from copy import deepcopy
|
||||
from appParsers.ParseGerber import Gerber
|
||||
from camlib import Geometry, FlatCAMRTreeStorage, grace
|
||||
from appGUI.GUIElements import FCTable, FCDoubleSpinner, FCCheckBox, FCInputDialog, RadioSet, FCButton, FCComboBox, \
|
||||
FCLabel
|
||||
FCLabel, FCComboBox2
|
||||
|
||||
from shapely.geometry import base, Polygon, MultiPolygon, LinearRing, Point
|
||||
from shapely.ops import unary_union, linemerge
|
||||
@@ -156,16 +156,14 @@ class ToolPaint(AppTool, Gerber):
|
||||
self.ui.paintmethod_combo.model().item(idx).setEnabled(True)
|
||||
else:
|
||||
self.ui.paintmethod_combo.model().item(idx).setEnabled(False)
|
||||
if self.ui.paintmethod_combo.get_value() == _("Laser_lines"):
|
||||
self.ui.paintmethod_combo.set_value(_("Lines"))
|
||||
if self.ui.paintmethod_combo.get_value() == idx: # if its Laser Lines
|
||||
self.ui.paintmethod_combo.set_value(idx+1)
|
||||
|
||||
def on_reference_combo_changed(self):
|
||||
obj_type = self.ui.reference_type_combo.currentIndex()
|
||||
self.ui.reference_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
|
||||
self.ui.reference_combo.setCurrentIndex(0)
|
||||
self.ui.reference_combo.obj_type = {
|
||||
_("Gerber"): "Gerber", _("Excellon"): "Excellon", _("Geometry"): "Geometry"
|
||||
}[self.ui.reference_type_combo.get_value()]
|
||||
self.ui.reference_combo.obj_type = {0: "Gerber", 1: "Excellon", 2: "Geometry"}[obj_type]
|
||||
|
||||
def connect_signals_at_init(self):
|
||||
# #############################################################################
|
||||
@@ -542,10 +540,20 @@ class ToolPaint(AppTool, Gerber):
|
||||
|
||||
self.ui.on_rest_machining_check(state=self.app.defaults["tools_paint_rest"])
|
||||
|
||||
# if the Paint Method is "Single" disable the tool table context menu
|
||||
if self.default_data["tools_paint_selectmethod"] == "single":
|
||||
# if the Paint Method is "Polygon Selection" disable the tool table context menu
|
||||
if self.default_data["tools_paint_selectmethod"] == 1:
|
||||
self.ui.tools_table.setContextMenuPolicy(Qt.NoContextMenu)
|
||||
|
||||
# make sure that we can't get selection of Laser Lines for Geometry even if it's set in the Preferences
|
||||
# because we don't select the default object type in Preferences but here
|
||||
idx = self.ui.paintmethod_combo.findText(_("Laser_lines"))
|
||||
if self.ui.type_obj_radio.get_value().lower() == 'gerber':
|
||||
self.ui.paintmethod_combo.model().item(idx).setEnabled(True)
|
||||
else:
|
||||
self.ui.paintmethod_combo.model().item(idx).setEnabled(False)
|
||||
if self.ui.paintmethod_combo.get_value() == idx: # if its Laser Lines
|
||||
self.ui.paintmethod_combo.set_value(idx + 1)
|
||||
|
||||
self.ui.tools_table.drag_drop_sig.connect(self.rebuild_ui)
|
||||
|
||||
def rebuild_ui(self):
|
||||
@@ -986,7 +994,7 @@ class ToolPaint(AppTool, Gerber):
|
||||
|
||||
self.sel_rect = []
|
||||
|
||||
obj_type = self.ui.type_obj_radio.get_value
|
||||
obj_type = self.ui.type_obj_radio.get_value()
|
||||
self.circle_steps = int(self.app.defaults["gerber_circle_steps"]) if obj_type == 'gerber' else \
|
||||
int(self.app.defaults["geometry_circle_steps"])
|
||||
self.obj_name = self.ui.obj_combo.currentText()
|
||||
@@ -1003,9 +1011,9 @@ class ToolPaint(AppTool, Gerber):
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Object not found"), self.paint_obj))
|
||||
return
|
||||
|
||||
# test if the Geometry Object is multigeo and return Fail if True because
|
||||
# for now Paint don't work on MultiGeo
|
||||
if self.paint_obj.kind == 'geometry' and self.paint_obj.multigeo is True:
|
||||
# test if the Geometry Object is multigeo with more than one tool and return Fail if True because
|
||||
# for now Paint don't work on MultiGeo with more than one tools
|
||||
if self.paint_obj.kind == 'geometry' and self.paint_obj.multigeo is True and len(self.paint_obj.tools) > 1:
|
||||
self.app.inform.emit('[ERROR_NOTCL] %s...' % _("Can't do Paint on MultiGeo geometries"))
|
||||
return 'Fail'
|
||||
|
||||
@@ -1032,10 +1040,10 @@ class ToolPaint(AppTool, Gerber):
|
||||
return
|
||||
|
||||
self.select_method = self.ui.selectmethod_combo.get_value()
|
||||
if self.select_method == _("All"):
|
||||
if self.select_method == 0: # _("All")
|
||||
self.paint_poly_all(self.paint_obj, tooldia=self.tooldia_list, outname=self.o_name)
|
||||
|
||||
elif self.select_method == _("Polygon Selection"):
|
||||
elif self.select_method == 1: # _("Polygon Selection")
|
||||
# disengage the grid snapping since it may be hard to click on polygons with grid snapping on
|
||||
if self.app.ui.grid_snap_btn.isChecked():
|
||||
self.grid_status_memory = True
|
||||
@@ -1058,7 +1066,7 @@ class ToolPaint(AppTool, Gerber):
|
||||
# disconnect flags
|
||||
self.poly_sel_disconnect_flag = True
|
||||
|
||||
elif self.select_method == _("Area Selection"):
|
||||
elif self.select_method == 2: # _("Area Selection")
|
||||
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Click the start point of the paint area."))
|
||||
|
||||
if self.app.is_legacy is False:
|
||||
@@ -1077,7 +1085,7 @@ class ToolPaint(AppTool, Gerber):
|
||||
# disconnect flags
|
||||
self.area_sel_disconnect_flag = True
|
||||
|
||||
elif self.select_method == _("Reference Object"):
|
||||
elif self.select_method == 3: # _("Reference Object")
|
||||
self.bound_obj_name = self.reference_combo.currentText()
|
||||
# Get source object.
|
||||
try:
|
||||
@@ -1453,7 +1461,7 @@ class ToolPaint(AppTool, Gerber):
|
||||
|
||||
cpoly = None
|
||||
|
||||
if paint_method == _("Standard"):
|
||||
if paint_method == 0: # _("Standard")
|
||||
try:
|
||||
# Type(cp) == FlatCAMRTreeStorage | None
|
||||
cpoly = self.clear_polygon(polyg,
|
||||
@@ -1467,7 +1475,7 @@ class ToolPaint(AppTool, Gerber):
|
||||
return "fail"
|
||||
except Exception as ee:
|
||||
log.debug("ToolPaint.paint_polygon_worker() Standard --> %s" % str(ee))
|
||||
elif paint_method == _("Seed"):
|
||||
elif paint_method == 1: # _("Seed")
|
||||
try:
|
||||
# Type(cp) == FlatCAMRTreeStorage | None
|
||||
cpoly = self.clear_polygon2(polyg,
|
||||
@@ -1481,7 +1489,7 @@ class ToolPaint(AppTool, Gerber):
|
||||
return "fail"
|
||||
except Exception as ee:
|
||||
log.debug("ToolPaint.paint_polygon_worker() Seed --> %s" % str(ee))
|
||||
elif paint_method == _("Lines"):
|
||||
elif paint_method == 2: # _("Lines")
|
||||
try:
|
||||
# Type(cp) == FlatCAMRTreeStorage | None
|
||||
cpoly = self.clear_polygon3(polyg,
|
||||
@@ -1495,7 +1503,7 @@ class ToolPaint(AppTool, Gerber):
|
||||
return "fail"
|
||||
except Exception as ee:
|
||||
log.debug("ToolPaint.paint_polygon_worker() Lines --> %s" % str(ee))
|
||||
elif paint_method == _("Laser_lines"):
|
||||
elif paint_method == 3: # _("Laser_lines")
|
||||
try:
|
||||
# line = None
|
||||
# aperture_size = None
|
||||
@@ -1544,7 +1552,7 @@ class ToolPaint(AppTool, Gerber):
|
||||
|
||||
# process the flashes found in the selected polygon with the 'lines' method for rectangular
|
||||
# flashes and with _("Seed") for oblong and circular flashes
|
||||
# and pads (flahes) need the contour therefore I override the GUI settings with always True
|
||||
# and pads (flashes) need the contour therefore I override the GUI settings with always True
|
||||
for ap_type in flash_el_dict:
|
||||
for elem in flash_el_dict[ap_type]:
|
||||
if 'solid' in elem:
|
||||
@@ -1558,7 +1566,7 @@ class ToolPaint(AppTool, Gerber):
|
||||
connect=conn,
|
||||
prog_plot=prog_plot)
|
||||
pads_lines_list += [p for p in f_o.get_objects() if p]
|
||||
|
||||
# this is the same as above but I keep it in case I will modify something in the future
|
||||
elif ap_type == 'O':
|
||||
f_o = self.clear_polygon2(elem['solid'],
|
||||
tooldia=tooldiameter,
|
||||
@@ -1646,7 +1654,7 @@ class ToolPaint(AppTool, Gerber):
|
||||
return "fail"
|
||||
except Exception as ee:
|
||||
log.debug("ToolPaint.paint_polygon_worker() Laser Lines --> %s" % str(ee))
|
||||
elif paint_method == _("Combo"):
|
||||
elif paint_method == 4: # _("Combo")
|
||||
try:
|
||||
self.app.inform.emit(_("Painting polygon with method: lines."))
|
||||
cpoly = self.clear_polygon3(polyg,
|
||||
@@ -2666,7 +2674,7 @@ class ToolPaint(AppTool, Gerber):
|
||||
max_uid = max(tool_uid_list)
|
||||
tooluid = max_uid + 1
|
||||
|
||||
tooldia = float('%.*f' % (self.decimals, tooldia))
|
||||
tooldia = self.app.dec_format(tooldia, self.decimals)
|
||||
|
||||
tool_dias = []
|
||||
for k, v in self.paint_tools.items():
|
||||
@@ -3001,19 +3009,8 @@ class PaintUI:
|
||||
"- Combo: In case of failure a new method will be picked from the above\n"
|
||||
"in the order specified.")
|
||||
)
|
||||
# self.paintmethod_combo = RadioSet([
|
||||
# {"label": _("Standard"), "value": "standard"},
|
||||
# {"label": _("Seed-based"), "value": _("Seed")},
|
||||
# {"label": _("Straight lines"), "value": _("Lines")},
|
||||
# {"label": _("Laser lines"), "value": _("Laser_lines")},
|
||||
# {"label": _("Combo"), "value": _("Combo")}
|
||||
# ], orientation='vertical', stretch=False)
|
||||
|
||||
# for choice in self.paintmethod_combo.choices:
|
||||
# if choice['value'] == _("Laser_lines"):
|
||||
# choice["radio"].setEnabled(False)
|
||||
|
||||
self.paintmethod_combo = FCComboBox()
|
||||
self.paintmethod_combo = FCComboBox2()
|
||||
self.paintmethod_combo.addItems(
|
||||
[_("Standard"), _("Seed"), _("Lines"), _("Laser_lines"), _("Combo")]
|
||||
)
|
||||
@@ -3106,27 +3103,9 @@ class PaintUI:
|
||||
"- 'Reference Object' - will process the area specified by another object.")
|
||||
)
|
||||
|
||||
# grid3 = QtWidgets.QGridLayout()
|
||||
# self.selectmethod_combo = RadioSet([
|
||||
# {"label": _("Polygon Selection"), "value": "single"},
|
||||
# {"label": _("Area Selection"), "value": "area"},
|
||||
# {"label": _("All Polygons"), "value": "all"},
|
||||
# {"label": _("Reference Object"), "value": "ref"}
|
||||
# ], orientation='vertical', stretch=False)
|
||||
# self.selectmethod_combo.setObjectName('p_selection')
|
||||
# self.selectmethod_combo.setToolTip(
|
||||
# _("How to select Polygons to be painted.\n"
|
||||
# "- 'Polygon Selection' - left mouse click to add/remove polygons to be painted.\n"
|
||||
# "- 'Area Selection' - left mouse click to start selection of the area to be painted.\n"
|
||||
# "Keeping a modifier key pressed (CTRL or SHIFT) will allow to add multiple areas.\n"
|
||||
# "- 'All Polygons' - the Paint will start after click.\n"
|
||||
# "- 'Reference Object' - will do non copper clearing within the area\n"
|
||||
# "specified by another object.")
|
||||
# )
|
||||
|
||||
self.selectmethod_combo = FCComboBox()
|
||||
self.selectmethod_combo = FCComboBox2()
|
||||
self.selectmethod_combo.addItems(
|
||||
[_("Polygon Selection"), _("Area Selection"), _("All"), _("Reference Object")]
|
||||
[_("All"), _("Polygon Selection"), _("Area Selection"), _("Reference Object")]
|
||||
)
|
||||
self.selectmethod_combo.setObjectName('p_selection')
|
||||
|
||||
@@ -3141,7 +3120,7 @@ class PaintUI:
|
||||
_("The type of FlatCAM object to be used as paint reference.\n"
|
||||
"It can be Gerber, Excellon or Geometry.")
|
||||
)
|
||||
self.reference_type_combo = FCComboBox()
|
||||
self.reference_type_combo = FCComboBox2()
|
||||
self.reference_type_combo.addItems([_("Gerber"), _("Excellon"), _("Geometry")])
|
||||
|
||||
form1.addRow(self.reference_type_label, self.reference_type_combo)
|
||||
@@ -3231,7 +3210,7 @@ class PaintUI:
|
||||
def on_selection(self):
|
||||
sel_combo = self.selectmethod_combo.get_value()
|
||||
|
||||
if sel_combo == _("Reference Object"):
|
||||
if sel_combo == 3: # _("Reference Object")
|
||||
self.reference_combo.show()
|
||||
self.reference_combo_label.show()
|
||||
self.reference_type_combo.show()
|
||||
@@ -3242,20 +3221,20 @@ class PaintUI:
|
||||
self.reference_type_combo.hide()
|
||||
self.reference_type_label.hide()
|
||||
|
||||
if sel_combo == _("Polygon Selection"):
|
||||
if sel_combo == 1: # _("Polygon Selection")
|
||||
# disable rest-machining for single polygon painting
|
||||
# self.ui.rest_cb.set_value(False)
|
||||
# self.ui.rest_cb.setDisabled(True)
|
||||
pass
|
||||
|
||||
if sel_combo == _("Area Selection"):
|
||||
if sel_combo == 2: # _("Area Selection") index 2 in combobox (FCComboBox2() returns index instead of text)
|
||||
# disable rest-machining for area painting
|
||||
# self.ui.rest_cb.set_value(False)
|
||||
# self.ui.rest_cb.setDisabled(True)
|
||||
|
||||
self.area_shape_label.show()
|
||||
self.area_shape_radio.show()
|
||||
else:
|
||||
else: # All = index 0 in combobox
|
||||
self.new_tooldia_entry.setDisabled(False)
|
||||
self.add_newtool_button.setDisabled(False)
|
||||
self.deltool_btn.setDisabled(False)
|
||||
|
||||
Reference in New Issue
Block a user