diff --git a/AppDatabase.py b/AppDatabase.py
index cc411f4e..22f745d8 100644
--- a/AppDatabase.py
+++ b/AppDatabase.py
@@ -655,7 +655,7 @@ class ToolsDB(QtWidgets.QWidget):
l_save=str(self.app.get_last_save_folder()),
n=_("Tools_Database"),
date=date),
- filter=filter__)
+ ext_filter=filter__)
filename = str(filename)
@@ -2252,7 +2252,7 @@ class ToolsDB2(QtWidgets.QWidget):
l_save=str(self.app.get_last_save_folder()),
n=_("Tools_Database"),
date=date),
- filter=filter__)
+ ext_filter=filter__)
filename = str(filename)
diff --git a/AppEditors/FlatCAMExcEditor.py b/AppEditors/FlatCAMExcEditor.py
index 96bf8f3b..c5d56218 100644
--- a/AppEditors/FlatCAMExcEditor.py
+++ b/AppEditors/FlatCAMExcEditor.py
@@ -2830,7 +2830,7 @@ class FlatCAMExcEditor(QtCore.QObject):
self.app.ui.exc_edit_toolbar.setDisabled(False)
self.app.ui.exc_edit_toolbar.setVisible(True)
- # self.app.ui.snap_toolbar.setDisabled(False)
+ # self.app.ui.status_toolbar.setDisabled(False)
# start with GRID toolbar activated
if self.app.ui.grid_snap_btn.isChecked() is False:
diff --git a/AppEditors/FlatCAMGeoEditor.py b/AppEditors/FlatCAMGeoEditor.py
index 45e62745..51bb53a6 100644
--- a/AppEditors/FlatCAMGeoEditor.py
+++ b/AppEditors/FlatCAMGeoEditor.py
@@ -3665,7 +3665,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
self.app.ui.geo_edit_toolbar.setDisabled(False)
self.app.ui.geo_edit_toolbar.setVisible(True)
- self.app.ui.snap_toolbar.setDisabled(False)
+ self.app.ui.status_toolbar.setDisabled(False)
self.app.ui.popmenu_disable.setVisible(False)
self.app.ui.cmenu_newmenu.menuAction().setVisible(False)
@@ -4135,11 +4135,11 @@ class FlatCAMGeoEditor(QtCore.QObject):
# make sure that the cursor shape is enabled/disabled, too
if self.options['grid_snap'] is True:
- self.app.inform.emit(_("Grid snap enabled."))
+ self.app.inform[str, bool].emit(_("Grid Snap enabled."), False)
self.app.app_cursor.enabled = True
else:
self.app.app_cursor.enabled = False
- self.app.inform.emit(_("Grid snap disabled."))
+ self.app.inform[str, bool].emit(_("Grid Snap disabled."), False)
def on_canvas_click(self, event):
"""
diff --git a/AppEditors/FlatCAMGrbEditor.py b/AppEditors/FlatCAMGrbEditor.py
index e545d05b..70f386fa 100644
--- a/AppEditors/FlatCAMGrbEditor.py
+++ b/AppEditors/FlatCAMGrbEditor.py
@@ -3703,7 +3703,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
self.app.ui.grb_edit_toolbar.setDisabled(False)
self.app.ui.grb_edit_toolbar.setVisible(True)
- # self.app.ui.snap_toolbar.setDisabled(False)
+ # self.app.ui.status_toolbar.setDisabled(False)
# start with GRID toolbar activated
if self.app.ui.grid_snap_btn.isChecked() is False:
diff --git a/AppEditors/FlatCAMTextEditor.py b/AppEditors/FlatCAMTextEditor.py
index ee7eb7f3..21c8aa7e 100644
--- a/AppEditors/FlatCAMTextEditor.py
+++ b/AppEditors/FlatCAMTextEditor.py
@@ -214,10 +214,10 @@ class TextEditor(QtWidgets.QWidget):
filename = str(FCFileSaveDialog.get_saved_filename(
caption=_("Export Code ..."),
directory=self.app.defaults["global_last_folder"] + '/' + str(obj_name),
- filter=_filter_
+ ext_filter=_filter_
)[0])
except TypeError:
- filename = str(FCFileSaveDialog.get_saved_filename(caption=_("Export Code ..."), filter=_filter_)[0])
+ filename = str(FCFileSaveDialog.get_saved_filename(caption=_("Export Code ..."), ext_filter=_filter_)[0])
if filename == "":
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled."))
diff --git a/AppGUI/GUIElements.py b/AppGUI/GUIElements.py
index f8993d71..5b4f2ec6 100644
--- a/AppGUI/GUIElements.py
+++ b/AppGUI/GUIElements.py
@@ -2554,7 +2554,7 @@ class DialogBoxRadio(QtWidgets.QDialog):
:param title: string with the window title
:param label: string with the message inside the dialog box
"""
- super(DialogBoxRadio, self).__init__()
+ super(DialogBoxRadio, self).__init__(parent=parent)
if initial_text is None:
self.location = str((0, 0))
else:
@@ -2797,9 +2797,12 @@ class MyCompleter(QCompleter):
insertText = QtCore.pyqtSignal(str)
def __init__(self, parent=None):
- QCompleter.__init__(self)
+ QCompleter.__init__(self, parent=parent)
self.setCompletionMode(QCompleter.PopupCompletion)
self.highlighted.connect(self.setHighlighted)
+
+ self.lastSelected = ''
+
# self.popup().installEventFilter(self)
# def eventFilter(self, obj, event):
@@ -2955,9 +2958,9 @@ class FCFileSaveDialog(QtWidgets.QFileDialog):
super(FCFileSaveDialog, self).__init__(*args)
@staticmethod
- def get_saved_filename(parent=None, caption='', directory='', filter='', initialFilter=''):
+ def get_saved_filename(parent=None, caption='', directory='', ext_filter='', initialFilter=''):
filename, _filter = QtWidgets.QFileDialog.getSaveFileName(parent=parent, caption=caption,
- directory=directory, filter=filter,
+ directory=directory, filter=ext_filter,
initialFilter=initialFilter)
filename = str(filename)
@@ -2973,6 +2976,17 @@ class FCFileSaveDialog(QtWidgets.QFileDialog):
return filename, _filter
+class FCDock(QtWidgets.QDockWidget):
+
+ def __init__(self, *args, **kwargs):
+ super(FCDock, self).__init__(*args)
+ self.close_callback = kwargs["close_callback"] if "close_callback" in kwargs else None
+
+ def closeEvent(self, event: QtGui.QCloseEvent) -> None:
+ self.close_callback()
+ super().closeEvent(event)
+
+
class FlatCAMActivityView(QtWidgets.QWidget):
"""
This class create and control the activity icon displayed in the App status bar
diff --git a/AppGUI/MainGUI.py b/AppGUI/MainGUI.py
index 3e14ad76..6423ae8f 100644
--- a/AppGUI/MainGUI.py
+++ b/AppGUI/MainGUI.py
@@ -58,17 +58,6 @@ class MainGUI(QtWidgets.QMainWindow):
# ############ BUILDING THE GUI IS EXECUTED HERE ########################
# #######################################################################
- # #######################################################################
- # ####################### TCL Shell DOCK ################################
- # #######################################################################
- self.shell_dock = QtWidgets.QDockWidget("FlatCAM TCL Shell")
- self.shell_dock.setObjectName('Shell_DockWidget')
- self.shell_dock.setAllowedAreas(QtCore.Qt.AllDockWidgetAreas)
- self.shell_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable |
- QtWidgets.QDockWidget.DockWidgetFloatable |
- QtWidgets.QDockWidget.DockWidgetClosable)
- self.addDockWidget(QtCore.Qt.BottomDockWidgetArea, self.shell_dock)
-
# #######################################################################
# ###################### Menu BUILDING ##################################
# #######################################################################
@@ -200,9 +189,9 @@ class MainGUI(QtWidgets.QMainWindow):
self.menufilerunscript = QtWidgets.QAction(
QtGui.QIcon(self.app.resource_location + '/script16.png'), '%s\tShift+S' % _('Run Script ...'), self)
self.menufilerunscript.setToolTip(
- _("Will run the opened Tcl Script thus\n"
- "enabling the automation of certain\n"
- "functions of FlatCAM.")
+ _("Will run the opened Tcl Script thus\n"
+ "enabling the automation of certain\n"
+ "functions of FlatCAM.")
)
self.menufile_scripting.addAction(self.menufilenewscript)
self.menufile_scripting.addAction(self.menufileopenscript)
@@ -265,9 +254,9 @@ class MainGUI(QtWidgets.QMainWindow):
self.menufileexportexcellon = QtWidgets.QAction(
QtGui.QIcon(self.app.resource_location + '/drill32.png'), _('Export &Excellon ...'), self)
self.menufileexportexcellon.setToolTip(
- _("Will export an Excellon Object as Excellon file,\n"
- "the coordinates format, the file units and zeros\n"
- "are set in Preferences -> Excellon Export.")
+ _("Will export an Excellon Object as Excellon file,\n"
+ "the coordinates format, the file units and zeros\n"
+ "are set in Preferences -> Excellon Export.")
)
self.menufileexport.addAction(self.menufileexportexcellon)
@@ -344,16 +333,16 @@ class MainGUI(QtWidgets.QMainWindow):
self.menuedit_convertjoin = self.menuedit_convert.addAction(
QtGui.QIcon(self.app.resource_location + '/join16.png'), _('&Join Geo/Gerber/Exc -> Geo'))
self.menuedit_convertjoin.setToolTip(
- _("Merge a selection of objects, which can be of type:\n"
- "- Gerber\n"
- "- Excellon\n"
- "- Geometry\n"
- "into a new combo Geometry object.")
+ _("Merge a selection of objects, which can be of type:\n"
+ "- Gerber\n"
+ "- Excellon\n"
+ "- Geometry\n"
+ "into a new combo Geometry object.")
)
self.menuedit_convertjoinexc = self.menuedit_convert.addAction(
QtGui.QIcon(self.app.resource_location + '/join16.png'), _('Join Excellon(s) -> Excellon'))
self.menuedit_convertjoinexc.setToolTip(
- _("Merge a selection of Excellon objects into a new combo Excellon object.")
+ _("Merge a selection of Excellon objects into a new combo Excellon object.")
)
self.menuedit_convertjoingrb = self.menuedit_convert.addAction(
QtGui.QIcon(self.app.resource_location + '/join16.png'), _('Join Gerber(s) -> Gerber'))
@@ -365,14 +354,14 @@ class MainGUI(QtWidgets.QMainWindow):
self.menuedit_convert_sg2mg = self.menuedit_convert.addAction(
QtGui.QIcon(self.app.resource_location + '/convert24.png'), _('Convert Single to MultiGeo'))
self.menuedit_convert_sg2mg.setToolTip(
- _("Will convert a Geometry object from single_geometry type\n"
- "to a multi_geometry type.")
+ _("Will convert a Geometry object from single_geometry type\n"
+ "to a multi_geometry type.")
)
self.menuedit_convert_mg2sg = self.menuedit_convert.addAction(
QtGui.QIcon(self.app.resource_location + '/convert24.png'), _('Convert Multi to SingleGeo'))
self.menuedit_convert_mg2sg.setToolTip(
- _("Will convert a Geometry object from multi_geometry type\n"
- "to a single_geometry type.")
+ _("Will convert a Geometry object from multi_geometry type\n"
+ "to a single_geometry type.")
)
# Separator
self.menuedit_convert.addSeparator()
@@ -825,10 +814,10 @@ class MainGUI(QtWidgets.QMainWindow):
self.grb_edit_toolbar.setObjectName('GrbEditor_TB')
self.addToolBar(self.grb_edit_toolbar)
- self.snap_toolbar = QtWidgets.QToolBar(_('Grid Toolbar'))
- self.snap_toolbar.setObjectName('Snap_TB')
- # self.addToolBar(self.snap_toolbar)
- self.snap_toolbar.setStyleSheet(
+ self.status_toolbar = QtWidgets.QToolBar(_('Grid Toolbar'))
+ self.status_toolbar.setObjectName('Snap_TB')
+ # self.addToolBar(self.status_toolbar)
+ self.status_toolbar.setStyleSheet(
"""
QToolBar { padding: 0; }
QToolBar QToolButton { padding: -2; margin: -2; }
@@ -1088,42 +1077,61 @@ class MainGUI(QtWidgets.QMainWindow):
# ########################################################################
# Snap GRID toolbar is always active to facilitate usage of measurements done on GRID
- self.grid_snap_btn = self.snap_toolbar.addAction(
+ self.grid_snap_btn = self.status_toolbar.addAction(
QtGui.QIcon(self.app.resource_location + '/grid32.png'), _('Snap to grid'))
self.grid_gap_x_entry = FCEntry2()
self.grid_gap_x_entry.setMaximumWidth(70)
self.grid_gap_x_entry.setToolTip(_("Grid X snapping distance"))
- self.snap_toolbar.addWidget(self.grid_gap_x_entry)
+ self.status_toolbar.addWidget(self.grid_gap_x_entry)
- self.snap_toolbar.addWidget(QtWidgets.QLabel(" "))
+ self.status_toolbar.addWidget(QtWidgets.QLabel(" "))
self.grid_gap_link_cb = FCCheckBox()
self.grid_gap_link_cb.setToolTip(_("When active, value on Grid_X\n"
"is copied to the Grid_Y value."))
- self.snap_toolbar.addWidget(self.grid_gap_link_cb)
- self.snap_toolbar.addWidget(QtWidgets.QLabel(" "))
+ self.status_toolbar.addWidget(self.grid_gap_link_cb)
+ self.status_toolbar.addWidget(QtWidgets.QLabel(" "))
self.grid_gap_y_entry = FCEntry2()
self.grid_gap_y_entry.setMaximumWidth(70)
self.grid_gap_y_entry.setToolTip(_("Grid Y snapping distance"))
- self.snap_toolbar.addWidget(self.grid_gap_y_entry)
+ self.status_toolbar.addWidget(self.grid_gap_y_entry)
+
+ self.status_toolbar.addWidget(QtWidgets.QLabel(" "))
+ self.axis_status_label = FCLabel()
+ self.axis_status_label.setToolTip(_("Toggle the display of axis on canvas"))
+ self.axis_status_label.setPixmap(QtGui.QPixmap(self.app.resource_location + '/axis16.png'))
+ self.status_toolbar.addWidget(self.axis_status_label)
+ self.status_toolbar.addWidget(QtWidgets.QLabel(" "))
self.shell_status_label = FCLabel()
+ self.shell_status_label.setToolTip(_("Command Line"))
self.shell_status_label.setPixmap(QtGui.QPixmap(self.app.resource_location + '/shell20.png'))
- self.snap_toolbar.addWidget(self.shell_status_label)
+ self.status_toolbar.addWidget(self.shell_status_label)
self.ois_grid = OptionalInputSection(self.grid_gap_link_cb, [self.grid_gap_y_entry], logic=False)
- self.corner_snap_btn = self.snap_toolbar.addAction(
+ self.corner_snap_btn = self.status_toolbar.addAction(
QtGui.QIcon(self.app.resource_location + '/corner32.png'), _('Snap to corner'))
self.snap_max_dist_entry = FCEntry()
self.snap_max_dist_entry.setMaximumWidth(70)
self.snap_max_dist_entry.setToolTip(_("Max. magnet distance"))
- self.snap_magnet = self.snap_toolbar.addWidget(self.snap_max_dist_entry)
+ self.snap_magnet = self.status_toolbar.addWidget(self.snap_max_dist_entry)
self.corner_snap_btn.setVisible(False)
self.snap_magnet.setVisible(False)
+ # #######################################################################
+ # ####################### TCL Shell DOCK ################################
+ # #######################################################################
+ self.shell_dock = FCDock("FlatCAM TCL Shell", close_callback=self.toggle_shell_ui)
+ self.shell_dock.setObjectName('Shell_DockWidget')
+ self.shell_dock.setAllowedAreas(QtCore.Qt.AllDockWidgetAreas)
+ self.shell_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable |
+ QtWidgets.QDockWidget.DockWidgetFloatable |
+ QtWidgets.QDockWidget.DockWidgetClosable)
+ self.addDockWidget(QtCore.Qt.BottomDockWidgetArea, self.shell_dock)
+
# ########################################################################
# ########################## Notebook # ##################################
# ########################################################################
@@ -1493,8 +1501,7 @@ class MainGUI(QtWidgets.QMainWindow):
QtGui.QIcon(self.app.resource_location + '/resize16.png'), _("Resize Drill"))
self.popMenu.addSeparator()
- self.popmenu_copy = self.popMenu.addAction(
- QtGui.QIcon(self.app.resource_location + '/copy32.png'), _("Copy"))
+ self.popmenu_copy = self.popMenu.addAction(QtGui.QIcon(self.app.resource_location + '/copy32.png'), _("Copy"))
self.popmenu_delete = self.popMenu.addAction(
QtGui.QIcon(self.app.resource_location + '/delete32.png'), _("Delete"))
self.popmenu_edit = self.popMenu.addAction(
@@ -1517,19 +1524,19 @@ class MainGUI(QtWidgets.QMainWindow):
self.infobar.addWidget(self.fcinfo, stretch=1)
# self.rel_position_label = QtWidgets.QLabel(
- # "Dx: 0.0000 Dy: 0.0000 ")
+ # "Dx: 0.0000 Dy: 0.0000 ")
# self.rel_position_label.setMinimumWidth(110)
# self.rel_position_label.setToolTip(_("Relative measurement.\nReference is last click position"))
# self.infobar.addWidget(self.rel_position_label)
#
- self.position_label = QtWidgets.QLabel(
- " X: 0.0000 Y: 0.0000 ")
+ self.position_label = QtWidgets.QLabel(" X: 0.0000 Y: 0.0000 ")
self.position_label.setMinimumWidth(110)
- self.position_label.setToolTip(_("Absolute measurement.\nReference is (X=0, Y= 0) position"))
+ self.position_label.setToolTip(_("Absolute measurement.\n"
+ "Reference is (X=0, Y= 0) position"))
self.infobar.addWidget(self.position_label)
- self.snap_toolbar.setMaximumHeight(24)
- self.infobar.addWidget(self.snap_toolbar)
+ self.status_toolbar.setMaximumHeight(24)
+ self.infobar.addWidget(self.status_toolbar)
self.hud_label = FCLabel("H")
self.hud_label.setToolTip(_("HUD (Heads up display)"))
@@ -1537,10 +1544,14 @@ class MainGUI(QtWidgets.QMainWindow):
self.infobar.addWidget(self.hud_label)
self.wplace_label = FCLabel("A4")
+ self.wplace_label.setToolTip(_("Draw a delimiting rectangle on canvas.\n"
+ "The purpose is to illustrate the limits for our work.")
+ )
self.wplace_label.setMargin(2)
self.infobar.addWidget(self.wplace_label)
self.units_label = QtWidgets.QLabel("[mm]")
+ self.units_label.setToolTip(_("Application units"))
self.units_label.setMargin(2)
self.infobar.addWidget(self.units_label)
@@ -1659,8 +1670,8 @@ class MainGUI(QtWidgets.QMainWindow):
self.clear_btn.clicked.connect(self.on_gui_clear)
self.wplace_label.clicked.connect(self.app.on_workspace_toggle)
- self.hud_label.clicked.connect(self.app.on_toggle_hud)
self.shell_status_label.clicked.connect(self.toggle_shell_ui)
+
# to be used in the future
# self.plot_tab_area.tab_attached.connect(lambda x: print(x))
# self.plot_tab_area.tab_detached.connect(lambda x: print(x))
@@ -1760,12 +1771,12 @@ class MainGUI(QtWidgets.QMainWindow):
self.grb_edit_toolbar.setVisible(False)
# if tb & 128:
- # self.ui.snap_toolbar.setVisible(True)
+ # self.ui.status_toolbar.setVisible(True)
# else:
- # self.ui.snap_toolbar.setVisible(False)
+ # self.ui.status_toolbar.setVisible(False)
# Grid Toolbar is always active now
- self.snap_toolbar.setVisible(True)
+ self.status_toolbar.setVisible(True)
if tb & 256:
self.toolbarshell.setVisible(True)
@@ -2241,11 +2252,11 @@ class MainGUI(QtWidgets.QMainWindow):
# Toggle axis
if key == QtCore.Qt.Key_G:
- self.app.on_toggle_axis()
+ self.app.plotcanvas.on_toggle_axis()
# Toggle HUD (Heads-Up Display)
if key == QtCore.Qt.Key_H:
- self.app.on_toggle_hud()
+ self.app.plotcanvas.on_toggle_hud()
# Locate in Object
if key == QtCore.Qt.Key_J:
self.app.on_locate(obj=self.app.collection.get_active())
@@ -2324,7 +2335,7 @@ class MainGUI(QtWidgets.QMainWindow):
# Toggle Grid lines
if key == QtCore.Qt.Key_G:
- self.app.on_toggle_grid_lines()
+ self.app.plotcanvas.on_toggle_grid_lines()
return
# Punch Gerber Tool
@@ -2494,7 +2505,7 @@ class MainGUI(QtWidgets.QMainWindow):
if active_index == 0:
self.app.collection.set_active(names_list[-1])
else:
- self.app.collection.set_active(names_list[active_index-1])
+ self.app.collection.set_active(names_list[active_index - 1])
# Select the object in the Tree below the current one
if key == QtCore.Qt.Key_Down:
@@ -2509,7 +2520,7 @@ class MainGUI(QtWidgets.QMainWindow):
if active_index == len(names_list) - 1:
self.app.collection.set_active(names_list[0])
else:
- self.app.collection.set_active(names_list[active_index+1])
+ self.app.collection.set_active(names_list[active_index + 1])
# New Geometry
if key == QtCore.Qt.Key_B:
@@ -3583,7 +3594,7 @@ class MainGUI(QtWidgets.QMainWindow):
# hide all Toolbars
for tb in self.findChildren(QtWidgets.QToolBar):
tb.setVisible(False)
- self.snap_toolbar.setVisible(True) # This Toolbar is always visible so restore it
+ self.status_toolbar.setVisible(True) # This Toolbar is always visible so restore it
self.splitter.setSizes([0, 1])
self.toggle_fscreen = True
@@ -3695,7 +3706,7 @@ class ShortcutsTab(QtWidgets.QWidget):
self.sh_tab_layout.addLayout(self.sh_hlay)
self.app_sh_msg = (
- '''%s
+ '''%s
@@ -4064,53 +4075,53 @@ class ShortcutsTab(QtWidgets.QWidget):
''' %
- (
- _("General Shortcut list"),
- _("SHOW SHORTCUT LIST"), _("Switch to Project Tab"), _("Switch to Selected Tab"),
- _("Switch to Tool Tab"),
- _("New Gerber"), _("Edit Object (if selected)"), _("Grid On/Off"), _("Jump to Coordinates"),
- _("New Excellon"), _("Move Obj"), _("New Geometry"), _("Set Origin"), _("Change Units"),
- _("Open Properties Tool"), _("Rotate by 90 degree CW"), _("Shell Toggle"),
- _("Add a Tool (when in Geometry Selected Tab or in Tools NCC or Tools Paint)"), _("Zoom Fit"),
- _("Flip on X_axis"), _("Flip on Y_axis"), _("Zoom Out"), _("Zoom In"),
+ (
+ _("General Shortcut list"),
+ _("SHOW SHORTCUT LIST"), _("Switch to Project Tab"), _("Switch to Selected Tab"),
+ _("Switch to Tool Tab"),
+ _("New Gerber"), _("Edit Object (if selected)"), _("Grid On/Off"), _("Jump to Coordinates"),
+ _("New Excellon"), _("Move Obj"), _("New Geometry"), _("Set Origin"), _("Change Units"),
+ _("Open Properties Tool"), _("Rotate by 90 degree CW"), _("Shell Toggle"),
+ _("Add a Tool (when in Geometry Selected Tab or in Tools NCC or Tools Paint)"), _("Zoom Fit"),
+ _("Flip on X_axis"), _("Flip on Y_axis"), _("Zoom Out"), _("Zoom In"),
- # CTRL section
- _("Select All"), _("Copy Obj"), _("Open Tools Database"),
- _("Open Excellon File"), _("Open Gerber File"), _("Distance Tool"), _("New Project"),
- _("Open Project"), _("Print (PDF)"), _("PDF Import Tool"), _("Save Project"), _("Toggle Plot Area"),
+ # CTRL section
+ _("Select All"), _("Copy Obj"), _("Open Tools Database"),
+ _("Open Excellon File"), _("Open Gerber File"), _("Distance Tool"), _("New Project"),
+ _("Open Project"), _("Print (PDF)"), _("PDF Import Tool"), _("Save Project"), _("Toggle Plot Area"),
- # SHIFT section
- _("Copy Obj_Name"),
- _("Toggle Code Editor"), _("Toggle the axis"), _("Locate in Object"), _("Distance Minimum Tool"),
- _("Open Preferences Window"),
- _("Rotate by 90 degree CCW"), _("Run a Script"), _("Toggle the workspace"), _("Skew on X axis"),
- _("Skew on Y axis"),
+ # SHIFT section
+ _("Copy Obj_Name"),
+ _("Toggle Code Editor"), _("Toggle the axis"), _("Locate in Object"), _("Distance Minimum Tool"),
+ _("Open Preferences Window"),
+ _("Rotate by 90 degree CCW"), _("Run a Script"), _("Toggle the workspace"), _("Skew on X axis"),
+ _("Skew on Y axis"),
- # ALT section
- _("Align Objects Tool"), _("Calculators Tool"), _("2-Sided PCB Tool"), _("Extract Drills Tool"),
- _("Fiducials Tool"), _("Toggle Grid Lines"),
- _("Punch Gerber Tool"), _("Isolation Tool"), _("Copper Thieving Tool"),
- _("Solder Paste Dispensing Tool"),
- _("Film PCB Tool"), _("Corner Markers Tool"), _("Non-Copper Clearing Tool"), _("Optimal Tool"),
- _("Paint Area Tool"), _("QRCode Tool"), _("Rules Check Tool"),
- _("View File Source"), _("Transformations Tool"),
- _("Subtract Tool"), _("Cutout PCB Tool"), _("Panelize PCB"),
- _("Enable all Plots"), _("Disable all Plots"), _("Disable Non-selected Plots"),
- _("Toggle Full Screen"),
+ # ALT section
+ _("Align Objects Tool"), _("Calculators Tool"), _("2-Sided PCB Tool"), _("Extract Drills Tool"),
+ _("Fiducials Tool"), _("Toggle Grid Lines"),
+ _("Punch Gerber Tool"), _("Isolation Tool"), _("Copper Thieving Tool"),
+ _("Solder Paste Dispensing Tool"),
+ _("Film PCB Tool"), _("Corner Markers Tool"), _("Non-Copper Clearing Tool"), _("Optimal Tool"),
+ _("Paint Area Tool"), _("QRCode Tool"), _("Rules Check Tool"),
+ _("View File Source"), _("Transformations Tool"),
+ _("Subtract Tool"), _("Cutout PCB Tool"), _("Panelize PCB"),
+ _("Enable all Plots"), _("Disable all Plots"), _("Disable Non-selected Plots"),
+ _("Toggle Full Screen"),
- # CTRL + ALT section
- _("Abort current task (gracefully)"),
+ # CTRL + ALT section
+ _("Abort current task (gracefully)"),
- # CTRL + SHIFT section
- _("Save Project As"),
- _("Paste Special. Will convert a Windows path style to the one required in Tcl Shell"),
+ # CTRL + SHIFT section
+ _("Save Project As"),
+ _("Paste Special. Will convert a Windows path style to the one required in Tcl Shell"),
- # F keys section
- _("Open Online Manual"),
- _("Open Online Tutorials"), _("Refresh Plots"), _("Delete Object"), _("Alternate: Delete Tool"),
- _("(left to Key_1)Toggle Notebook Area (Left Side)"), _("En(Dis)able Obj Plot"),
- _("Deselects all objects")
- )
+ # F keys section
+ _("Open Online Manual"),
+ _("Open Online Tutorials"), _("Refresh Plots"), _("Delete Object"), _("Alternate: Delete Tool"),
+ _("(left to Key_1)Toggle Notebook Area (Left Side)"), _("En(Dis)able Obj Plot"),
+ _("Deselects all objects")
+ )
)
self.sh_app = QtWidgets.QTextEdit()
diff --git a/AppGUI/PlotCanvas.py b/AppGUI/PlotCanvas.py
index 62fa8d2d..6f7cdc9f 100644
--- a/AppGUI/PlotCanvas.py
+++ b/AppGUI/PlotCanvas.py
@@ -12,9 +12,17 @@ from AppGUI.VisPyCanvas import VisPyCanvas, Color
from AppGUI.VisPyVisuals import ShapeGroup, ShapeCollection, TextCollection, TextGroup, Cursor
from vispy.scene.visuals import InfiniteLine, Line, Rectangle, Text
+import gettext
+import AppTranslation as fcTranslate
+import builtins
+
import numpy as np
from vispy.geometry import Rect
+fcTranslate.apply_language('strings')
+if '_' not in builtins.__dict__:
+ _ = gettext.gettext
+
log = logging.getLogger('base')
@@ -133,11 +141,6 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
self.h_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 0.8), vertical=False,
parent=self.view.scene)
- # draw a rectangle made out of 4 lines on the canvas to serve as a hint for the work area
- # all CNC have a limited workspace
- if self.fcapp.defaults['global_workspace'] is True:
- self.draw_workspace(workspace_size=self.fcapp.defaults["global_workspaceT"])
-
self.line_parent = None
if self.fcapp.defaults["global_cursor_color_enabled"]:
c_color = Color(self.fcapp.defaults["global_cursor_color"]).rgba
@@ -150,9 +153,6 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
self.cursor_h_line = InfiniteLine(pos=None, color=c_color, vertical=False,
parent=self.line_parent)
- # HUD Display
- self.hud_enabled = False
-
# font size
qsettings = QtCore.QSettings("Open Source", "FlatCAM")
if qsettings.contains("hud_font_size"):
@@ -181,10 +181,27 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
border_color=self.rect_hud_color, color=self.rect_hud_color, parent=None)
self.rect_hud.set_gl_state(depth_test=False)
+ # draw a rectangle made out of 4 lines on the canvas to serve as a hint for the work area
+ # all CNC have a limited workspace
+ if self.fcapp.defaults['global_workspace'] is True:
+ self.draw_workspace(workspace_size=self.fcapp.defaults["global_workspaceT"])
+
+ # HUD Display
+ self.hud_enabled = False
+
# enable the HUD if it is activated in FlatCAM Preferences
if self.fcapp.defaults['global_hud'] is True:
self.on_toggle_hud(state=True)
+ # Axis Display
+ self.axis_enabled = True
+
+ # enable Axis
+ self.on_toggle_axis(state=True)
+
+ # enable Grid lines
+ self.grid_lines_enabled = True
+
self.shape_collections = []
self.shape_collection = self.new_shape_collection()
@@ -201,27 +218,75 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
self.graph_event_connect('mouse_wheel', self.on_mouse_scroll)
- def on_toggle_hud(self, state):
+ def on_toggle_axis(self, signal=None, state=None):
+ if state is None:
+ state = not self.axis_enabled
+
+ if state:
+ self.axis_enabled = True
+ self.v_line.parent = self.view.scene
+ self.h_line.parent = self.view.scene
+ self.fcapp.ui.axis_status_label.setStyleSheet("""
+ QLabel
+ {
+ color: black;
+ background-color: peachpuff;
+ }
+ """)
+ self.fcapp.inform[str, bool].emit(_("Axis enabled."), False)
+ else:
+ self.axis_enabled = False
+ self.v_line.parent = None
+ self.h_line.parent = None
+ self.fcapp.ui.axis_status_label.setStyleSheet("")
+ self.fcapp.inform[str, bool].emit(_("Axis disabled."), False)
+
+ def on_toggle_hud(self, signal=None, state=None):
+ if state is None:
+ state = not self.hud_enabled
+
if state:
self.hud_enabled = True
self.rect_hud.parent = self.view
self.text_hud.parent = self.view
-
self.fcapp.defaults['global_hud'] = True
self.fcapp.ui.hud_label.setStyleSheet("""
- QLabel
- {
- color: black;
- background-color: lightblue;
- }
- """)
+ QLabel
+ {
+ color: black;
+ background-color: lightblue;
+ }
+ """)
+ self.fcapp.inform[str, bool].emit(_("HUD enabled."), False)
+
else:
self.hud_enabled = False
self.rect_hud.parent = None
self.text_hud.parent = None
-
self.fcapp.defaults['global_hud'] = False
self.fcapp.ui.hud_label.setStyleSheet("")
+ self.fcapp.inform[str, bool].emit(_("HUD disabled."), False)
+
+ def on_toggle_grid_lines(self):
+ state = not self.grid_lines_enabled
+
+ if state:
+ self.grid_lines_enabled = True
+ self.grid.parent = self.view.scene
+ self.fcapp.inform[str, bool].emit(_("Grid enabled."), False)
+ else:
+ self.grid_lines_enabled = False
+ self.grid.parent = None
+ self.fcapp.inform[str, bool].emit(_("Grid disabled."), False)
+
+ # HACK: enabling/disabling the cursor seams to somehow update the shapes on screen
+ # - perhaps is a bug in VisPy implementation
+ if self.fcapp.grid_status():
+ self.fcapp.app_cursor.enabled = False
+ self.fcapp.app_cursor.enabled = True
+ else:
+ self.fcapp.app_cursor.enabled = True
+ self.fcapp.app_cursor.enabled = False
def draw_workspace(self, workspace_size):
"""
diff --git a/AppGUI/PlotCanvasLegacy.py b/AppGUI/PlotCanvasLegacy.py
index b65cc18b..47cd24c0 100644
--- a/AppGUI/PlotCanvasLegacy.py
+++ b/AppGUI/PlotCanvasLegacy.py
@@ -38,7 +38,6 @@ fcTranslate.apply_language('strings')
if '_' not in builtins.__dict__:
_ = gettext.gettext
-
log = logging.getLogger('base')
@@ -310,6 +309,9 @@ class PlotCanvasLegacy(QtCore.QObject):
self.hud_enabled = False
self.text_hud = self.Thud(plotcanvas=self)
+ # enable Grid lines
+ self.grid_lines_enabled = True
+
# draw a rectangle made out of 4 lines on the canvas to serve as a hint for the work area
# all CNC have a limited workspace
if self.app.defaults['global_workspace'] is True:
@@ -318,25 +320,62 @@ class PlotCanvasLegacy(QtCore.QObject):
if self.app.defaults['global_hud'] is True:
self.on_toggle_hud(state=True)
- def on_toggle_hud(self, state):
+ # Axis Display
+ self.axis_enabled = True
+
+ # enable Axis
+ self.on_toggle_axis(state=True)
+
+ def on_toggle_axis(self, signal=None, state=None):
+ if state is None:
+ state = not self.axis_enabled
+
+ if state:
+ self.axis_enabled = True
+ if self.h_line not in self.axes.lines and self.v_line not in self.axes.lines:
+ self.h_line = self.axes.axhline(color=(0.70, 0.3, 0.3), linewidth=2)
+ self.v_line = self.axes.axvline(color=(0.70, 0.3, 0.3), linewidth=2)
+ self.app.ui.axis_status_label.setStyleSheet("""
+ QLabel
+ {
+ color: black;
+ background-color: peachpuff;
+ }
+ """)
+ self.app.inform[str, bool].emit(_("Axis enabled."), False)
+ else:
+ self.axis_enabled = False
+ if self.h_line in self.axes.lines and self.v_line in self.axes.lines:
+ self.axes.lines.remove(self.h_line)
+ self.axes.lines.remove(self.v_line)
+ self.app.ui.axis_status_label.setStyleSheet("")
+ self.app.inform[str, bool].emit(_("Axis disabled."), False)
+
+ self.canvas.draw()
+
+ def on_toggle_hud(self, signal=None, state=None):
+ if state is None:
+ state = not self.hud_enabled
+
if state:
self.hud_enabled = True
self.text_hud.add_artist()
-
self.app.defaults['global_hud'] = True
- self.fcapp.ui.hud_label.setStyleSheet("""
- QLabel
- {
- color: black;
- background-color: lightblue;
- }
- """)
+
+ self.app.ui.hud_label.setStyleSheet("""
+ QLabel
+ {
+ color: black;
+ background-color: lightblue;
+ }
+ """)
+ self.app.inform[str, bool].emit(_("HUD enabled."), False)
else:
self.hud_enabled = False
self.text_hud.remove_artist()
-
self.app.defaults['global_hud'] = False
- self.fcapp.ui.hud_label.setStyleSheet("")
+ self.app.ui.hud_label.setStyleSheet("")
+ self.app.inform[str, bool].emit(_("HUD disabled."), False)
self.canvas.draw()
@@ -399,6 +438,26 @@ class PlotCanvasLegacy(QtCore.QObject):
if self.hud_holder in self.p.axes.artists:
self.p.axes.artists.remove(self.hud_holder)
+ def on_toggle_grid_lines(self):
+ state = not self.grid_lines_enabled
+
+ if state:
+ self.grid_lines_enabled = True
+ self.axes.grid(True)
+ try:
+ self.canvas.draw()
+ except IndexError:
+ pass
+ self.app.inform[str, bool].emit(_("Grid enabled."), False)
+ else:
+ self.grid_lines_enabled = False
+ self.axes.grid(False)
+ try:
+ self.canvas.draw()
+ except IndexError:
+ pass
+ self.app.inform[str, bool].emit(_("Grid disabled."), False)
+
def draw_workspace(self, workspace_size):
"""
Draw a rectangular shape on canvas to specify our valid workspace.
diff --git a/AppGUI/preferences/PreferencesUIManager.py b/AppGUI/preferences/PreferencesUIManager.py
index d2a82919..76cf63de 100644
--- a/AppGUI/preferences/PreferencesUIManager.py
+++ b/AppGUI/preferences/PreferencesUIManager.py
@@ -1122,7 +1122,7 @@ class PreferencesUIManager:
if self.ui.grb_edit_toolbar.isVisible():
tb_status += 64
- if self.ui.snap_toolbar.isVisible():
+ if self.ui.status_toolbar.isVisible():
tb_status += 128
if self.ui.toolbarshell.isVisible():
diff --git a/AppObjects/FlatCAMCNCJob.py b/AppObjects/FlatCAMCNCJob.py
index 97ccf248..f0fe0765 100644
--- a/AppObjects/FlatCAMCNCJob.py
+++ b/AppObjects/FlatCAMCNCJob.py
@@ -506,10 +506,10 @@ class CNCJobObject(FlatCAMObj, CNCjob):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption=_("Export Machine Code ..."),
directory=dir_file_to_save,
- filter=_filter_
+ ext_filter=_filter_
)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export Machine Code ..."), filter=_filter_)
+ filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export Machine Code ..."), ext_filter=_filter_)
filename = str(filename)
diff --git a/AppTools/ToolFilm.py b/AppTools/ToolFilm.py
index 3fb079ed..9da564da 100644
--- a/AppTools/ToolFilm.py
+++ b/AppTools/ToolFilm.py
@@ -729,7 +729,7 @@ class Film(AppTool):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption=_("Export positive film"),
directory=self.app.get_last_save_folder() + '/' + name + '_film',
- filter=filter_ext)
+ ext_filter=filter_ext)
except TypeError:
filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export positive film"))
@@ -875,7 +875,7 @@ class Film(AppTool):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption=_("Export negative film"),
directory=self.app.get_last_save_folder() + '/' + name + '_film',
- filter=filter_ext)
+ ext_filter=filter_ext)
except TypeError:
filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export negative film"))
diff --git a/AppTools/ToolQRCode.py b/AppTools/ToolQRCode.py
index 1462f205..28ea7c9f 100644
--- a/AppTools/ToolQRCode.py
+++ b/AppTools/ToolQRCode.py
@@ -781,9 +781,9 @@ class QRCode(AppTool):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption=_("Export PNG"),
directory=self.app.get_last_save_folder() + '/' + str(name) + '_png',
- filter=_filter)
+ ext_filter=_filter)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export PNG"), filter=_filter)
+ filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export PNG"), ext_filter=_filter)
filename = str(filename)
@@ -828,9 +828,9 @@ class QRCode(AppTool):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption=_("Export SVG"),
directory=self.app.get_last_save_folder() + '/' + str(name) + '_svg',
- filter=_filter)
+ ext_filter=_filter)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export SVG"), filter=_filter)
+ filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export SVG"), ext_filter=_filter)
filename = str(filename)
diff --git a/AppTools/ToolSolderPaste.py b/AppTools/ToolSolderPaste.py
index d48e7864..b2b3ed99 100644
--- a/AppTools/ToolSolderPaste.py
+++ b/AppTools/ToolSolderPaste.py
@@ -1493,10 +1493,11 @@ class SolderPaste(AppTool):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption=_("Export GCode ..."),
directory=dir_file_to_save,
- filter=_filter_
+ ext_filter=_filter_
)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export Machine Code ..."), filter=_filter_)
+ filename, _f = FCFileSaveDialog.get_saved_filename(
+ caption=_("Export Machine Code ..."), ext_filter=_filter_)
if filename == '':
self.app.inform.emit('[WARNING_NOTCL] %s' %
diff --git a/App_Main.py b/App_Main.py
index eb3664e9..24160317 100644
--- a/App_Main.py
+++ b/App_Main.py
@@ -873,10 +873,11 @@ class App(QtCore.QObject):
self.ui.menuview_toggle_notebook.triggered.connect(self.ui.on_toggle_notebook)
self.ui.menu_toggle_nb.triggered.connect(self.ui.on_toggle_notebook)
self.ui.menuview_toggle_grid.triggered.connect(self.ui.on_toggle_grid)
- self.ui.menuview_toggle_grid_lines.triggered.connect(self.on_toggle_grid_lines)
- self.ui.menuview_toggle_axis.triggered.connect(self.on_toggle_axis)
self.ui.menuview_toggle_workspace.triggered.connect(self.on_workspace_toggle)
- self.ui.menuview_toggle_hud.triggered.connect(self.on_toggle_hud)
+
+ self.ui.menuview_toggle_grid_lines.triggered.connect(self.plotcanvas.on_toggle_grid_lines)
+ self.ui.menuview_toggle_axis.triggered.connect(self.plotcanvas.on_toggle_axis)
+ self.ui.menuview_toggle_hud.triggered.connect(self.plotcanvas.on_toggle_hud)
self.ui.menutoolshell.triggered.connect(self.ui.toggle_shell_ui)
@@ -1021,6 +1022,15 @@ class App(QtCore.QObject):
self.ui.util_defaults_form.kw_group.del_btn.clicked.connect(
lambda: self.del_extension(ext_type='keyword'))
+ # ###########################################################################################################
+ # ########################################### GUI SIGNALS ###################################################
+ # ###########################################################################################################
+ self.ui.hud_label.clicked.connect(self.plotcanvas.on_toggle_hud)
+ self.ui.axis_status_label.clicked.connect(self.plotcanvas.on_toggle_axis)
+
+ # ###########################################################################################################
+ # ####################################### VARIOUS SIGNALS ###################################################
+ # ###########################################################################################################
# connect the abort_all_tasks related slots to the related signals
self.proc_container.idle_flag.connect(self.app_is_idle)
@@ -1345,7 +1355,7 @@ class App(QtCore.QObject):
try:
self.install_tools()
except AttributeError as e:
- log.debug("App.__init__() install tools() --> %s" % str(e))
+ log.debug("App.__init__() install_tools() --> %s" % str(e))
# ###########################################################################################################
# ############################################ SETUP RECENT ITEMS ###########################################
@@ -1441,12 +1451,6 @@ class App(QtCore.QObject):
# holds the key modifier if pressed (CTRL, SHIFT or ALT)
self.key_modifiers = None
- # Variable to hold the status of the axis
- self.toggle_axis = True
-
- # Variable to hold the status of the grid lines
- self.toggle_grid_lines = True
-
# Variable to store the status of the code editor
self.toggle_codeeditor = False
@@ -2371,7 +2375,10 @@ class App(QtCore.QObject):
Informs the user. Normally on the status bar, optionally
also on the shell.
- :param msg: Text to write.
+ :param msg: Text to write.
+ :type msg: str
+ :param shell_echo: Control if to display the message msg in the Shell
+ :type shell_echo: bool
:return: None
"""
@@ -2462,10 +2469,11 @@ class App(QtCore.QObject):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption=_("Export FlatCAM Preferences"),
directory=self.data_path + '/preferences_' + date,
- filter=filter__
+ ext_filter=filter__
)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export FlatCAM Preferences"), filter=filter__)
+ filename, _f = FCFileSaveDialog.get_saved_filename(
+ caption=_("Export FlatCAM Preferences"), ext_filter=filter__)
filename = str(filename)
if filename == "":
self.inform.emit('[WARNING_NOTCL] %s' % _("Cancelled."))
@@ -2507,10 +2515,10 @@ class App(QtCore.QObject):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption=_("Save to file"),
directory=path_to_save + '/file_' + self.date,
- filter=filter__
+ ext_filter=filter__
)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Save to file"), filter=filter__)
+ filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Save to file"), ext_filter=filter__)
filename = str(filename)
@@ -3864,7 +3872,8 @@ class App(QtCore.QObject):
# Keys in self.defaults for which to scale their values
dimensions = ['tools_iso_tooldia', 'gerber_noncoppermargin', 'gerber_bboxmargin',
- "gerber_editor_newsize", "gerber_editor_lin_pitch", "gerber_editor_buff_f", "tools_iso_tool_vtipdia",
+ "gerber_editor_newsize", "gerber_editor_lin_pitch", "gerber_editor_buff_f",
+ "tools_iso_tool_vtipdia",
"tools_iso_tool_cutz", "gerber_editor_newdim", "gerber_editor_ma_low",
"gerber_editor_ma_high",
@@ -4089,95 +4098,6 @@ class App(QtCore.QObject):
self.ui.grid_gap_x_entry.set_value(val_x, decimals=self.decimals)
self.ui.grid_gap_y_entry.set_value(val_y, decimals=self.decimals)
- def on_toggle_axis(self):
- self.defaults.report_usage("on_toggle_axis()")
-
- if self.toggle_axis is False:
- if self.is_legacy is False:
- self.plotcanvas.v_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 1.0), vertical=True,
- parent=self.plotcanvas.view.scene)
-
- self.plotcanvas.h_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 1.0), vertical=False,
- parent=self.plotcanvas.view.scene)
- else:
- if self.plotcanvas.h_line not in self.plotcanvas.axes.lines and \
- self.plotcanvas.v_line not in self.plotcanvas.axes.lines:
- self.plotcanvas.h_line = self.plotcanvas.axes.axhline(color=(0.70, 0.3, 0.3), linewidth=2)
- self.plotcanvas.v_line = self.plotcanvas.axes.axvline(color=(0.70, 0.3, 0.3), linewidth=2)
- self.plotcanvas.canvas.draw()
- self.inform.emit(_("Axis enabled."))
- self.toggle_axis = True
- else:
- if self.is_legacy is False:
- self.plotcanvas.v_line.parent = None
- self.plotcanvas.h_line.parent = None
- else:
- if self.plotcanvas.h_line in self.plotcanvas.axes.lines and \
- self.plotcanvas.v_line in self.plotcanvas.axes.lines:
- self.plotcanvas.axes.lines.remove(self.plotcanvas.h_line)
- self.plotcanvas.axes.lines.remove(self.plotcanvas.v_line)
- self.plotcanvas.canvas.draw()
- self.inform.emit(_("Axis disabled."))
- self.toggle_axis = False
-
- def on_toggle_hud(self):
- new_state = False if self.plotcanvas.hud_enabled else True
-
- self.plotcanvas.on_toggle_hud(state=new_state)
- if new_state is False:
- self.inform[str, bool].emit(_("HUD disabled."), False)
- else:
- self.inform[str, bool].emit(_("HUD enabled."), False)
-
- def on_toggle_grid_lines(self):
- self.defaults.report_usage("on_toggle_grd_lines()")
-
- tt_settings = QtCore.QSettings("Open Source", "FlatCAM")
- if tt_settings.contains("theme"):
- theme = tt_settings.value('theme', type=str)
- else:
- theme = 'white'
-
- if self.toggle_grid_lines is False:
- if self.is_legacy is False:
- if theme == 'white':
- self.plotcanvas.grid._grid_color_fn['color'] = Color('dimgray').rgba
- else:
- self.plotcanvas.grid._grid_color_fn['color'] = Color('#dededeff').rgba
- else:
- self.plotcanvas.axes.grid(True)
- try:
- self.plotcanvas.canvas.draw()
- except IndexError:
- pass
- pass
- self.inform.emit(_("Grid enabled."))
- self.toggle_grid_lines = True
- else:
- if self.is_legacy is False:
- if theme == 'white':
- self.plotcanvas.grid._grid_color_fn['color'] = Color('#ffffffff').rgba
- else:
- self.plotcanvas.grid._grid_color_fn['color'] = Color('#000000FF').rgba
- else:
- self.plotcanvas.axes.grid(False)
- try:
- self.plotcanvas.canvas.draw()
- except IndexError:
- pass
- self.toggle_grid_lines = False
- self.inform.emit(_("Grid disabled."))
-
- if self.is_legacy is False:
- # HACK: enabling/disabling the cursor seams to somehow update the shapes on screen
- # - perhaps is a bug in VisPy implementation
- if self.grid_status():
- self.app_cursor.enabled = False
- self.app_cursor.enabled = True
- else:
- self.app_cursor.enabled = True
- self.app_cursor.enabled = False
-
def on_tab_rmb_click(self, checked):
self.ui.notebook.set_detachable(val=checked)
self.defaults["global_tabs_detachable"] = checked
@@ -6860,9 +6780,9 @@ class App(QtCore.QObject):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption=_("Export SVG"),
directory=self.get_last_save_folder() + '/' + str(name) + '_svg',
- filter=_filter)
+ ext_filter=_filter)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export SVG"), filter=_filter)
+ filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export SVG"), ext_filter=_filter)
filename = str(filename)
@@ -6895,9 +6815,9 @@ class App(QtCore.QObject):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption=_("Export PNG Image"),
directory=self.get_last_save_folder() + '/png_' + self.date,
- filter=filter_)
+ ext_filter=filter_)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export PNG Image"), filter=filter_)
+ filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export PNG Image"), ext_filter=filter_)
filename = str(filename)
@@ -6940,9 +6860,9 @@ class App(QtCore.QObject):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption="Save Gerber source file",
directory=self.get_last_save_folder() + '/' + name,
- filter=_filter)
+ ext_filter=_filter)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Save Gerber source file"), filter=_filter)
+ filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Save Gerber source file"), ext_filter=_filter)
filename = str(filename)
@@ -6981,9 +6901,9 @@ class App(QtCore.QObject):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption="Save Script source file",
directory=self.get_last_save_folder() + '/' + name,
- filter=_filter)
+ ext_filter=_filter)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Save Script source file"), filter=_filter)
+ filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Save Script source file"), ext_filter=_filter)
filename = str(filename)
@@ -7022,9 +6942,9 @@ class App(QtCore.QObject):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption="Save Document source file",
directory=self.get_last_save_folder() + '/' + name,
- filter=_filter)
+ ext_filter=_filter)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Save Document source file"), filter=_filter)
+ filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Save Document source file"), ext_filter=_filter)
filename = str(filename)
@@ -7063,9 +6983,10 @@ class App(QtCore.QObject):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption=_("Save Excellon source file"),
directory=self.get_last_save_folder() + '/' + name,
- filter=_filter)
+ ext_filter=_filter)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Save Excellon source file"), filter=_filter)
+ filename, _f = FCFileSaveDialog.get_saved_filename(
+ caption=_("Save Excellon source file"), ext_filter=_filter)
filename = str(filename)
@@ -7104,9 +7025,9 @@ class App(QtCore.QObject):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption=_("Export Excellon"),
directory=self.get_last_save_folder() + '/' + name,
- filter=_filter)
+ ext_filter=_filter)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export Excellon"), filter=_filter)
+ filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export Excellon"), ext_filter=_filter)
filename = str(filename)
@@ -7148,9 +7069,9 @@ class App(QtCore.QObject):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption=_("Export Gerber"),
directory=self.get_last_save_folder() + '/' + name,
- filter=_filter_)
+ ext_filter=_filter_)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export Gerber"), filter=_filter_)
+ filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export Gerber"), ext_filter=_filter_)
filename = str(filename)
@@ -7208,9 +7129,9 @@ class App(QtCore.QObject):
filename, _f = FCFileSaveDialog.get_saved_filename(
caption=_("Export DXF"),
directory=self.get_last_save_folder() + '/' + name,
- filter=_filter_)
+ ext_filter=_filter_)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export DXF"), filter=_filter_)
+ filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Export DXF"), ext_filter=_filter_)
filename = str(filename)
@@ -7660,10 +7581,10 @@ class App(QtCore.QObject):
caption=_("Save Project As ..."),
directory='{l_save}/{proj}_{date}'.format(l_save=str(self.get_last_save_folder()), date=self.date,
proj=_("Project")),
- filter=filter_
+ ext_filter=filter_
)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Save Project As ..."), filter=filter_)
+ filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Save Project As ..."), ext_filter=filter_)
filename = str(filename)
@@ -7715,10 +7636,10 @@ class App(QtCore.QObject):
directory='{l_save}/{obj_name}_{date}'.format(l_save=str(self.get_last_save_folder()),
obj_name=obj_name,
date=self.date),
- filter=filter_
+ ext_filter=filter_
)
except TypeError:
- filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Save Object as PDF ..."), filter=filter_)
+ filename, _f = FCFileSaveDialog.get_saved_filename(caption=_("Save Object as PDF ..."), ext_filter=filter_)
filename = str(filename)
diff --git a/Bookmark.py b/Bookmark.py
index 615d4e00..ebdb2404 100644
--- a/Bookmark.py
+++ b/Bookmark.py
@@ -292,7 +292,7 @@ class BookmarkManager(QtWidgets.QWidget):
l_save=str(self.app.get_last_save_folder()),
n=_("Bookmarks"),
date=date),
- filter=filter__)
+ ext_filter=filter__)
filename = str(filename)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index af7af21a..10ea1ac0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,10 @@ CHANGELOG for FlatCAM beta
- clicking on the activity icon will replot all objects
- optimized UI in Tool Isolation
- overloaded the App inform signal to allow not printing to shell if a second bool parameter is given; modified some GUI messages to use this feature
+- fixed the shell status label status on shell dock close from close button
+- refactored some methods from App class and moved them to plotcanvas (plotcanvaslegacy) class
+- added an label with icon in the status bar, clicking it will toggle (show status) of the X-Y axis on cavnas
+- optimized the UI, added to status bar an icon to toggle the axis
28.05.2020
diff --git a/assets/resources/axis16.png b/assets/resources/axis16.png
new file mode 100644
index 00000000..56aef433
Binary files /dev/null and b/assets/resources/axis16.png differ