diff --git a/CHANGELOG.md b/CHANGELOG.md
index d3697d70..b75574da 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta
=================================================
+4.12.2020
+
+- in Cutout, 2Sided, Film, NCC, Paint, Panelize and Subtract Tool made sure that the object selection in Project Tab reflects in the selected object in the Tools
+- set the shortcut key for Milling Tool to ALt+M and for Corner Markers Tool to Alt+B
+
3.12.2020
- in Gerber Editor - modified the UI
diff --git a/appGUI/MainGUI.py b/appGUI/MainGUI.py
index b5a9af4f..584b0fe1 100644
--- a/appGUI/MainGUI.py
+++ b/appGUI/MainGUI.py
@@ -2683,6 +2683,11 @@ class MainGUI(QtWidgets.QMainWindow):
if key == QtCore.Qt.Key_A:
self.app.align_objects_tool.run(toggle=True)
+ # Corner Markers Tool
+ if key == QtCore.Qt.Key_B:
+ self.app.corners_tool.run(toggle=True)
+ return
+
# Calculator Tool
if key == QtCore.Qt.Key_C:
self.app.calculator_tool.run(toggle=True)
@@ -2730,9 +2735,9 @@ class MainGUI(QtWidgets.QMainWindow):
self.app.film_tool.run(toggle=True)
return
- # Corner Markers Tool
+ # Milling Tool
if key == QtCore.Qt.Key_M:
- self.app.corners_tool.run(toggle=True)
+ self.app.milling_tool.run(toggle=True)
return
# Non-Copper Clear Tool
@@ -4461,6 +4466,10 @@ class ShortcutsTab(QtWidgets.QWidget):
%s |
%s |
+
+ | %s |
+ %s |
+
| |
|
@@ -4581,6 +4590,7 @@ class ShortcutsTab(QtWidgets.QWidget):
# ALT section
_('Alt+A'), _("Align Objects Tool"),
+ _('Alt+B'), _("Corner Markers Tool"),
_('Alt+C'), _("Calculators Tool"),
_('Alt+D'), _("2-Sided PCB Tool"),
_('Alt+E'), _("Extract Tool"),
@@ -4591,7 +4601,7 @@ class ShortcutsTab(QtWidgets.QWidget):
_('Alt+J'), _("Copper Thieving Tool"),
_('Alt+K'), _("Solder Paste Dispensing Tool"),
_('Alt+L'), _("Film PCB Tool"),
- _('Alt+M'), _("Corner Markers Tool"),
+ _('Alt+M'), _("Milling Tool"),
_('Alt+N'), _("Non-Copper Clearing Tool"),
_('Alt+O'), _("Optimal Tool"),
_('Alt+P'), _("Paint Area Tool"),
diff --git a/appObjects/ObjectCollection.py b/appObjects/ObjectCollection.py
index 146e1043..98b82877 100644
--- a/appObjects/ObjectCollection.py
+++ b/appObjects/ObjectCollection.py
@@ -985,6 +985,8 @@ class ObjectCollection(QtCore.QAbstractItemModel):
if obj:
obj.build_ui()
+ self.app.proj_selection_changed.emit(current, previous)
+
def on_item_activated(self, index):
"""
Double-click or Enter on item.
diff --git a/appTools/ToolCorners.py b/appTools/ToolCorners.py
index 3671055b..0715514d 100644
--- a/appTools/ToolCorners.py
+++ b/appTools/ToolCorners.py
@@ -110,7 +110,7 @@ class ToolCorners(AppTool):
self.app.ui.notebook.setTabText(2, _("Corners Tool"))
def install(self, icon=None, separator=None, **kwargs):
- AppTool.install(self, icon, separator, shortcut='Alt+M', **kwargs)
+ AppTool.install(self, icon, separator, shortcut='Alt+B', **kwargs)
def set_tool_ui(self):
self.units = self.app.defaults['units']
diff --git a/appTools/ToolCutOut.py b/appTools/ToolCutOut.py
index 5abfe5f2..d737432e 100644
--- a/appTools/ToolCutOut.py
+++ b/appTools/ToolCutOut.py
@@ -116,6 +116,9 @@ class CutOut(AppTool):
self.ui.man_geo_creation_btn.clicked.connect(self.on_manual_geo)
self.ui.man_gaps_creation_btn.clicked.connect(self.on_manual_gap_click)
self.ui.drillcut_btn.clicked.connect(self.on_drill_cut_click)
+
+ self.app.proj_selection_changed.connect(self.on_object_selection_changed)
+
self.ui.reset_button.clicked.connect(self.set_tool_ui)
def on_type_obj_changed(self, val):
@@ -131,6 +134,19 @@ class CutOut(AppTool):
self.ui.convex_box_label.setDisabled(True)
self.ui.convex_box_cb.setDisabled(True)
+ def on_object_selection_changed(self, current, previous):
+ try:
+ name = current.indexes()[0].internalPointer().obj.options['name']
+ kind = current.indexes()[0].internalPointer().obj.kind
+
+ if kind in ['gerber', 'geometry']:
+ obj_type = {'gerber': 'grb', 'geometry': 'geo'}[kind]
+ self.ui.type_obj_radio.set_value(obj_type)
+
+ self.ui.obj_combo.set_value(name)
+ except IndexError:
+ pass
+
def run(self, toggle=True):
self.app.defaults.report_usage("ToolCutOut()")
@@ -809,7 +825,6 @@ class CutOut(AppTool):
geo_buf = object_geo.buffer(0)
geo = geo_buf.exterior
- print(geo)
if geo.is_empty:
self.app.inform.emit('[ERROR_NOTCL] %s' % _("Failed."))
return 'fail'
diff --git a/appTools/ToolDblSided.py b/appTools/ToolDblSided.py
index 093510c0..2dc77ff7 100644
--- a/appTools/ToolDblSided.py
+++ b/appTools/ToolDblSided.py
@@ -38,7 +38,9 @@ class DblSidedTool(AppTool):
self.mr = None
- # ## Signals
+ # ############################################################################################################
+ # ######################################### Signals ##########################################################
+ # ############################################################################################################
self.ui.object_type_radio.activated_custom.connect(self.on_object_type)
self.ui.add_point_button.clicked.connect(self.on_point_add)
@@ -64,7 +66,10 @@ class DblSidedTool(AppTool):
self.ui.create_alignment_hole_button.clicked.connect(self.on_create_alignment_holes)
self.ui.calculate_bb_button.clicked.connect(self.on_bbox_coordinates)
+ self.app.proj_selection_changed.connect(self.on_object_selection_changed)
+
self.ui.reset_button.clicked.connect(self.set_tool_ui)
+ # ############################################################################################################
self.drill_values = ""
@@ -167,6 +172,19 @@ class DblSidedTool(AppTool):
self.ui.box_combo.obj_type = {
"grb": "Gerber", "exc": "Excellon", "geo": "Geometry"}[val]
+ def on_object_selection_changed(self, current, previous):
+ try:
+ name = current.indexes()[0].internalPointer().obj.options['name']
+ kind = current.indexes()[0].internalPointer().obj.kind
+
+ obj_type = {'gerber': 'grb', 'excellon': 'exc', 'geometry': 'geo'}[kind]
+ self.ui.object_type_radio.set_value(obj_type)
+ self.ui.box_type_radio.set_value(obj_type)
+
+ self.ui.object_combo.set_value(name)
+ except IndexError:
+ pass
+
def on_create_alignment_holes(self):
axis = self.ui.align_axis_radio.get_value()
mode = self.ui.axis_location.get_value()
@@ -545,8 +563,8 @@ class DsidedUI:
self.object_type_radio = RadioSet([
{"label": _("Gerber"), "value": "grb"},
- {"label": _("Geometry"), "value": "geo"},
- {"label": _("Excellon"), "value": "exc"}
+ {"label": _("Excellon"), "value": "exc"},
+ {"label": _("Geometry"), "value": "geo"}
])
grid_lay.addWidget(self.type_obj_combo_label, 2, 0)
diff --git a/appTools/ToolFilm.py b/appTools/ToolFilm.py
index e0c24f32..c88c3894 100644
--- a/appTools/ToolFilm.py
+++ b/appTools/ToolFilm.py
@@ -48,13 +48,15 @@ class Film(AppTool):
self.decimals = self.app.decimals
self.units = self.app.defaults['units']
- # #############################################################################
- # ######################### Tool GUI ##########################################
- # #############################################################################
+ # #############################################################################################################
+ # ######################################## Tool GUI ###########################################################
+ # #############################################################################################################
self.ui = FilmUI(layout=self.layout, app=self.app)
self.toolName = self.ui.toolName
- # ## Signals
+ # #############################################################################################################
+ # ##################################### Signals ########################################################
+ # #############################################################################################################
self.ui.film_object_button.clicked.connect(self.on_film_creation)
self.ui.tf_type_obj_combo.activated_custom.connect(self.on_type_obj_index_changed)
self.ui.tf_type_box_combo.activated_custom.connect(self.on_type_box_index_changed)
@@ -62,7 +64,11 @@ class Film(AppTool):
self.ui.film_type.activated_custom.connect(self.ui.on_film_type)
self.ui.source_punch.activated_custom.connect(self.ui.on_punch_source)
self.ui.file_type_radio.activated_custom.connect(self.ui.on_file_type)
+
+ self.app.proj_selection_changed.connect(self.on_object_selection_changed)
+
self.ui.reset_button.clicked.connect(self.set_tool_ui)
+ # #############################################################################################################
self.screen_dpi = 96
@@ -82,6 +88,21 @@ class Film(AppTool):
"grb": "gerber", "geo": "geometry"
}[self.ui.tf_type_obj_combo.get_value()]
+ def on_object_selection_changed(self, current, previous):
+ try:
+ name = current.indexes()[0].internalPointer().obj.options['name']
+ kind = current.indexes()[0].internalPointer().obj.kind
+
+ if kind in ['gerber', 'geometry']:
+ obj_type = {'gerber': 'grb', 'geometry': 'geo'}[kind]
+ self.ui.tf_type_obj_combo.set_value(obj_type)
+ self.ui.tf_type_box_combo.set_value(obj_type)
+
+ self.ui.tf_object_combo.set_value(name)
+ self.ui.tf_box_combo.set_value(name)
+ except IndexError:
+ pass
+
def run(self, toggle=True):
self.app.defaults.report_usage("ToolFilm()")
diff --git a/appTools/ToolMilling.py b/appTools/ToolMilling.py
index d4830571..19058b40 100644
--- a/appTools/ToolMilling.py
+++ b/appTools/ToolMilling.py
@@ -156,7 +156,7 @@ class ToolMilling(AppTool, Excellon):
icon=QtGui.QIcon(self.app.resource_location + "/trash16.png"))
def install(self, icon=None, separator=None, **kwargs):
- AppTool.install(self, icon, separator, shortcut='Alt+B', **kwargs)
+ AppTool.install(self, icon, separator, shortcut='Alt+M', **kwargs)
def run(self, toggle=True):
self.app.defaults.report_usage("ToolMilling()")
@@ -254,7 +254,8 @@ class ToolMilling(AppTool, Excellon):
self.ui.generate_cnc_button.clicked.connect(self.on_generate_cncjob_click)
# When object selection on canvas change
- self.app.collection.view.selectionModel().selectionChanged.connect(self.on_object_selection_changed)
+ # self.app.collection.view.selectionModel().selectionChanged.connect(self.on_object_selection_changed)
+ self.app.proj_selection_changed.connect(self.on_object_selection_changed)
# Reset Tool
self.ui.reset_button.clicked.connect(self.set_tool_ui)
diff --git a/appTools/ToolNCC.py b/appTools/ToolNCC.py
index 5177322d..fa7f1ee4 100644
--- a/appTools/ToolNCC.py
+++ b/appTools/ToolNCC.py
@@ -245,6 +245,8 @@ class NonCopperClear(AppTool, Gerber):
self.ui.add_newtool_button.clicked.connect(lambda: self.on_tool_add())
self.ui.addtool_from_db_btn.clicked.connect(self.on_ncc_tool_add_from_db_clicked)
+ self.app.proj_selection_changed.connect(self.on_object_selection_changed)
+
self.ui.reset_button.clicked.connect(self.set_tool_ui)
# Cleanup on Graceful exit (CTRL+ALT+X combo key)
@@ -269,6 +271,18 @@ class NonCopperClear(AppTool, Gerber):
except AttributeError:
return
+ def on_object_selection_changed(self, current, previous):
+ try:
+ name = current.indexes()[0].internalPointer().obj.options['name']
+ kind = current.indexes()[0].internalPointer().obj.kind
+
+ if kind in ['gerber', 'geometry']:
+ self.ui.type_obj_radio.set_value(kind)
+
+ self.ui.object_combo.set_value(name)
+ except IndexError:
+ pass
+
def on_toggle_all_rows(self):
"""
will toggle the selection of all rows in Tools table
diff --git a/appTools/ToolPaint.py b/appTools/ToolPaint.py
index e87ee5f5..26d0063e 100644
--- a/appTools/ToolPaint.py
+++ b/appTools/ToolPaint.py
@@ -183,6 +183,8 @@ class ToolPaint(AppTool, Gerber):
self.ui.add_newtool_button.clicked.connect(lambda: self.on_tool_add())
self.ui.addtool_from_db_btn.clicked.connect(self.on_paint_tool_add_from_db_clicked)
+ self.app.proj_selection_changed.connect(self.on_object_selection_changed)
+
self.ui.reset_button.clicked.connect(self.set_tool_ui)
# Cleanup on Graceful exit (CTRL+ALT+X combo key)
@@ -281,6 +283,18 @@ class ToolPaint(AppTool, Gerber):
if len(sel_rows) == 1:
self.update_ui()
+ def on_object_selection_changed(self, current, previous):
+ try:
+ name = current.indexes()[0].internalPointer().obj.options['name']
+ kind = current.indexes()[0].internalPointer().obj.kind
+
+ if kind in ['gerber', 'geometry']:
+ self.ui.type_obj_radio.set_value(kind)
+
+ self.ui.obj_combo.set_value(name)
+ except IndexError:
+ pass
+
def update_ui(self):
self.blockSignals(True)
diff --git a/appTools/ToolPanelize.py b/appTools/ToolPanelize.py
index 16f67f4e..0ca7afd4 100644
--- a/appTools/ToolPanelize.py
+++ b/appTools/ToolPanelize.py
@@ -51,6 +51,9 @@ class Panelize(AppTool):
self.ui.panelize_object_button.clicked.connect(self.on_panelize)
self.ui.type_obj_combo.currentIndexChanged.connect(self.on_type_obj_index_changed)
self.ui.type_box_combo.currentIndexChanged.connect(self.on_type_box_index_changed)
+
+ self.app.proj_selection_changed.connect(self.on_object_selection_changed)
+
self.ui.reset_button.clicked.connect(self.set_tool_ui)
# list to hold the temporary objects
@@ -167,7 +170,7 @@ class Panelize(AppTool):
}[self.ui.type_obj_combo.get_value()]
# hide the panel type for Excellons, the panel can be only of type Geometry
- if self.ui.type_obj_combo.currentText() != 'Excellon':
+ if self.ui.type_obj_combo.currentText() != _('Excellon'):
self.ui.panel_type_label.setDisabled(False)
self.ui.panel_type_radio.setDisabled(False)
self.ui.on_panel_type(val=self.ui.panel_type_radio.get_value())
@@ -196,6 +199,26 @@ class Panelize(AppTool):
self.ui.type_box_combo_label.setDisabled(True)
self.ui.box_combo.setDisabled(True)
+ def on_object_selection_changed(self, current, previous):
+ try:
+ name = current.indexes()[0].internalPointer().obj.options['name']
+ kind = current.indexes()[0].internalPointer().obj.kind
+
+ obj_type = {
+ "gerber": _("Gerber"), "excellon": _("Excellon"), "geometry": _("Geometry")
+ }[kind]
+
+ self.ui.type_obj_combo.set_value(obj_type)
+ self.ui.type_box_combo.set_value(obj_type)
+
+ if kind in ['gerber', 'geometry']:
+ self.ui.panel_type_radio.set_value(kind)
+
+ self.ui.object_combo.set_value(name)
+ self.ui.box_combo.set_value(name)
+ except IndexError:
+ pass
+
def on_panelize(self):
name = self.ui.object_combo.currentText()
@@ -993,9 +1016,7 @@ class PanelizeUI:
# Type of object to be panelized
self.type_obj_combo = FCComboBox()
- self.type_obj_combo.addItem("Gerber")
- self.type_obj_combo.addItem("Excellon")
- self.type_obj_combo.addItem("Geometry")
+ self.type_obj_combo.addItems([_("Gerber"), _("Excellon"), _("Geometry")])
self.type_obj_combo.setItemIcon(0, QtGui.QIcon(self.app.resource_location + "/flatcam_icon16.png"))
self.type_obj_combo.setItemIcon(1, QtGui.QIcon(self.app.resource_location + "/drill16.png"))
diff --git a/appTools/ToolSub.py b/appTools/ToolSub.py
index c6af6eaa..ae9798d5 100644
--- a/appTools/ToolSub.py
+++ b/appTools/ToolSub.py
@@ -91,6 +91,8 @@ class ToolSub(AppTool):
self.ui.intersect_geo_btn.clicked.connect(self.on_subtract_geo_click)
self.ui.reset_button.clicked.connect(self.set_tool_ui)
+ self.app.proj_selection_changed.connect(self.on_object_selection_changed)
+
# Custom Signals
self.job_finished.connect(self.on_job_finished)
self.aperture_processing_finished.connect(self.new_gerber_object)
@@ -162,6 +164,18 @@ class ToolSub(AppTool):
self.app.ui.notebook.setTabText(2, _("Sub Tool"))
+ def on_object_selection_changed(self, current, previous):
+ try:
+ name = current.indexes()[0].internalPointer().obj.options['name']
+ kind = current.indexes()[0].internalPointer().obj.kind
+
+ if kind == 'gerber':
+ self.ui.target_gerber_combo.set_value(name)
+ if kind == 'geometry':
+ self.ui.target_geo_combo.set_value(name)
+ except IndexError:
+ pass
+
def set_tool_ui(self):
self.new_apertures.clear()
self.new_tools.clear()
diff --git a/app_Main.py b/app_Main.py
index fe0d1c6c..24826ae0 100644
--- a/app_Main.py
+++ b/app_Main.py
@@ -257,6 +257,8 @@ class App(QtCore.QObject):
# graphic residues behind
cleanup = pyqtSignal()
+ proj_selection_changed = pyqtSignal(object, object)
+
def __init__(self, qapp, user_defaults=True):
"""
Starts the application.