- in all Editors, manually deactivating a button in the editor toolbar will automatically select the 'Select' button
- fixed Excellon Editor selection: when a tool is selected in Tools Table, all the drills belonging to that tool are selected. When a drill is selected on canvas, the associated tool will be selected without automatically selecting all other drills with same tool
This commit is contained in:
@@ -2182,7 +2182,7 @@ class App(QtCore.QObject):
|
|||||||
if cleanup is None:
|
if cleanup is None:
|
||||||
self.grb_editor.update_fcgerber(edited_obj)
|
self.grb_editor.update_fcgerber(edited_obj)
|
||||||
self.grb_editor.update_options(new_obj)
|
self.grb_editor.update_options(new_obj)
|
||||||
self.grb_editor.deactivate()
|
self.grb_editor.deactivate_grb_editor()
|
||||||
|
|
||||||
# delete the old object (the source object) if it was an empty one
|
# delete the old object (the source object) if it was an empty one
|
||||||
if edited_obj.solid_geometry.is_empty:
|
if edited_obj.solid_geometry.is_empty:
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
|
|
||||||
- changed the color of the marked apertures to the global_selection_color
|
- changed the color of the marked apertures to the global_selection_color
|
||||||
- Gerber Editor: added Transformation Tool and Rotation key shortcut
|
- Gerber Editor: added Transformation Tool and Rotation key shortcut
|
||||||
|
- in all Editors, manually deactivating a button in the editor toolbar will automatically select the 'Select' button
|
||||||
|
- fixed Excellon Editor selection: when a tool is selected in Tools Table, all the drills belonging to that tool are selected. When a drill is selected on canvas, the associated tool will be selected without automatically selecting all other drills with same tool
|
||||||
|
|
||||||
10.04.2019
|
10.04.2019
|
||||||
|
|
||||||
|
|||||||
@@ -558,28 +558,16 @@ class FCDrillSelect(DrawTool):
|
|||||||
else:
|
else:
|
||||||
self.exc_editor_app.selected = []
|
self.exc_editor_app.selected = []
|
||||||
|
|
||||||
def click_release(self, point):
|
def click_release(self, pos):
|
||||||
self.select_shapes(point)
|
|
||||||
return ""
|
|
||||||
|
|
||||||
def select_shapes(self, pos):
|
|
||||||
self.exc_editor_app.tools_table_exc.clearSelection()
|
self.exc_editor_app.tools_table_exc.clearSelection()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# for storage in self.exc_editor_app.storage_dict:
|
|
||||||
# _, partial_closest_shape = self.exc_editor_app.storage_dict[storage].nearest(pos)
|
|
||||||
# if partial_closest_shape is not None:
|
|
||||||
# self.sel_storage.insert(partial_closest_shape)
|
|
||||||
#
|
|
||||||
# _, closest_shape = self.sel_storage.nearest(pos)
|
|
||||||
|
|
||||||
for storage in self.exc_editor_app.storage_dict:
|
for storage in self.exc_editor_app.storage_dict:
|
||||||
for shape in self.exc_editor_app.storage_dict[storage].get_objects():
|
for shape in self.exc_editor_app.storage_dict[storage].get_objects():
|
||||||
self.sel_storage.insert(shape)
|
self.sel_storage.insert(shape)
|
||||||
|
|
||||||
_, closest_shape = self.sel_storage.nearest(pos)
|
_, closest_shape = self.sel_storage.nearest(pos)
|
||||||
|
|
||||||
|
|
||||||
# constrain selection to happen only within a certain bounding box
|
# constrain selection to happen only within a certain bounding box
|
||||||
x_coord, y_coord = closest_shape.geo[0].xy
|
x_coord, y_coord = closest_shape.geo[0].xy
|
||||||
delta = (x_coord[1] - x_coord[0])
|
delta = (x_coord[1] - x_coord[0])
|
||||||
@@ -594,41 +582,43 @@ class FCDrillSelect(DrawTool):
|
|||||||
if pos[0] < xmin or pos[0] > xmax or pos[1] < ymin or pos[1] > ymax:
|
if pos[0] < xmin or pos[0] > xmax or pos[1] < ymin or pos[1] > ymax:
|
||||||
self.exc_editor_app.selected = []
|
self.exc_editor_app.selected = []
|
||||||
else:
|
else:
|
||||||
key_modifier = QtWidgets.QApplication.keyboardModifiers()
|
modifiers = QtWidgets.QApplication.keyboardModifiers()
|
||||||
if self.exc_editor_app.app.defaults["global_mselect_key"] == 'Control':
|
mod_key = 'Control'
|
||||||
# if CONTROL key is pressed then we add to the selected list the current shape but if it's already
|
if modifiers == QtCore.Qt.ShiftModifier:
|
||||||
# in the selected list, we removed it. Therefore first click selects, second deselects.
|
mod_key = 'Shift'
|
||||||
if key_modifier == Qt.ControlModifier:
|
elif modifiers == QtCore.Qt.ControlModifier:
|
||||||
if closest_shape in self.exc_editor_app.selected:
|
mod_key = 'Control'
|
||||||
self.exc_editor_app.selected.remove(closest_shape)
|
|
||||||
else:
|
if mod_key == self.draw_app.app.defaults["global_mselect_key"]:
|
||||||
self.exc_editor_app.selected.append(closest_shape)
|
if closest_shape in self.exc_editor_app.selected:
|
||||||
|
self.exc_editor_app.selected.remove(closest_shape)
|
||||||
else:
|
else:
|
||||||
self.exc_editor_app.selected = []
|
|
||||||
self.exc_editor_app.selected.append(closest_shape)
|
self.exc_editor_app.selected.append(closest_shape)
|
||||||
else:
|
else:
|
||||||
if key_modifier == Qt.ShiftModifier:
|
self.draw_app.selected = []
|
||||||
if closest_shape in self.exc_editor_app.selected:
|
self.draw_app.selected.append(closest_shape)
|
||||||
self.exc_editor_app.selected.remove(closest_shape)
|
|
||||||
else:
|
|
||||||
self.exc_editor_app.selected.append(closest_shape)
|
|
||||||
else:
|
|
||||||
self.exc_editor_app.selected = []
|
|
||||||
self.exc_editor_app.selected.append(closest_shape)
|
|
||||||
|
|
||||||
# select the diameter of the selected shape in the tool table
|
# select the diameter of the selected shape in the tool table
|
||||||
for storage in self.exc_editor_app.storage_dict:
|
try:
|
||||||
for shape_s in self.exc_editor_app.selected:
|
self.draw_app.tools_table_exc.cellPressed.disconnect()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
sel_tools = set()
|
||||||
|
self.exc_editor_app.tools_table_exc.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
|
||||||
|
for shape_s in self.exc_editor_app.selected:
|
||||||
|
for storage in self.exc_editor_app.storage_dict:
|
||||||
if shape_s in self.exc_editor_app.storage_dict[storage].get_objects():
|
if shape_s in self.exc_editor_app.storage_dict[storage].get_objects():
|
||||||
for key in self.exc_editor_app.tool2tooldia:
|
sel_tools.add(storage)
|
||||||
if self.exc_editor_app.tool2tooldia[key] == storage:
|
|
||||||
item = self.exc_editor_app.tools_table_exc.item((key - 1), 1)
|
for storage in sel_tools:
|
||||||
self.exc_editor_app.tools_table_exc.setCurrentItem(item)
|
self.exc_editor_app.tools_table_exc.selectRow(int(storage))
|
||||||
# item.setSelected(True)
|
self.draw_app.last_tool_selected = int(storage)
|
||||||
# self.exc_editor_app.tools_table_exc.selectItem(key - 1)
|
|
||||||
# midx = self.exc_editor_app.tools_table_exc.model().index((key - 1), 0)
|
self.exc_editor_app.tools_table_exc.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||||
# self.exc_editor_app.tools_table_exc.setCurrentIndex(midx)
|
|
||||||
self.draw_app.last_tool_selected = key
|
self.draw_app.tools_table_exc.cellPressed.connect(self.draw_app.on_row_selected)
|
||||||
|
|
||||||
# delete whatever is in selection storage, there is no longer need for those shapes
|
# delete whatever is in selection storage, there is no longer need for those shapes
|
||||||
self.sel_storage = FlatCAMExcEditor.make_storage()
|
self.sel_storage = FlatCAMExcEditor.make_storage()
|
||||||
|
|
||||||
@@ -1033,7 +1023,9 @@ class FlatCAMExcEditor(QtCore.QObject):
|
|||||||
self.addtool_btn.clicked.connect(self.on_tool_add)
|
self.addtool_btn.clicked.connect(self.on_tool_add)
|
||||||
# self.addtool_entry.editingFinished.connect(self.on_tool_add)
|
# self.addtool_entry.editingFinished.connect(self.on_tool_add)
|
||||||
self.deltool_btn.clicked.connect(self.on_tool_delete)
|
self.deltool_btn.clicked.connect(self.on_tool_delete)
|
||||||
self.tools_table_exc.selectionModel().currentChanged.connect(self.on_row_selected)
|
# self.tools_table_exc.selectionModel().currentChanged.connect(self.on_row_selected)
|
||||||
|
self.tools_table_exc.cellPressed.connect(self.on_row_selected)
|
||||||
|
|
||||||
self.array_type_combo.currentIndexChanged.connect(self.on_array_type_combo)
|
self.array_type_combo.currentIndexChanged.connect(self.on_array_type_combo)
|
||||||
|
|
||||||
self.drill_axis_radio.activated_custom.connect(self.on_linear_angle_radio)
|
self.drill_axis_radio.activated_custom.connect(self.on_linear_angle_radio)
|
||||||
@@ -1193,6 +1185,11 @@ class FlatCAMExcEditor(QtCore.QObject):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.tools_table_exc.cellPressed.disconnect()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# updated units
|
# updated units
|
||||||
self.units = self.app.ui.general_defaults_form.general_app_group.units_radio.get_value().upper()
|
self.units = self.app.ui.general_defaults_form.general_app_group.units_radio.get_value().upper()
|
||||||
|
|
||||||
@@ -1386,6 +1383,7 @@ class FlatCAMExcEditor(QtCore.QObject):
|
|||||||
|
|
||||||
# we reactivate the signals after the after the tool adding as we don't need to see the tool been populated
|
# we reactivate the signals after the after the tool adding as we don't need to see the tool been populated
|
||||||
self.tools_table_exc.itemChanged.connect(self.on_tool_edit)
|
self.tools_table_exc.itemChanged.connect(self.on_tool_edit)
|
||||||
|
self.tools_table_exc.cellPressed.connect(self.on_row_selected)
|
||||||
|
|
||||||
def on_tool_add(self, tooldia=None):
|
def on_tool_add(self, tooldia=None):
|
||||||
self.is_modified = True
|
self.is_modified = True
|
||||||
@@ -1496,6 +1494,8 @@ class FlatCAMExcEditor(QtCore.QObject):
|
|||||||
|
|
||||||
# if connected, disconnect the signal from the slot on item_changed as it creates issues
|
# if connected, disconnect the signal from the slot on item_changed as it creates issues
|
||||||
self.tools_table_exc.itemChanged.disconnect()
|
self.tools_table_exc.itemChanged.disconnect()
|
||||||
|
self.tools_table_exc.cellPressed.disconnect()
|
||||||
|
|
||||||
# self.tools_table_exc.selectionModel().currentChanged.disconnect()
|
# self.tools_table_exc.selectionModel().currentChanged.disconnect()
|
||||||
|
|
||||||
self.is_modified = True
|
self.is_modified = True
|
||||||
@@ -1560,6 +1560,8 @@ class FlatCAMExcEditor(QtCore.QObject):
|
|||||||
|
|
||||||
# we reactivate the signals after the after the tool editing
|
# we reactivate the signals after the after the tool editing
|
||||||
self.tools_table_exc.itemChanged.connect(self.on_tool_edit)
|
self.tools_table_exc.itemChanged.connect(self.on_tool_edit)
|
||||||
|
self.tools_table_exc.cellPressed.connect(self.on_row_selected)
|
||||||
|
|
||||||
# self.tools_table_exc.selectionModel().currentChanged.connect(self.on_row_selected)
|
# self.tools_table_exc.selectionModel().currentChanged.connect(self.on_row_selected)
|
||||||
|
|
||||||
def on_name_activate(self):
|
def on_name_activate(self):
|
||||||
@@ -1963,20 +1965,32 @@ class FlatCAMExcEditor(QtCore.QObject):
|
|||||||
self.app.log.debug("%s is NOT checked." % current_tool)
|
self.app.log.debug("%s is NOT checked." % current_tool)
|
||||||
for t in self.tools_exc:
|
for t in self.tools_exc:
|
||||||
self.tools_exc[t]["button"].setChecked(False)
|
self.tools_exc[t]["button"].setChecked(False)
|
||||||
self.active_tool = None
|
|
||||||
|
|
||||||
def on_row_selected(self):
|
self.select_tool('select')
|
||||||
self.selected = []
|
self.active_tool = FCDrillSelect(self)
|
||||||
|
|
||||||
try:
|
def on_row_selected(self, row, col):
|
||||||
selected_dia = self.tool2tooldia[self.tools_table_exc.currentRow() + 1]
|
if col == 0:
|
||||||
self.last_tool_selected = self.tools_table_exc.currentRow() + 1
|
key_modifier = QtWidgets.QApplication.keyboardModifiers()
|
||||||
for obj in self.storage_dict[selected_dia].get_objects():
|
if self.app.defaults["global_mselect_key"] == 'Control':
|
||||||
self.selected.append(obj)
|
modifier_to_use = Qt.ControlModifier
|
||||||
except Exception as e:
|
else:
|
||||||
self.app.log.debug(str(e))
|
modifier_to_use = Qt.ShiftModifier
|
||||||
|
|
||||||
self.replot()
|
if key_modifier == modifier_to_use:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
self.selected = []
|
||||||
|
|
||||||
|
try:
|
||||||
|
selected_dia = self.tool2tooldia[self.tools_table_exc.currentRow() + 1]
|
||||||
|
self.last_tool_selected = self.tools_table_exc.currentRow() + 1
|
||||||
|
for obj in self.storage_dict[selected_dia].get_objects():
|
||||||
|
self.selected.append(obj)
|
||||||
|
except Exception as e:
|
||||||
|
self.app.log.debug(str(e))
|
||||||
|
|
||||||
|
self.replot()
|
||||||
|
|
||||||
def toolbar_tool_toggle(self, key):
|
def toolbar_tool_toggle(self, key):
|
||||||
self.options[key] = self.sender().isChecked()
|
self.options[key] = self.sender().isChecked()
|
||||||
@@ -2179,7 +2193,12 @@ class FlatCAMExcEditor(QtCore.QObject):
|
|||||||
else:
|
else:
|
||||||
self.selected.append(obj)
|
self.selected.append(obj)
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.tools_table_exc.cellPressed.disconnect()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
# select the diameter of the selected shape in the tool table
|
# select the diameter of the selected shape in the tool table
|
||||||
|
self.tools_table_exc.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
|
||||||
for storage in self.storage_dict:
|
for storage in self.storage_dict:
|
||||||
for shape_s in self.selected:
|
for shape_s in self.selected:
|
||||||
if shape_s in self.storage_dict[storage].get_objects():
|
if shape_s in self.storage_dict[storage].get_objects():
|
||||||
@@ -2188,9 +2207,10 @@ class FlatCAMExcEditor(QtCore.QObject):
|
|||||||
item = self.tools_table_exc.item((key - 1), 1)
|
item = self.tools_table_exc.item((key - 1), 1)
|
||||||
self.tools_table_exc.setCurrentItem(item)
|
self.tools_table_exc.setCurrentItem(item)
|
||||||
self.last_tool_selected = key
|
self.last_tool_selected = key
|
||||||
# item.setSelected(True)
|
|
||||||
# self.exc_editor_app.tools_table_exc.selectItem(key - 1)
|
|
||||||
|
|
||||||
|
self.tools_table_exc.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||||
|
|
||||||
|
self.tools_table_exc.cellPressed.connect(self.on_row_selected)
|
||||||
self.replot()
|
self.replot()
|
||||||
|
|
||||||
def on_canvas_move(self, event):
|
def on_canvas_move(self, event):
|
||||||
|
|||||||
@@ -3110,7 +3110,9 @@ class FlatCAMGeoEditor(QtCore.QObject):
|
|||||||
self.app.log.debug("%s is NOT checked." % tool)
|
self.app.log.debug("%s is NOT checked." % tool)
|
||||||
for t in self.tools:
|
for t in self.tools:
|
||||||
self.tools[t]["button"].setChecked(False)
|
self.tools[t]["button"].setChecked(False)
|
||||||
self.active_tool = None
|
|
||||||
|
self.select_tool('select')
|
||||||
|
self.active_tool = FCSelect(self)
|
||||||
|
|
||||||
def draw_tool_path(self):
|
def draw_tool_path(self):
|
||||||
self.select_tool('path')
|
self.select_tool('path')
|
||||||
|
|||||||
@@ -460,6 +460,7 @@ class FCApertureSelect(DrawTool):
|
|||||||
def click_release(self, point):
|
def click_release(self, point):
|
||||||
self.grb_editor_app.apertures_table.clearSelection()
|
self.grb_editor_app.apertures_table.clearSelection()
|
||||||
sel_aperture = set()
|
sel_aperture = set()
|
||||||
|
|
||||||
for storage in self.grb_editor_app.storage_dict:
|
for storage in self.grb_editor_app.storage_dict:
|
||||||
for shape in self.grb_editor_app.storage_dict[storage]['solid_geometry']:
|
for shape in self.grb_editor_app.storage_dict[storage]['solid_geometry']:
|
||||||
if Point(point).within(shape.geo):
|
if Point(point).within(shape.geo):
|
||||||
@@ -474,6 +475,7 @@ class FCApertureSelect(DrawTool):
|
|||||||
self.draw_app.selected.append(shape)
|
self.draw_app.selected.append(shape)
|
||||||
sel_aperture.add(storage)
|
sel_aperture.add(storage)
|
||||||
|
|
||||||
|
# select the aperture in the Apertures Table that is associated with the selected shape
|
||||||
try:
|
try:
|
||||||
self.draw_app.apertures_table.cellPressed.disconnect()
|
self.draw_app.apertures_table.cellPressed.disconnect()
|
||||||
except:
|
except:
|
||||||
@@ -1639,7 +1641,9 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
self.app.log.debug("%s is NOT checked." % current_tool)
|
self.app.log.debug("%s is NOT checked." % current_tool)
|
||||||
for t in self.tools_gerber:
|
for t in self.tools_gerber:
|
||||||
self.tools_gerber[t]["button"].setChecked(False)
|
self.tools_gerber[t]["button"].setChecked(False)
|
||||||
self.active_tool = None
|
|
||||||
|
self.select_tool('select')
|
||||||
|
self.active_tool = FCApertureSelect(self)
|
||||||
|
|
||||||
def on_row_selected(self, row, col):
|
def on_row_selected(self, row, col):
|
||||||
if col == 0:
|
if col == 0:
|
||||||
@@ -1867,7 +1871,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
|
|||||||
self.apertures_table.cellPressed.disconnect()
|
self.apertures_table.cellPressed.disconnect()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
# select the aperture code of the selected geometry, in the tool table
|
||||||
self.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
|
self.apertures_table.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
|
||||||
for aper in sel_aperture:
|
for aper in sel_aperture:
|
||||||
for row in range(self.apertures_table.rowCount()):
|
for row in range(self.apertures_table.rowCount()):
|
||||||
|
|||||||
Reference in New Issue
Block a user