- 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
This commit is contained in:
committed by
Marius Stanciu
parent
89ce3b32f0
commit
e677a6592e
@@ -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']
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()")
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user