diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 18c790a1..44e134d2 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -266,6 +266,7 @@ class App(QtCore.QObject): QtCore.QObject.__init__(self) self.ui = FlatCAMGUI(self.version, self.beta, self) + # self.connect(self.ui, # QtCore.SIGNAL("geomUpdate(int, int, int, int, int)"), # self.save_geometry) PyQt4 @@ -1230,6 +1231,7 @@ class App(QtCore.QObject): self.init_tcl() self.ui.shell_dock = QtWidgets.QDockWidget("FlatCAM TCL Shell") + self.ui.shell_dock.setObjectName('Shell_DockWidget') self.ui.shell_dock.setWidget(self.shell) self.ui.shell_dock.setAllowedAreas(QtCore.Qt.AllDockWidgetAreas) self.ui.shell_dock.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | diff --git a/FlatCAMGUI.py b/FlatCAMGUI.py index 7115eee7..98a53e3c 100644 --- a/FlatCAMGUI.py +++ b/FlatCAMGUI.py @@ -385,7 +385,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow): ### Toolbar ### ############### self.toolbarfile = QtWidgets.QToolBar('File Toolbar') + self.toolbarfile.setObjectName('File_TB') self.addToolBar(self.toolbarfile) + self.file_open_gerber_btn = self.toolbarfile.addAction(QtGui.QIcon('share/flatcam_icon32.png'), "Open GERBER") self.file_open_excellon_btn = self.toolbarfile.addAction(QtGui.QIcon('share/drill32.png'), "Open EXCELLON") @@ -394,6 +396,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.file_save_btn = self.toolbarfile.addAction(QtGui.QIcon('share/floppy32.png'), "Save project") self.toolbargeo = QtWidgets.QToolBar('Edit Toolbar') + self.toolbargeo.setObjectName('Edit_TB') self.addToolBar(self.toolbargeo) self.newgeo_btn = self.toolbargeo.addAction(QtGui.QIcon('share/new_geo32_bis.png'), "New Blank Geometry") @@ -408,7 +411,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.delete_btn = self.toolbargeo.addAction(QtGui.QIcon('share/cancel_edit32.png'), "&Delete") self.toolbarview = QtWidgets.QToolBar('View Toolbar') + self.toolbarview.setObjectName('View_TB') self.addToolBar(self.toolbarview) + self.replot_btn = self.toolbarview.addAction(QtGui.QIcon('share/replot32.png'), "&Replot") self.clear_plot_btn = self.toolbarview.addAction(QtGui.QIcon('share/clear_plot32.png'), "&Clear plot") self.zoom_in_btn = self.toolbarview.addAction(QtGui.QIcon('share/zoom_in32.png'), "Zoom In") @@ -418,11 +423,14 @@ class FlatCAMGUI(QtWidgets.QMainWindow): # self.toolbarview.setVisible(False) self.toolbartools = QtWidgets.QToolBar('Tools Toolbar') + self.toolbartools.setObjectName('Tools_TB') self.addToolBar(self.toolbartools) + self.shell_btn = self.toolbartools.addAction(QtGui.QIcon('share/shell32.png'), "&Command Line") ### Drill Editor Toolbar ### self.exc_edit_toolbar = QtWidgets.QToolBar('Excellon Editor Toolbar') + self.exc_edit_toolbar.setObjectName('ExcEditor_TB') self.addToolBar(self.exc_edit_toolbar) self.select_drill_btn = self.exc_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), "Select 'Esc'") @@ -444,6 +452,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): ### Geometry Editor Toolbar ### self.geo_edit_toolbar = QtWidgets.QToolBar('Geometry Editor Toolbar') self.geo_edit_toolbar.setVisible(False) + self.geo_edit_toolbar.setObjectName('GeoEditor_TB') self.addToolBar(self.geo_edit_toolbar) self.geo_select_btn = self.geo_edit_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), "Select 'Esc'") @@ -476,6 +485,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow): ### Snap Toolbar ### self.snap_toolbar = QtWidgets.QToolBar('Grid Toolbar') + self.snap_toolbar.setObjectName('Snap_TB') # Snap GRID toolbar is always active to facilitate usage of measurements done on GRID self.addToolBar(self.snap_toolbar) @@ -847,6 +857,15 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.filename = "" self.setAcceptDrops(True) + # restore the Toolbar State from file + try: + with open(self.app.data_path + '\state.config', 'rb') as stream: + self.restoreState(QtCore.QByteArray(stream.read())) + log.debug("FlatCAMGUI.__init__() --> UI state restored.") + except IOError: + log.debug("FlatCAMGUI.__init__() --> UI state not restored. IOError") + pass + def dragEnterEvent(self, event): if event.mimeData().hasUrls: event.accept() @@ -913,6 +932,10 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.final_save.emit() if self.app.should_we_quit is True: + # save toolbar state to file + with open(self.app.data_path + '\state.config', 'wb') as stream: + stream.write(self.saveState().data()) + log.debug("FlatCAMGUI.__init__() --> UI state saved.") QtWidgets.qApp.quit() else: self.app.should_we_quit = True diff --git a/README.md b/README.md index 721541fe..73f8b130 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ CAD program, and create G-Code for Isolation routing. - hidden the snap magnet entry and snap magnet toggle from the main view; they are now active only in Editor Mode - updated the camlib.CNCJob.scale() function so now the GCode is scaled also (quite a HACK :( it will need to be replaced at some point)). Units change work now on the GCODE also. - added the bounds coordinates to the GCODE header +- FlatCAM saves now to a file in self.data_path the toolbar positions and the position of TCL Shell 30.01.2019