- fixed a source of possible errors in DetachableTab Widget.

- fixed gcode conversion/scale (on units change) when multiple values are found on each line
- replaced the pop-up window for the shortcut list with a new detachable tab
- removed the pop-up messages from the rotate, skew, flip commands
This commit is contained in:
Marius Stanciu 2019-02-02 03:27:34 +02:00 committed by Marius S
parent 365c1f4c71
commit de7e41991d
6 changed files with 119 additions and 128 deletions

View File

@ -3547,15 +3547,7 @@ class App(QtCore.QObject):
ymaxlist = []
if not obj_list:
self.inform.emit("[warning_notcl] No object selected.")
msg = "Please Select an object to flip!"
warningbox = QtWidgets.QMessageBox()
warningbox.setText(msg)
warningbox.setWindowTitle("Warning ...")
warningbox.setWindowIcon(QtGui.QIcon('share/warning.png'))
warningbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
warningbox.setDefaultButton(QtWidgets.QMessageBox.Ok)
warningbox.exec_()
self.inform.emit("[warning_notcl] No object selected to Flip on Y axis.")
else:
try:
# first get a bounding box to fit all
@ -3592,15 +3584,7 @@ class App(QtCore.QObject):
ymaxlist = []
if not obj_list:
self.inform.emit("[warning_notcl] No object selected.")
msg = "Please Select an object to flip!"
warningbox = QtWidgets.QMessageBox()
warningbox.setText(msg)
warningbox.setWindowTitle("Warning ...")
warningbox.setWindowIcon(QtGui.QIcon('share/warning.png'))
warningbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
warningbox.setDefaultButton(QtWidgets.QMessageBox.Ok)
warningbox.exec_()
self.inform.emit("[warning_notcl] No object selected to Flip on X axis.")
else:
try:
# first get a bounding box to fit all
@ -3637,15 +3621,7 @@ class App(QtCore.QObject):
ymaxlist = []
if not obj_list:
self.inform.emit("[warning_notcl] No object selected.")
msg = "Please Select an object to rotate!"
warningbox = QtWidgets.QMessageBox()
warningbox.setText(msg)
warningbox.setWindowTitle("Warning ...")
warningbox.setWindowIcon(QtGui.QIcon('share/warning.png'))
warningbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
warningbox.setDefaultButton(QtWidgets.QMessageBox.Ok)
warningbox.exec_()
self.inform.emit("[warning_notcl] No object selected to Rotate.")
else:
if silent is False:
rotatebox = FCInputDialog(title="Transform", text="Enter the Angle value:",
@ -3687,15 +3663,7 @@ class App(QtCore.QObject):
yminlist = []
if not obj_list:
self.inform.emit("[warning_notcl] No object selected.")
msg = "Please Select an object to skew/shear!"
warningbox = QtWidgets.QMessageBox()
warningbox.setText(msg)
warningbox.setWindowTitle("Warning ...")
warningbox.setWindowIcon(QtGui.QIcon('share/warning.png'))
warningbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
warningbox.setDefaultButton(QtWidgets.QMessageBox.Ok)
warningbox.exec_()
self.inform.emit("[warning_notcl] No object selected to Skew/Shear on X axis.")
else:
skewxbox = FCInputDialog(title="Transform", text="Enter the Angle value:",
min=-360, max=360, decimals=3)
@ -3722,15 +3690,7 @@ class App(QtCore.QObject):
yminlist = []
if not obj_list:
self.inform.emit("[warning_notcl] No object selected.")
msg = "Please Select an object to skew/shear!"
warningbox = QtWidgets.QMessageBox()
warningbox.setText(msg)
warningbox.setWindowTitle("Warning ...")
warningbox.setWindowIcon(QtGui.QIcon('share/warning.png'))
warningbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
warningbox.setDefaultButton(QtWidgets.QMessageBox.Ok)
warningbox.exec_()
self.inform.emit("[warning_notcl] No object selected to Skew/Shear on Y axis.")
else:
skewybox = FCInputDialog(title="Transform", text="Enter the Angle value:",
min=-360, max=360, decimals=3)
@ -4028,7 +3988,6 @@ class App(QtCore.QObject):
return
def on_shortcut_list(self):
# add the tab if it was closed
self.ui.plot_tab_area.addTab(self.ui.shortcuts_tab, "Key Shortcut List")
@ -4040,77 +3999,6 @@ class App(QtCore.QObject):
self.ui.plot_tab_area.setCurrentWidget(self.ui.shortcuts_tab)
self.ui.show()
msg = '''<b>Shortcut list</b><br>
<br>
<b>~:</b> Show Shortcut List<br>
<br>
<b>1:</b> Zoom Fit<br>
<b>2:</b> Zoom Out<br>
<b>3:</b> Zoom In<br>
<b>A:</b> Draw an Arc (when in Edit Mode)<br>
<b>C:</b> Copy Geo Item (when in Edit Mode)<br>
<b>E:</b> Edit Object (if selected)<br>
<b>G:</b> Grid On/Off<br>
<b>J:</b> Jump to Coordinates<br>
<b>L:</b> New Excellon<br>
<b>M:</b> Move Obj<br>
<b>M:</b> Move Geo Item (when in Edit Mode)<br>
<b>N:</b> New Geometry<br>
<b>N:</b> Draw a Polygon (when in Edit Mode)<br>
<b>O:</b> Set Origin<br>
<b>O:</b> Draw a Circle (when in Edit Mode)<br>
<b>Q:</b> Change Units<br>
<b>P:</b> Open Properties Tool<br>
<b>P:</b> Draw a Path (when in Edit Mode)<br>
<b>R:</b> Rotate by 90 degree CW<br>
<b>R:</b> Draw Rectangle (when in Edit Mode)<br>
<b>S:</b> Shell Toggle<br>
<b>V:</b> View Fit<br>
<b>X:</b> Flip on X_axis<br>
<b>Y:</b> Flip on Y_axis<br>
<br>
<b>Space:</b> En(Dis)able Obj Plot<br>
<b>CTRL+A:</b> Select All<br>
<b>CTRL+C:</b> Copy Obj<br>
<b>CTRL+E:</b> Open Excellon File<br>
<b>CTRL+G:</b> Open Gerber File<br>
<b>CTRL+N:</b> New Project<br>
<b>CTRL+M:</b> Measurement Tool<br>
<b>CTRL+O:</b> Open Project<br>
<b>CTRL+S:</b> Save Project As<br>
<b>CTRL+S:</b> Save Object and Exit Editor (when in Edit Mode)<br>
<br>
<b>SHIFT+C:</b> Copy Obj_Name<br>
<b>SHIFT+G:</b> Toggle the axis<br>
<b>SHIFT+P:</b> Open Preferences Window<br>
<b>SHIFT+R:</b> Rotate by 90 degree CCW<br>
<b>SHIFT+S:</b> Run a Script<br>
<b>SHIFT+W:</b> Toggle the workspace<br>
<b>SHIFT+X:</b> Skew on X axis<br>
<b>SHIFT+Y:</b> Skew on Y axis<br>
<br>
<b>ALT+C:</b> Calculators Tool<br>
<b>ALT+D:</b> 2-Sided PCB Tool<br>
<b>ALT+L:</b> Film PCB Tool<br>
<b>ALT+N:</b> Non-Copper Clearing Tool<br>
<b>ALT+P:</b> Paint Area Tool<br>
<b>ALT+R:</b> Transformation Tool<br>
<b>ALT+U:</b> Cutout PCB Tool<br>
<b>ALT+F10:</b> Toggle Full Screen<br>
<br>
<b>F1:</b> Open Online Manual<br>
<b>F2:</b> Open Online Tutorials<br>
<b>Del:</b> Delete Obj
'''
helpbox = QtWidgets.QMessageBox()
helpbox.setText(msg)
helpbox.setWindowTitle("Help")
helpbox.setWindowIcon(QtGui.QIcon('share/help.png'))
helpbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
helpbox.setDefaultButton(QtWidgets.QMessageBox.Ok)
helpbox.exec_()
def on_copy_name(self):
obj = self.collection.get_active()
try:

View File

@ -624,8 +624,102 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
### HERE WE BUILD THE SHORTCUTS LIST. TAB AREA ###
########################################
self.shortcuts_tab = QtWidgets.QWidget()
self.sh_tab_layout = QtWidgets.QVBoxLayout(self.shortcuts_tab)
self.sh_tab_layout = QtWidgets.QVBoxLayout()
self.sh_tab_layout.setContentsMargins(2, 2, 2, 2)
self.shortcuts_tab.setLayout(self.sh_tab_layout)
self.sh_hlay = QtWidgets.QHBoxLayout()
self.sh_title = QtWidgets.QTextEdit(
'<b>Shortcut Key List</b>')
self.sh_title.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
self.sh_title.setFrameStyle(QtWidgets.QFrame.NoFrame)
self.sh_title.setMaximumHeight(30)
font = self.sh_title.font()
font.setPointSize(12)
self.sh_title.setFont(font)
self.sh_tab_layout.addWidget(self.sh_title)
self.sh_tab_layout.addLayout(self.sh_hlay)
self.app_sh_msg = '''<b>Shortcut list</b><br>
<br>
<b>~:</b> Show Shortcut List<br>
<br>
<b>1:</b> Zoom Fit<br>
<b>2:</b> Zoom Out<br>
<b>3:</b> Zoom In<br>
<b>E:</b> Edit Object (if selected)<br>
<b>G:</b> Grid On/Off<br>
<b>J:</b> Jump to Coordinates<br>
<b>L:</b> New Excellon<br>
<b>M:</b> Move Obj<br>
<b>N:</b> New Geometry<br>
<b>O:</b> Set Origin<br>
<b>Q:</b> Change Units<br>
<b>P:</b> Open Properties Tool<br>
<b>R:</b> Rotate by 90 degree CW<br>
<b>S:</b> Shell Toggle<br>
<b>V:</b> View Fit<br>
<b>X:</b> Flip on X_axis<br>
<b>Y:</b> Flip on Y_axis<br>
<br>
<b>Space:</b> En(Dis)able Obj Plot<br>
<b>CTRL+A:</b> Select All<br>
<b>CTRL+C:</b> Copy Obj<br>
<b>CTRL+E:</b> Open Excellon File<br>
<b>CTRL+G:</b> Open Gerber File<br>
<b>CTRL+N:</b> New Project<br>
<b>CTRL+M:</b> Measurement Tool<br>
<b>CTRL+O:</b> Open Project<br>
<b>CTRL+S:</b> Save Project As<br>
<br>
<b>SHIFT+C:</b> Copy Obj_Name<br>
<b>SHIFT+G:</b> Toggle the axis<br>
<b>SHIFT+P:</b> Open Preferences Window<br>
<b>SHIFT+R:</b> Rotate by 90 degree CCW<br>
<b>SHIFT+S:</b> Run a Script<br>
<b>SHIFT+W:</b> Toggle the workspace<br>
<b>SHIFT+X:</b> Skew on X axis<br>
<b>SHIFT+Y:</b> Skew on Y axis<br>
<br>
<b>ALT+C:</b> Calculators Tool<br>
<b>ALT+D:</b> 2-Sided PCB Tool<br>
<b>ALT+L:</b> Film PCB Tool<br>
<b>ALT+N:</b> Non-Copper Clearing Tool<br>
<b>ALT+P:</b> Paint Area Tool<br>
<b>ALT+R:</b> Transformation Tool<br>
<b>ALT+U:</b> Cutout PCB Tool<br>
<b>ALT+F10:</b> Toggle Full Screen<br>
<br>
<b>F1:</b> Open Online Manual<br>
<b>F2:</b> Open Online Tutorials<br>
<b>Del:</b> Delete Obj
'''
self.sh_app = QtWidgets.QTextEdit()
self.sh_app.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
self.sh_app.setText(self.app_sh_msg)
self.sh_app.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
self.sh_hlay.addWidget(self.sh_app)
self.editor_sh_msg = '''<b>A:</b> Draw an Arc (when in Edit Mode)<br>
<b>C:</b> Copy Geo Item (when in Edit Mode)<br>
<b>M:</b> Move Geo Item (when in Edit Mode)<br>
<b>N:</b> Draw a Polygon (when in Edit Mode)<br>
<b>O:</b> Draw a Circle (when in Edit Mode)<br>
<b>P:</b> Draw a Path (when in Edit Mode)<br>
<b>R:</b> Draw Rectangle (when in Edit Mode)<br>
<br>
<b>CTRL+S:</b> Save Object and Exit Editor (when in Edit Mode)<br>
<br>
<b>Space:</b> Rotate Geometry<br>
<b>ENTER:</b> Finish drawing for certain tools<br>
'''
self.sh_editor = QtWidgets.QTextEdit()
self.sh_editor.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
self.sh_editor.setText(self.editor_sh_msg)
self.sh_editor.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
self.sh_hlay.addWidget(self.sh_editor)
##############################################################

View File

@ -3855,7 +3855,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
gcodet_re_string = r'(?=.*(\=\s*[-\+]?\d*\.\d*))'
self.g_t_re = re.compile(gcodet_re_string)
gcodenr_re_string = r'([+-]?\d*\.\d*)'
gcodenr_re_string = r'([+-]?\d*\.\d+)'
self.g_nr_re = re.compile(gcodenr_re_string)
# Attributes to be included in serialization

View File

@ -929,7 +929,12 @@ class FCDetachableTab(QtWidgets.QTabWidget):
drag.setMimeData(mimeData)
# screen = QScreen(self.parentWidget().currentWidget().winId())
# Create the appearance of dragging the tab content
pixmap = self.parent().widget(self.tabAt(self.dragStartPos)).grab()
try:
pixmap = self.parent().widget(self.tabAt(self.dragStartPos)).grab()
except Exception as e:
log.debug("GUIElements.FCDetachable. FCTabBar.mouseMoveEvent() --> %s" % str(e))
return
targetPixmap = QtGui.QPixmap(pixmap.size())
targetPixmap.fill(QtCore.Qt.transparent)
painter = QtGui.QPainter(targetPixmap)

View File

@ -25,6 +25,10 @@ CAD program, and create G-Code for Isolation routing.
- remade the way FlatCAM saves the GUI position data from a file (previously) to use PyQt QSettings
- added a 'theme' combo selection in Edit -> Preferences. Two themes are available: standard and compact.
- some code cleanup
- fixed a source of possible errors in DetachableTab Widget.
- fixed gcode conversion/scale (on units change) when multiple values are found on each line
- replaced the pop-up window for the shortcut list with a new detachable tab
- removed the pop-up messages from the rotate, skew, flip commands
30.01.2019

View File

@ -5957,14 +5957,14 @@ class CNCjob(Geometry):
if units == 'IN':
line = line.replace("mm", "in")
# find any number in header and convert it
match_nr = self.g_nr_re.search(line)
if match_nr:
new_nr = float(match_nr.group()) * xfactor
# replace the updated string
line = line.replace(match_nr.group(),
('%.*f' % (self.app.defaults["cncjob_coords_decimals"], new_nr))
)
# find any float number in header (even multiple on the same line) and convert it
numbers_in_header = re.findall(self.g_nr_re, line)
if numbers_in_header:
for nr in numbers_in_header:
new_nr = float(nr) * xfactor
# replace the updated string
line = line.replace(nr, ('%.*f' % (self.app.defaults["cncjob_coords_decimals"], new_nr))
)
# this scales all the X and Y and Z and F values and also the Tool Dia in the toolchange message
if header_stop is True: