Merged in marius_stanciu/flatcam_mpl/Menu_clening_icons_adding (pull request #94)

Menu-Toolbars cleaning / adding icons / adding buttons
This commit is contained in:
Marius Stanciu 2018-05-31 15:41:14 +00:00 committed by jpcgt
commit b7d95feae3
11 changed files with 86 additions and 37 deletions

View File

@ -541,6 +541,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))
@ -571,10 +575,12 @@ class App(QtCore.QObject):
### Tools and Plugins ###
#########################
self.dblsidedtool = DblSidedTool(self)
self.dblsidedtool.install()
self.dblsidedtool.install(icon=QtGui.QIcon('share/doubleside16.png'), separator=True)
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)
@ -603,6 +609,7 @@ class App(QtCore.QObject):
QtGui.QDockWidget.DockWidgetFloatable | QtGui.QDockWidget.DockWidgetClosable)
self.ui.addDockWidget(QtCore.Qt.BottomDockWidgetArea, self.ui.shell_dock)
if self.defaults["shell_at_startup"]:
self.ui.shell_dock.show()
else:

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)
@ -731,18 +740,20 @@ class FlatCAMDraw(QtCore.QObject):
### Application menu ###
self.menu = QtGui.QMenu("Drawing")
self.app.ui.menu.insertMenu(self.app.ui.menutoolaction, self.menu)
# self.select_menuitem = self.menu.addAction(QtGui.QIcon('share/pointer16.png'), "Select 'Esc'")
# self.add_circle_menuitem = self.menu.addAction(QtGui.QIcon('share/circle16.png'), 'Add Circle')
# self.add_arc_menuitem = self.menu.addAction(QtGui.QIcon('share/arc16.png'), 'Add Arc')
# self.add_rectangle_menuitem = self.menu.addAction(QtGui.QIcon('share/rectangle16.png'), 'Add Rectangle')
# self.add_polygon_menuitem = self.menu.addAction(QtGui.QIcon('share/polygon16.png'), 'Add Polygon')
# self.add_path_menuitem = self.menu.addAction(QtGui.QIcon('share/path16.png'), 'Add Path')
# self.select_menuitem = self.menu.addAction(QtGui.QIcon('share:pointer16.png'), "Select 'Esc'")
# self.add_circle_menuitem = self.menu.addAction(QtGui.QIcon('share:circle16.png'), 'Add Circle')
# self.add_arc_menuitem = self.menu.addAction(QtGui.QIcon('share:arc16.png'), 'Add Arc')
# self.add_rectangle_menuitem = self.menu.addAction(QtGui.QIcon('share:rectangle16.png'), 'Add Rectangle')
# self.add_polygon_menuitem = self.menu.addAction(QtGui.QIcon('share:polygon16.png'), 'Add Polygon')
# self.add_path_menuitem = self.menu.addAction(QtGui.QIcon('share:path16.png'), 'Add Path')
self.union_menuitem = self.menu.addAction(QtGui.QIcon('share/union16.png'), 'Polygon Union')
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.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'")
# 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 '-'")
self.buffer_menuitem = self.menu.addAction(QtGui.QIcon('share/buffer16.png'), "Buffer selection 'b'")
self.paint_menuitem = self.menu.addAction(QtGui.QIcon('share/paint16.png'), "Paint selection")

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,14 +83,16 @@ 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')
@ -111,7 +121,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 +135,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 ###
@ -154,7 +181,7 @@ class FlatCAMGUI(QtGui.QMainWindow):
# self.notebook.setMinimumWidth(250)
### Projet ###
### Project ###
project_tab = QtGui.QWidget()
project_tab.setMinimumWidth(250) # Hack
self.project_tab_layout = QtGui.QVBoxLayout(project_tab)

View File

@ -32,8 +32,13 @@ class FlatCAMTool(QtGui.QWidget):
self.menuAction = None
def install(self):
self.menuAction = self.app.ui.menutool.addAction(self.toolName)
def install(self, icon=None, separator=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)
if separator is True:
self.app.ui.menutool.addSeparator()
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, separator=None):
FlatCAMTool.install(self, icon, separator)
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):
"""