Przeglądaj źródła

- in TCL Shell removed the line that setFocus after the item is disabled
(this is pointless)
- added separators between groups of menu items
- added icons for the Drawing -> Paint and for the Drawing - > Buffer
- added ability to add icons for the Tools
- added icons to the current tools (Dblsided Tool, Measurement Tool)
- added buttons in the toolbar for: Open Gerber, Open Excellon,
Open Gcode and Save Project As
- added button in Tools toolbar for Measurement tool
- added separators in the toolbar
- organized the toolbar buttons in multiple toolbars that can be disabled
with right click on the toolbar
- added names for the toolbars where they were not present

Marius Stanciu 7 lat temu
rodzic
commit
e1c8eaafa9

+ 8 - 2
FlatCAMApp.py

@@ -539,6 +539,10 @@ class App(QtCore.QObject):
         self.ui.menuhelp_home.triggered.connect(lambda: webbrowser.open(self.app_url))
         self.ui.menuhelp_home.triggered.connect(lambda: webbrowser.open(self.app_url))
         self.ui.menuhelp_manual.triggered.connect(lambda: webbrowser.open(self.manual_url))
         self.ui.menuhelp_manual.triggered.connect(lambda: webbrowser.open(self.manual_url))
         # Toolbar
         # Toolbar
+        self.ui.open_gerber_btn.triggered.connect(self.on_fileopengerber)
+        self.ui.open_exc_btn.triggered.connect(self.on_fileopenexcellon)
+        self.ui.open_gcode_btn.triggered.connect(self.on_fileopengcode)
+        self.ui.save_btn.triggered.connect(self.on_file_saveprojectas)
         self.ui.zoom_fit_btn.triggered.connect(self.on_zoom_fit)
         self.ui.zoom_fit_btn.triggered.connect(self.on_zoom_fit)
         self.ui.zoom_in_btn.triggered.connect(lambda: self.plotcanvas.zoom(1.5))
         self.ui.zoom_in_btn.triggered.connect(lambda: self.plotcanvas.zoom(1.5))
         self.ui.zoom_out_btn.triggered.connect(lambda: self.plotcanvas.zoom(1 / 1.5))
         self.ui.zoom_out_btn.triggered.connect(lambda: self.plotcanvas.zoom(1 / 1.5))
@@ -569,10 +573,12 @@ class App(QtCore.QObject):
         ### Tools and Plugins ###
         ### Tools and Plugins ###
         #########################
         #########################
         self.dblsidedtool = DblSidedTool(self)
         self.dblsidedtool = DblSidedTool(self)
-        self.dblsidedtool.install()
+        self.dblsidedtool.install(icon=QtGui.QIcon('share:doubleside16.png'))
 
 
         self.measeurement_tool = Measurement(self)
         self.measeurement_tool = Measurement(self)
-        self.measeurement_tool.install()
+        self.measeurement_tool.install(icon=QtGui.QIcon('share:measure16.png'))
+
+        self.ui.measure_btn.triggered.connect(self.measeurement_tool.run)
 
 
         self.draw = FlatCAMDraw(self, disabled=True)
         self.draw = FlatCAMDraw(self, disabled=True)
 
 

+ 13 - 2
FlatCAMDraw.py

@@ -690,25 +690,34 @@ class FlatCAMDraw(QtCore.QObject):
         self.axes = self.canvas.new_axes("draw")
         self.axes = self.canvas.new_axes("draw")
 
 
         ### Drawing Toolbar ###
         ### Drawing Toolbar ###
-        self.drawing_toolbar = QtGui.QToolBar()
+        self.drawing_toolbar = QtGui.QToolBar("Draw Toolbar")
         self.drawing_toolbar.setDisabled(disabled)
         self.drawing_toolbar.setDisabled(disabled)
         self.app.ui.addToolBar(self.drawing_toolbar)
         self.app.ui.addToolBar(self.drawing_toolbar)
+
         self.select_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:pointer32.png'), "Select 'Esc'")
         self.select_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:pointer32.png'), "Select 'Esc'")
+        # Separator
+        self.drawing_toolbar.addSeparator()
         self.add_circle_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:circle32.png'), 'Add Circle')
         self.add_circle_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:circle32.png'), 'Add Circle')
         self.add_arc_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:arc32.png'), 'Add Arc')
         self.add_arc_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:arc32.png'), 'Add Arc')
         self.add_rectangle_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:rectangle32.png'), 'Add Rectangle')
         self.add_rectangle_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:rectangle32.png'), 'Add Rectangle')
         self.add_polygon_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:polygon32.png'), 'Add Polygon')
         self.add_polygon_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:polygon32.png'), 'Add Polygon')
         self.add_path_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:path32.png'), 'Add Path')
         self.add_path_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:path32.png'), 'Add Path')
+
+        # Separator
+        self.drawing_toolbar.addSeparator()
         self.union_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:union32.png'), 'Polygon Union')
         self.union_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:union32.png'), 'Polygon Union')
         self.intersection_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:intersection32.png'), 'Polygon Intersection')
         self.intersection_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:intersection32.png'), 'Polygon Intersection')
         self.subtract_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:subtract32.png'), 'Polygon Subtraction')
         self.subtract_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:subtract32.png'), 'Polygon Subtraction')
         self.cutpath_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:cutpath32.png'), 'Cut Path')
         self.cutpath_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:cutpath32.png'), 'Cut Path')
+
+        # Separator
+        self.drawing_toolbar.addSeparator()
         self.move_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:move32.png'), "Move Objects 'm'")
         self.move_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:move32.png'), "Move Objects 'm'")
         self.copy_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:copy32.png'), "Copy Objects 'c'")
         self.copy_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:copy32.png'), "Copy Objects 'c'")
         self.delete_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:deleteshape32.png'), "Delete Shape '-'")
         self.delete_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:deleteshape32.png'), "Delete Shape '-'")
 
 
         ### Snap Toolbar ###
         ### Snap Toolbar ###
-        self.snap_toolbar = QtGui.QToolBar()
+        self.snap_toolbar = QtGui.QToolBar("Grid Toolbar")
         self.grid_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share:grid32.png'), 'Snap to grid')
         self.grid_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share:grid32.png'), 'Snap to grid')
         self.grid_gap_x_entry = QtGui.QLineEdit()
         self.grid_gap_x_entry = QtGui.QLineEdit()
         self.grid_gap_x_entry.setMaximumWidth(70)
         self.grid_gap_x_entry.setMaximumWidth(70)
@@ -741,6 +750,8 @@ class FlatCAMDraw(QtCore.QObject):
         self.intersection_menuitem = self.menu.addAction(QtGui.QIcon('share:intersection16.png'), 'Polygon Intersection')
         self.intersection_menuitem = self.menu.addAction(QtGui.QIcon('share:intersection16.png'), 'Polygon Intersection')
         # self.subtract_menuitem = self.menu.addAction(QtGui.QIcon('share:subtract16.png'), 'Polygon Subtraction')
         # self.subtract_menuitem = self.menu.addAction(QtGui.QIcon('share:subtract16.png'), 'Polygon Subtraction')
         self.cutpath_menuitem = self.menu.addAction(QtGui.QIcon('share:cutpath16.png'), 'Cut Path')
         self.cutpath_menuitem = self.menu.addAction(QtGui.QIcon('share:cutpath16.png'), 'Cut Path')
+        # Add Separator
+        self.menu.addSeparator()
         # self.move_menuitem = self.menu.addAction(QtGui.QIcon('share:move16.png'), "Move Objects 'm'")
         # self.move_menuitem = self.menu.addAction(QtGui.QIcon('share:move16.png'), "Move Objects 'm'")
         # self.copy_menuitem = self.menu.addAction(QtGui.QIcon('share:copy16.png'), "Copy Objects 'c'")
         # self.copy_menuitem = self.menu.addAction(QtGui.QIcon('share:copy16.png'), "Copy Objects 'c'")
         self.delete_menuitem = self.menu.addAction(QtGui.QIcon('share:deleteshape16.png'), "Delete Shape '-'")
         self.delete_menuitem = self.menu.addAction(QtGui.QIcon('share:deleteshape16.png'), "Delete Shape '-'")

+ 50 - 20
FlatCAMGUI.py

@@ -28,13 +28,15 @@ class FlatCAMGUI(QtGui.QMainWindow):
         self.menufile = self.menu.addMenu('&File')
         self.menufile = self.menu.addMenu('&File')
 
 
         # New
         # New
-        self.menufilenew = QtGui.QAction(QtGui.QIcon('share:file16.png'), '&New', self)
+        self.menufilenew = QtGui.QAction(QtGui.QIcon('share:file16.png'), '&New project', self)
         self.menufile.addAction(self.menufilenew)
         self.menufile.addAction(self.menufilenew)
-        # Open recent
 
 
         # Recent
         # Recent
         self.recent = self.menufile.addMenu(QtGui.QIcon('share:folder16.png'), "Open recent ...")
         self.recent = self.menufile.addMenu(QtGui.QIcon('share:folder16.png'), "Open recent ...")
 
 
+        # Separator
+        self.menufile.addSeparator()
+
         # Open gerber ...
         # Open gerber ...
         self.menufileopengerber = QtGui.QAction(QtGui.QIcon('share:folder16.png'), 'Open &Gerber ...', self)
         self.menufileopengerber = QtGui.QAction(QtGui.QIcon('share:folder16.png'), 'Open &Gerber ...', self)
         self.menufile.addAction(self.menufileopengerber)
         self.menufile.addAction(self.menufileopengerber)
@@ -51,6 +53,9 @@ class FlatCAMGUI(QtGui.QMainWindow):
         self.menufileopenproject = QtGui.QAction(QtGui.QIcon('share:folder16.png'), 'Open &Project ...', self)
         self.menufileopenproject = QtGui.QAction(QtGui.QIcon('share:folder16.png'), 'Open &Project ...', self)
         self.menufile.addAction(self.menufileopenproject)
         self.menufile.addAction(self.menufileopenproject)
 
 
+        # Separator
+        self.menufile.addSeparator()
+
         # Import SVG ...
         # Import SVG ...
         self.menufileimportsvg = QtGui.QAction(QtGui.QIcon('share:folder16.png'), 'Import &SVG ...', self)
         self.menufileimportsvg = QtGui.QAction(QtGui.QIcon('share:folder16.png'), 'Import &SVG ...', self)
         self.menufile.addAction(self.menufileimportsvg)
         self.menufile.addAction(self.menufileimportsvg)
@@ -59,6 +64,9 @@ class FlatCAMGUI(QtGui.QMainWindow):
         self.menufileexportsvg = QtGui.QAction(QtGui.QIcon('share:folder16.png'), 'Export &SVG ...', self)
         self.menufileexportsvg = QtGui.QAction(QtGui.QIcon('share:folder16.png'), 'Export &SVG ...', self)
         self.menufile.addAction(self.menufileexportsvg)
         self.menufile.addAction(self.menufileexportsvg)
 
 
+        # Separator
+        self.menufile.addSeparator()
+
         # Save Project
         # Save Project
         self.menufilesaveproject = QtGui.QAction(QtGui.QIcon('share:floppy16.png'), '&Save Project', self)
         self.menufilesaveproject = QtGui.QAction(QtGui.QIcon('share:floppy16.png'), '&Save Project', self)
         self.menufile.addAction(self.menufilesaveproject)
         self.menufile.addAction(self.menufilesaveproject)
@@ -75,21 +83,26 @@ class FlatCAMGUI(QtGui.QMainWindow):
         self.menufilesavedefaults = QtGui.QAction(QtGui.QIcon('share:floppy16.png'), 'Save &Defaults', self)
         self.menufilesavedefaults = QtGui.QAction(QtGui.QIcon('share:floppy16.png'), 'Save &Defaults', self)
         self.menufile.addAction(self.menufilesavedefaults)
         self.menufile.addAction(self.menufilesavedefaults)
 
 
+        # Separator
+        self.menufile.addSeparator()
+
         # Quit
         # Quit
         self.exit_action = QtGui.QAction(QtGui.QIcon('share:power16.png'), '&Exit', self)
         self.exit_action = QtGui.QAction(QtGui.QIcon('share:power16.png'), '&Exit', self)
+        self.menufile.addAction(self.exit_action)
         # exitAction.setShortcut('Ctrl+Q')
         # exitAction.setShortcut('Ctrl+Q')
         # exitAction.setStatusTip('Exit application')
         # exitAction.setStatusTip('Exit application')
         #self.exit_action.triggered.connect(QtGui.qApp.quit)
         #self.exit_action.triggered.connect(QtGui.qApp.quit)
 
 
-        self.menufile.addAction(self.exit_action)
 
 
         ### Edit ###
         ### Edit ###
         self.menuedit = self.menu.addMenu('&Edit')
         self.menuedit = self.menu.addMenu('&Edit')
         self.menueditnew = self.menuedit.addAction(QtGui.QIcon('share:new_geo16.png'), 'New Geometry')
         self.menueditnew = self.menuedit.addAction(QtGui.QIcon('share:new_geo16.png'), 'New Geometry')
         self.menueditedit = self.menuedit.addAction(QtGui.QIcon('share:edit16.png'), 'Edit Geometry')
         self.menueditedit = self.menuedit.addAction(QtGui.QIcon('share:edit16.png'), 'Edit Geometry')
         self.menueditok = self.menuedit.addAction(QtGui.QIcon('share:edit_ok16.png'), 'Update Geometry')
         self.menueditok = self.menuedit.addAction(QtGui.QIcon('share:edit_ok16.png'), 'Update Geometry')
-        #self.menueditok.
-        #self.menueditcancel = self.menuedit.addAction(QtGui.QIcon('share:cancel_edit16.png'), "Cancel Edit")
+
+        # Separator
+        self.menuedit.addSeparator()
+
         self.menueditjoin = self.menuedit.addAction(QtGui.QIcon('share:join16.png'), 'Join Geometry')
         self.menueditjoin = self.menuedit.addAction(QtGui.QIcon('share:join16.png'), 'Join Geometry')
         self.menueditdelete = self.menuedit.addAction(QtGui.QIcon('share:trash16.png'), 'Delete')
         self.menueditdelete = self.menuedit.addAction(QtGui.QIcon('share:trash16.png'), 'Delete')
 
 
@@ -111,7 +124,7 @@ class FlatCAMGUI(QtGui.QMainWindow):
         self.menuviewenable = self.menuview.addAction(QtGui.QIcon('share:replot16.png'), 'Enable all plots')
         self.menuviewenable = self.menuview.addAction(QtGui.QIcon('share:replot16.png'), 'Enable all plots')
 
 
         ### Tool ###
         ### Tool ###
-        #self.menutool = self.menu.addMenu('&Tool')
+
         self.menutool = QtGui.QMenu('&Tool')
         self.menutool = QtGui.QMenu('&Tool')
         self.menutoolaction = self.menu.addMenu(self.menutool)
         self.menutoolaction = self.menu.addMenu(self.menutool)
         self.menutoolshell = self.menutool.addAction(QtGui.QIcon('share:shell16.png'), '&Command Line')
         self.menutoolshell = self.menutool.addAction(QtGui.QIcon('share:shell16.png'), '&Command Line')
@@ -125,21 +138,38 @@ class FlatCAMGUI(QtGui.QMainWindow):
         ###############
         ###############
         ### Toolbar ###
         ### Toolbar ###
         ###############
         ###############
-        self.toolbar = QtGui.QToolBar()
-        self.addToolBar(self.toolbar)
-
-        self.zoom_fit_btn = self.toolbar.addAction(QtGui.QIcon('share:zoom_fit32.png'), "&Zoom Fit")
-        self.zoom_out_btn = self.toolbar.addAction(QtGui.QIcon('share:zoom_out32.png'), "&Zoom Out")
-        self.zoom_in_btn = self.toolbar.addAction(QtGui.QIcon('share:zoom_in32.png'), "&Zoom In")
-        self.clear_plot_btn = self.toolbar.addAction(QtGui.QIcon('share:clear_plot32.png'), "&Clear Plot")
-        self.replot_btn = self.toolbar.addAction(QtGui.QIcon('share:replot32.png'), "&Replot")
-        self.newgeo_btn = self.toolbar.addAction(QtGui.QIcon('share:new_geo32.png'), "New Blank Geometry")
-        self.editgeo_btn = self.toolbar.addAction(QtGui.QIcon('share:edit32.png'), "Edit Geometry")
-        self.updategeo_btn = self.toolbar.addAction(QtGui.QIcon('share:edit_ok32.png'), "Update Geometry")
+        self.toolbarfile = QtGui.QToolBar('File Toolbar')
+        self.addToolBar(self.toolbarfile)
+        self.open_gerber_btn = self.toolbarfile.addAction(QtGui.QIcon('share:flatcam_icon32.png'), "Open &Gerber")
+        self.open_exc_btn = self.toolbarfile.addAction(QtGui.QIcon('share:drill32.png'), "Open &Excellon")
+        self.open_gcode_btn = self.toolbarfile.addAction(QtGui.QIcon('share:cnc32.png'), "Open Gco&de")
+        self.save_btn = self.toolbarfile.addAction(QtGui.QIcon('share:floppy32.png'), 'Save Project &As ...')
+
+        self.toolbarview= QtGui.QToolBar('View Toolbar')
+        self.addToolBar(self.toolbarview)
+        self.zoom_fit_btn = self.toolbarview.addAction(QtGui.QIcon('share:zoom_fit32.png'), "&Zoom Fit")
+        self.zoom_out_btn = self.toolbarview.addAction(QtGui.QIcon('share:zoom_out32.png'), "&Zoom Out")
+        self.zoom_in_btn = self.toolbarview.addAction(QtGui.QIcon('share:zoom_in32.png'), "&Zoom In")
+        # Separator
+        self.toolbarview.addSeparator()
+        self.clear_plot_btn = self.toolbarview.addAction(QtGui.QIcon('share:clear_plot32.png'), "&Clear Plot")
+        self.replot_btn = self.toolbarview.addAction(QtGui.QIcon('share:replot32.png'), "&Replot")
+
+        self.toolbareditobj = QtGui.QToolBar('Obj.Editor Toolbar')
+        self.addToolBar(self.toolbareditobj)
+        self.newgeo_btn = self.toolbareditobj.addAction(QtGui.QIcon('share:new_geo32.png'), "New Blank Geometry")
+        self.editgeo_btn = self.toolbareditobj.addAction(QtGui.QIcon('share:edit32.png'), "Edit Geometry")
+        self.updategeo_btn = self.toolbareditobj.addAction(QtGui.QIcon('share:edit_ok32.png'), "Update Geometry")
         self.updategeo_btn.setEnabled(False)
         self.updategeo_btn.setEnabled(False)
-        #self.canceledit_btn = self.toolbar.addAction(QtGui.QIcon('share:cancel_edit32.png'), "Cancel Edit")
-        self.delete_btn = self.toolbar.addAction(QtGui.QIcon('share:delete32.png'), "&Delete")
-        self.shell_btn = self.toolbar.addAction(QtGui.QIcon('share:shell32.png'), "&Command Line")
+
+        self.toolbaredit = QtGui.QToolBar('Edit Toolbar')
+        self.addToolBar(self.toolbaredit)
+        self.delete_btn = self.toolbaredit.addAction(QtGui.QIcon('share:delete32.png'), "&Delete")
+
+        self.toolbartools = QtGui.QToolBar('Tools Toolbar')
+        self.addToolBar(self.toolbartools)
+        self.shell_btn = self.toolbartools.addAction(QtGui.QIcon('share:shell32.png'), "&Command Line")
+        self.measure_btn = self.toolbartools.addAction(QtGui.QIcon('share:measure32.png'), "&Measurement Tool")
 
 
         ################
         ################
         ### Splitter ###
         ### Splitter ###

+ 5 - 2
FlatCAMTool.py

@@ -32,8 +32,11 @@ class FlatCAMTool(QtGui.QWidget):
 
 
         self.menuAction = None
         self.menuAction = None
 
 
-    def install(self):
-        self.menuAction = self.app.ui.menutool.addAction(self.toolName)
+    def install(self, icon=None):
+        if icon is None:
+            self.menuAction = self.app.ui.menutool.addAction(self.toolName)
+        else:
+            self.menuAction = self.app.ui.menutool.addAction(icon, self.toolName)
         self.menuAction.triggered.connect(self.run)
         self.menuAction.triggered.connect(self.run)
 
 
     def run(self):
     def run(self):

+ 2 - 2
MeasurementTool.py

@@ -29,8 +29,8 @@ class Measurement(FlatCAMTool):
         self.click_subscription = None
         self.click_subscription = None
         self.move_subscription = None
         self.move_subscription = None
 
 
-    def install(self):
-        FlatCAMTool.install(self)
+    def install(self, icon=None):
+        FlatCAMTool.install(self, icon)
         self.app.ui.right_layout.addWidget(self)
         self.app.ui.right_layout.addWidget(self)
         self.app.plotcanvas.mpl_connect('key_press_event', self.on_key_press)
         self.app.plotcanvas.mpl_connect('key_press_event', self.on_key_press)
 
 

BIN
share/buffer16.png


BIN
share/doubleside16.png


BIN
share/doubleside32.png


BIN
share/floppy32.png


BIN
share/paint16.png


+ 0 - 1
termwidget.py

@@ -132,7 +132,6 @@ class TermWidget(QWidget):
             self._edit.setPlainText("...proccessing... [%s]" % detail)
             self._edit.setPlainText("...proccessing... [%s]" % detail)
 
 
         self._edit.setDisabled(True)
         self._edit.setDisabled(True)
-        self._edit.setFocus()
 
 
     def close_proccessing(self):
     def close_proccessing(self):
         """
         """