- 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
This commit is contained in:
Marius Stanciu 2018-05-29 16:48:06 +03:00
parent b85c490256
commit e1c8eaafa9
11 changed files with 77 additions and 28 deletions

View File

@ -539,6 +539,10 @@ class App(QtCore.QObject):
self.ui.menuhelp_home.triggered.connect(lambda: webbrowser.open(self.app_url))
self.ui.menuhelp_manual.triggered.connect(lambda: webbrowser.open(self.manual_url))
# 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_in_btn.triggered.connect(lambda: self.plotcanvas.zoom(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 ###
#########################
self.dblsidedtool = DblSidedTool(self)
self.dblsidedtool.install()
self.dblsidedtool.install(icon=QtGui.QIcon('share:doubleside16.png'))
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)

View File

@ -690,25 +690,34 @@ class FlatCAMDraw(QtCore.QObject):
self.axes = self.canvas.new_axes("draw")
### Drawing Toolbar ###
self.drawing_toolbar = QtGui.QToolBar()
self.drawing_toolbar = QtGui.QToolBar("Draw Toolbar")
self.drawing_toolbar.setDisabled(disabled)
self.app.ui.addToolBar(self.drawing_toolbar)
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_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_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')
# Separator
self.drawing_toolbar.addSeparator()
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.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')
# Separator
self.drawing_toolbar.addSeparator()
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.delete_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share:deleteshape32.png'), "Delete Shape '-'")
### 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_gap_x_entry = QtGui.QLineEdit()
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.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')
# Add Separator
self.menu.addSeparator()
# 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.delete_menuitem = self.menu.addAction(QtGui.QIcon('share:deleteshape16.png'), "Delete Shape '-'")

View File

@ -28,13 +28,15 @@ class FlatCAMGUI(QtGui.QMainWindow):
self.menufile = self.menu.addMenu('&File')
# 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)
# Open recent
# Recent
self.recent = self.menufile.addMenu(QtGui.QIcon('share:folder16.png'), "Open recent ...")
# Separator
self.menufile.addSeparator()
# Open gerber ...
self.menufileopengerber = QtGui.QAction(QtGui.QIcon('share:folder16.png'), 'Open &Gerber ...', self)
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.menufile.addAction(self.menufileopenproject)
# Separator
self.menufile.addSeparator()
# Import SVG ...
self.menufileimportsvg = QtGui.QAction(QtGui.QIcon('share:folder16.png'), 'Import &SVG ...', self)
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.menufile.addAction(self.menufileexportsvg)
# Separator
self.menufile.addSeparator()
# Save Project
self.menufilesaveproject = QtGui.QAction(QtGui.QIcon('share:floppy16.png'), '&Save Project', self)
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.menufile.addAction(self.menufilesavedefaults)
# Separator
self.menufile.addSeparator()
# Quit
self.exit_action = QtGui.QAction(QtGui.QIcon('share:power16.png'), '&Exit', self)
self.menufile.addAction(self.exit_action)
# exitAction.setShortcut('Ctrl+Q')
# exitAction.setStatusTip('Exit application')
#self.exit_action.triggered.connect(QtGui.qApp.quit)
self.menufile.addAction(self.exit_action)
### Edit ###
self.menuedit = self.menu.addMenu('&Edit')
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.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.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')
### Tool ###
#self.menutool = self.menu.addMenu('&Tool')
self.menutool = QtGui.QMenu('&Tool')
self.menutoolaction = self.menu.addMenu(self.menutool)
self.menutoolshell = self.menutool.addAction(QtGui.QIcon('share:shell16.png'), '&Command Line')
@ -125,21 +138,38 @@ class FlatCAMGUI(QtGui.QMainWindow):
###############
### Toolbar ###
###############
self.toolbar = QtGui.QToolBar()
self.addToolBar(self.toolbar)
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.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.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.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 ###

View File

@ -32,8 +32,11 @@ class FlatCAMTool(QtGui.QWidget):
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)
def run(self):

View File

@ -29,8 +29,8 @@ class Measurement(FlatCAMTool):
self.click_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.plotcanvas.mpl_connect('key_press_event', self.on_key_press)

BIN
share/buffer16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

BIN
share/doubleside16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

BIN
share/doubleside32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

BIN
share/floppy32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

BIN
share/paint16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

View File

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