- minor changes in the Excellon Editor -> Resize Plugin
This commit is contained in:
@@ -15,6 +15,7 @@ CHANGELOG for FlatCAM Evo beta
|
|||||||
- in Excellon Editor, finished the upgrade work on the Drill Array Plugin
|
- in Excellon Editor, finished the upgrade work on the Drill Array Plugin
|
||||||
- in Excellon Editor, finished the upgrade work on the Slot Array Plugin
|
- in Excellon Editor, finished the upgrade work on the Slot Array Plugin
|
||||||
- in Excellon Editor, finished the upgrade work on the Resize Plugin
|
- in Excellon Editor, finished the upgrade work on the Resize Plugin
|
||||||
|
- minor changes in the Excellon Editor -> Resize Plugin
|
||||||
|
|
||||||
29.04.2022
|
29.04.2022
|
||||||
|
|
||||||
|
|||||||
@@ -1946,13 +1946,32 @@ class ResizeEditorExc(FCShapeTool):
|
|||||||
self.draw_app.app.inform.emit(_("Click on the Drill(s) to resize ..."))
|
self.draw_app.app.inform.emit(_("Click on the Drill(s) to resize ..."))
|
||||||
|
|
||||||
def set_plugin_ui(self):
|
def set_plugin_ui(self):
|
||||||
curr_row = self.draw_app.ui.tools_table_exc.currentRow()
|
# curr_row = self.draw_app.ui.tools_table_exc.currentRow()
|
||||||
tool_dia = float(self.draw_app.ui.tools_table_exc.item(curr_row, 1).text())
|
# tool_dia = float(self.draw_app.ui.tools_table_exc.item(curr_row, 1).text())
|
||||||
self.ui.dia_entry.set_value(tool_dia)
|
# self.ui.dia_entry.set_value(tool_dia)
|
||||||
|
|
||||||
|
self.update_diameters()
|
||||||
|
|
||||||
def utility_geometry(self, data=None):
|
def utility_geometry(self, data=None):
|
||||||
return DrawToolUtilityShape([])
|
return DrawToolUtilityShape([])
|
||||||
|
|
||||||
|
def click_release(self, point):
|
||||||
|
self.update_diameters()
|
||||||
|
|
||||||
|
def update_diameters(self):
|
||||||
|
sel_dia_list = set()
|
||||||
|
for index in self.draw_app.ui.tools_table_exc.selectedIndexes():
|
||||||
|
row = index.row()
|
||||||
|
if row < 0:
|
||||||
|
continue
|
||||||
|
# on column 1 in tool tables we hold the diameters, and we retrieve them as strings
|
||||||
|
# therefore below we convert to float
|
||||||
|
dia_on_row = self.draw_app.ui.tools_table_exc.item(row, 1).text()
|
||||||
|
if dia_on_row != '':
|
||||||
|
sel_dia_list.add(dia_on_row)
|
||||||
|
|
||||||
|
self.ui.dia_entry.set_value(', '.join([i for i in list(sel_dia_list)]))
|
||||||
|
|
||||||
def make(self):
|
def make(self):
|
||||||
self.draw_app.is_modified = True
|
self.draw_app.is_modified = True
|
||||||
|
|
||||||
@@ -4075,21 +4094,28 @@ class AppExcEditor(QtCore.QObject):
|
|||||||
|
|
||||||
# if the released mouse button was LMB then test if we had a right-to-left selection or a left-to-right
|
# if the released mouse button was LMB then test if we had a right-to-left selection or a left-to-right
|
||||||
# selection and then select a type of selection ("enclosing" or "touching")
|
# selection and then select a type of selection ("enclosing" or "touching")
|
||||||
try:
|
|
||||||
if event.button == 1: # left click
|
if event.button == 1: # left click
|
||||||
if self.app.selection_type is not None:
|
if self.app.selection_type is not None:
|
||||||
|
try:
|
||||||
self.draw_selection_area_handler(self.clicked_pos, pos, self.app.selection_type)
|
self.draw_selection_area_handler(self.clicked_pos, pos, self.app.selection_type)
|
||||||
|
except Exception as e:
|
||||||
|
self.app.log.error("AppExcEditor.on_exc_click_release() LMB click --> Error: %s" % str(e))
|
||||||
|
raise
|
||||||
self.app.selection_type = None
|
self.app.selection_type = None
|
||||||
|
|
||||||
elif isinstance(self.active_tool, SelectEditorExc):
|
elif isinstance(self.active_tool, SelectEditorExc):
|
||||||
self.active_tool.click_release((self.clicked_pos[0], self.clicked_pos[1]))
|
self.active_tool.click_release((self.clicked_pos[0], self.clicked_pos[1]))
|
||||||
|
|
||||||
# if there are selected objects then plot them
|
# if there are selected objects then plot them
|
||||||
if self.selected:
|
if self.selected:
|
||||||
self.replot()
|
self.replot()
|
||||||
except Exception as e:
|
|
||||||
self.app.log.error("AppExcEditor.on_exc_click_release() LMB click --> Error: %s" % str(e))
|
click_position = pos if pos is not None else self.clicked_pos
|
||||||
raise
|
if self.active_tool is not None:
|
||||||
|
# Dispatch event to active_tool
|
||||||
|
try:
|
||||||
|
self.active_tool.click_release(click_position)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
def on_canvas_move(self, event):
|
def on_canvas_move(self, event):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class ExcResizeEditorTool(AppTool):
|
|||||||
|
|
||||||
def connect_signals_at_init(self):
|
def connect_signals_at_init(self):
|
||||||
# Signals
|
# Signals
|
||||||
self.ui.clear_btn.clicked.connect(self.on_clear)
|
self.ui.clear_btn.clicked.connect(lambda: self.ui.res_dia_entry.set_value(0.0))
|
||||||
|
|
||||||
def disconnect_signals(self):
|
def disconnect_signals(self):
|
||||||
# Signals
|
# Signals
|
||||||
|
|||||||
Reference in New Issue
Block a user