- created the GUI for the Rule Check Tool

- if there are (x, y) coordinates in the clipboard, when launching the "Jump to" function, those coordinates will be preloaded in the Dialog box.
- when the combo SHIFT + LMB is executed there is no longer a deselection of objects
- when the "Jump to" function is called, the mouse cursor (if active) will be moved to the new position and the screen position labels will be updated accordingly
- changed the icon for Open Script and reused it for the Check Rules Tool
This commit is contained in:
Marius Stanciu 2019-09-28 00:34:18 +03:00 committed by Marius
parent 7f4115267a
commit c5ecc7ad88
8 changed files with 826 additions and 727 deletions

View File

@ -2372,6 +2372,7 @@ class App(QtCore.QObject):
self.film_tool = None
self.paste_tool = None
self.calculator_tool = None
self.rules_tool = None
self.sub_tool = None
self.move_tool = None
self.cutout_tool = None
@ -2909,6 +2910,9 @@ class App(QtCore.QObject):
self.sub_tool = ToolSub(self)
self.sub_tool.install(icon=QtGui.QIcon('share/sub32.png'), pos=self.ui.menutool, separator=True)
self.rules_tool = RulesCheck(self)
self.rules_tool.install(icon=QtGui.QIcon('share/rules32.png'), pos=self.ui.menutool, separator=True)
self.move_tool = ToolMove(self)
self.move_tool.install(icon=QtGui.QIcon('share/move16.png'), pos=self.ui.menuedit,
before=self.ui.menueditorigin)
@ -3036,6 +3040,7 @@ class App(QtCore.QObject):
self.ui.film_btn.triggered.connect(lambda: self.film_tool.run(toggle=True))
self.ui.solder_btn.triggered.connect(lambda: self.paste_tool.run(toggle=True))
self.ui.sub_btn.triggered.connect(lambda: self.sub_tool.run(toggle=True))
self.ui.rules_btn.triggered.connect(lambda: self.rules_tool.run(toggle=True))
self.ui.calculators_btn.triggered.connect(lambda: self.calculator_tool.run(toggle=True))
self.ui.transform_btn.triggered.connect(lambda: self.transform_tool.run(toggle=True))
@ -6979,9 +6984,22 @@ class App(QtCore.QObject):
# return
if not custom_location:
dia_box_location = None
try:
dia_box_location = eval(self.clipboard.text())
except Exception as e:
pass
if type(dia_box_location) == tuple:
dia_box_location = str(dia_box_location)
else:
dia_box_location = None
dia_box = Dialog_box(title=_("Jump to ..."),
label=_("Enter the coordinates in format X,Y:"),
icon=QtGui.QIcon('share/jump_to16.png'))
icon=QtGui.QIcon('share/jump_to16.png'),
initial_text=dia_box_location)
if dia_box.ok is True:
try:
@ -7004,7 +7022,8 @@ class App(QtCore.QObject):
if self.is_legacy is False:
canvas_origin = self.plotcanvas.native.mapToGlobal(QtCore.QPoint(0, 0))
jump_loc = self.plotcanvas.translate_coords_2((location[0], location[1]))
cursor.setPos(canvas_origin.x() + jump_loc[0], (canvas_origin.y() + jump_loc[1]))
j_pos = (canvas_origin.x() + jump_loc[0], (canvas_origin.y() + jump_loc[1]))
cursor.setPos(j_pos[0], j_pos[1])
else:
# find the canvas origin which is in the top left corner
canvas_origin = self.plotcanvas.native.mapToGlobal(QtCore.QPoint(0, 0))
@ -7015,8 +7034,22 @@ class App(QtCore.QObject):
# in pixels where the origin 0,0 is in the lowest left point of the display window (in our case is the
# canvas) and the point (width, height) is in the top-right location
loc = self.plotcanvas.axes.transData.transform_point(location)
j_pos = (x0 + loc[0], y0 - loc[1])
cursor.setPos(j_pos[0], j_pos[1])
cursor.setPos(x0 + loc[0], y0 - loc[1])
if self.grid_status() == True:
# Update cursor
self.app_cursor.set_data(np.asarray([(location[0], location[1])]),
symbol='++', edge_color='black', size=self.defaults["global_cursor_size"])
# Set the position label
self.ui.position_label.setText("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
"<b>Y</b>: %.4f" % (location[0], location[1]))
# Set the relative position label
dx = location[0] - float(self.rel_point1[0])
dy = location[1] - float(self.rel_point1[1])
self.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp; <b>Dy</b>: "
"%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (dx, dy))
self.inform.emit('[success] %s' %
_("Done."))
@ -7799,8 +7832,6 @@ class App(QtCore.QObject):
self.pos = (self.pos_canvas[0], self.pos_canvas[1])
try:
modifiers = QtWidgets.QApplication.keyboardModifiers()
if event.button == 1:
# Reset here the relative coordinates so there is a new reference on the click position
if self.rel_point1 is None:
@ -7809,16 +7840,6 @@ class App(QtCore.QObject):
self.rel_point2 = copy(self.rel_point1)
self.rel_point1 = self.pos
# If the SHIFT key is pressed when LMB is clicked then the coordinates are copied to clipboard
if modifiers == QtCore.Qt.ShiftModifier:
# do not auto open the Project Tab
self.click_noproject = True
self.clipboard.setText(self.defaults["global_point_clipboard_format"] % (self.pos[0], self.pos[1]))
self.inform.emit('[success] %s' %
_("Coordinates copied to clipboard."))
return
self.on_mouse_move_over_plot(event, origin_click=True)
except Exception as e:
App.log.debug("App.on_mouse_click_over_plot() --> Outside plot? --> %s" % str(e))
@ -7970,6 +7991,17 @@ class App(QtCore.QObject):
# selection and then select a type of selection ("enclosing" or "touching")
try:
if event.button == 1: # left click
modifiers = QtWidgets.QApplication.keyboardModifiers()
# If the SHIFT key is pressed when LMB is clicked then the coordinates are copied to clipboard
if modifiers == QtCore.Qt.ShiftModifier:
# do not auto open the Project Tab
self.click_noproject = True
self.clipboard.setText(self.defaults["global_point_clipboard_format"] % (self.pos[0], self.pos[1]))
self.inform.emit('[success] %s' %
_("Coordinates copied to clipboard."))
return
if self.doubleclick is True:
self.doubleclick = False
if self.collection.get_selected():

View File

@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
=================================================
28.09.2019
- changed the icon for Open Script and reused it for the Check Rules Tool
27.09.2019
- optimized the toggle axis command
@ -19,6 +23,11 @@ CAD program, and create G-Code for Isolation routing.
- if an object is edited but the result is not saved, the app will reload the edited object UI and set the Selected tab as active
- made the mouse cursor (big, small) change in real time for both graphic engines
- started to work on a new FlatCAM tool: Rules Check
- created the GUI for the Rule Check Tool
- if there are (x, y) coordinates in the clipboard, when launching the "Jump to" function, those coordinates will be preloaded in the Dialog box.
- when the combo SHIFT + LMB is executed there is no longer a deselection of objects
- when the "Jump to" function is called, the mouse cursor (if active) will be moved to the new position and the screen position labels will be updated accordingly
27.09.2019

View File

@ -112,7 +112,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.menufile_scripting.setToolTipsVisible(True)
self.menufilenewscript = QtWidgets.QAction(QtGui.QIcon('share/script_new16.png'), _('New Script ...'), self)
self.menufileopenscript = QtWidgets.QAction(QtGui.QIcon('share/script_open16.png'), _('Open Script ...'), self)
self.menufileopenscript = QtWidgets.QAction(QtGui.QIcon('share/open_script32.png'), _('Open Script ...'), self)
self.menufilerunscript = QtWidgets.QAction(QtGui.QIcon('share/script16.png'),
'%s\tSHIFT+S' % _('Run Script ...'), self)
self.menufilerunscript.setToolTip(
@ -664,7 +664,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
# ## Shell Toolbar ##
self.shell_btn = self.toolbarshell.addAction(QtGui.QIcon('share/shell32.png'), _("&Command Line"))
self.new_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script_new24.png'), _('New Script ...'))
self.open_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script_open18.png'), _('Open Script ...'))
self.open_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/open_script32.png'), _('Open Script ...'))
self.run_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script16.png'), _('Run Script ...'))
# ## Tools Toolbar ##
@ -678,6 +678,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.film_btn = self.toolbartools.addAction(QtGui.QIcon('share/film16.png'), _("Film Tool"))
self.solder_btn = self.toolbartools.addAction(QtGui.QIcon('share/solderpastebis32.png'), _("SolderPaste Tool"))
self.sub_btn = self.toolbartools.addAction(QtGui.QIcon('share/sub32.png'), _("Substract Tool"))
self.rules_btn = self.toolbartools.addAction(QtGui.QIcon('share/rules32.png'), _("Rules Tool"))
self.toolbartools.addSeparator()
@ -1219,6 +1220,10 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
<td height="20"><strong>ALT+D</strong></td>
<td>&nbsp;%s</td>
</tr>
<tr height="20">
<td height="20"><strong>ALT+E</strong></td>
<td>&nbsp;%s</td>
</tr>
<tr height="20">
<td height="20"><strong>ALT+K</strong></td>
<td>&nbsp;%s</td>
@ -1326,9 +1331,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
_("Open Project"), _("Save Project As"), _("Toggle Plot Area"), _("Copy Obj_Name"),
_("Toggle Code Editor"), _("Toggle the axis"), _("Open Preferences Window"),
_("Rotate by 90 degree CCW"), _("Run a Script"), _("Toggle the workspace"), _("Skew on X axis"),
_("Skew on Y axis"), _("Calculators Tool"), _("2-Sided PCB Tool"), _("Solder Paste Dispensing Tool"),
_("Skew on Y axis"), _("Calculators Tool"), _("2-Sided PCB Tool"), _("Transformations Tool"),
_("Solder Paste Dispensing Tool"),
_("Film PCB Tool"), _("Non-Copper Clearing Tool"),
_("Paint Area Tool"), _("PDF Import Tool"), _("Transformations Tool"), _("View File Source"),
_("Paint Area Tool"), _("PDF Import Tool"), _("Rules Check Tool"),
_("View File Source"),
_("Cutout PCB Tool"), _("Enable all Plots"), _("Disable all Plots"), _("Disable Non-selected Plots"),
_("Toggle Full Screen"), _("Abort current task (gracefully)"), _("Open Online Manual"),
_("Open Online Tutorials"), _("Refresh Plots"), _("Delete Object"), _("Alternate: Delete Tool"),
@ -2102,7 +2109,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
# ## Shell Toolbar # ##
self.shell_btn = self.toolbarshell.addAction(QtGui.QIcon('share/shell32.png'), _("&Command Line"))
self.new_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script_new24.png'), _('New Script ...'))
self.open_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script_open18.png'), _('Open Script ...'))
self.open_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/open_script32.png'), _('Open Script ...'))
self.run_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script16.png'), _('Run Script ...'))
# ## Tools Toolbar # ##
@ -2406,6 +2413,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.app.dblsidedtool.run(toggle=True)
return
# Transformation Tool
if key == QtCore.Qt.Key_E:
self.app.transform_tool.run(toggle=True)
return
# Solder Paste Dispensing Tool
if key == QtCore.Qt.Key_K:
self.app.paste_tool.run(toggle=True)
@ -2431,9 +2443,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.app.pdf_tool.run()
return
# Transformation Tool
# Rules Tool
if key == QtCore.Qt.Key_R:
self.app.transform_tool.run(toggle=True)
self.app.rules_tool.run(toggle=True)
return
# View Source Object Content

View File

@ -1734,21 +1734,26 @@ class FCDoubleSpinner(QtWidgets.QDoubleSpinBox):
class Dialog_box(QtWidgets.QWidget):
def __init__(self, title=None, label=None, icon=None):
def __init__(self, title=None, label=None, icon=None, initial_text=None):
"""
:param title: string with the window title
:param label: string with the message inside the dialog box
"""
super(Dialog_box, self).__init__()
self.location = (0, 0)
if initial_text is None:
self.location = str((0, 0))
else:
self.location = initial_text
self.ok = False
dialog_box = QtWidgets.QInputDialog()
dialog_box.setMinimumWidth(290)
self.dialog_box = QtWidgets.QInputDialog()
self.dialog_box.setMinimumWidth(290)
self.setWindowIcon(icon)
self.location, self.ok = dialog_box.getText(self, title, label, text="0, 0")
self.location, self.ok = self.dialog_box.getText(self, title, label,
text=str(self.location).replace('(', '').replace(')', ''))
self.readyToEdit = True
def mousePressEvent(self, e, parent=None):

File diff suppressed because it is too large Load Diff

View File

@ -403,7 +403,7 @@ class ToolTransform(FlatCAMTool):
self.app.ui.notebook.setTabText(2, _("Transform Tool"))
def install(self, icon=None, separator=None, **kwargs):
FlatCAMTool.install(self, icon, separator, shortcut='ALT+R', **kwargs)
FlatCAMTool.install(self, icon, separator, shortcut='ALT+E', **kwargs)
def set_tool_ui(self):
# ## Initialize form

BIN
share/open_script32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

BIN
share/rules32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B