- remade the App Menu for Editors: now they will be showed only when the respective Editor is active and hidden when the Editor is closed.

This commit is contained in:
Marius Stanciu 2019-01-30 17:27:11 +02:00 committed by Marius
parent 366bfbd0f5
commit dbee97ccb9
4 changed files with 69 additions and 18 deletions

View File

@ -1069,10 +1069,12 @@ class App(QtCore.QObject):
self.ui.gridmenu_3.triggered.connect(lambda: self.ui.grid_gap_x_entry.setText("0.2"))
self.ui.gridmenu_4.triggered.connect(lambda: self.ui.grid_gap_x_entry.setText("0.5"))
self.ui.gridmenu_5.triggered.connect(lambda: self.ui.grid_gap_x_entry.setText("1.0"))
self.ui.draw_line.triggered.connect(self.geo_editor.draw_tool_path)
self.ui.draw_rect.triggered.connect(self.geo_editor.draw_tool_rectangle)
self.ui.draw_cut.triggered.connect(self.geo_editor.cutpath)
self.ui.draw_move.triggered.connect(self.geo_editor.on_move)
self.ui.drill.triggered.connect(self.exc_editor.exc_add_drill)
self.ui.drill_array.triggered.connect(self.exc_editor.exc_add_drill_array)
self.ui.drill_copy.triggered.connect(self.exc_editor.exc_copy_drills)

View File

@ -2052,6 +2052,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
self.app.ui.corner_snap_btn.setEnabled(True)
self.app.ui.geo_editor_menu.setDisabled(False)
self.app.ui.geo_editor_menu.menuAction().setVisible(True)
# Tell the App that the editor is active
self.editor_active = True
@ -2071,6 +2072,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
self.app.app_cursor.enabled = False
self.app.ui.geo_editor_menu.setDisabled(True)
self.app.ui.geo_editor_menu.menuAction().setVisible(False)
# Tell the app that the editor is no longer active
self.editor_active = False
@ -3704,6 +3706,17 @@ class FlatCAMExcEditor(QtCore.QObject):
self.drill_axis_radio.activated_custom.connect(self.on_linear_angle_radio)
self.app.ui.exc_add_array_drill_menuitem.triggered.connect(self.exc_add_drill_array)
self.app.ui.exc_add_drill_menuitem.triggered.connect(self.exc_add_drill)
self.app.ui.exc_resize_drill_menuitem.triggered.connect(self.exc_resize_drills)
self.app.ui.exc_copy_drill_menuitem.triggered.connect(self.exc_copy_drills)
self.app.ui.exc_delete_drill_menuitem.triggered.connect(self.on_delete_btn)
self.app.ui.exc_move_drill_menuitem.triggered.connect(self.exc_move_drills)
# Init GUI
self.drill_array_size_entry.set_value(5)
self.drill_pitch_entry.set_value(2.54)
self.drill_angle_entry.set_value(12)
@ -4174,6 +4187,10 @@ class FlatCAMExcEditor(QtCore.QObject):
# self.app.app_cursor.enabled = True
self.app.ui.snap_max_dist_entry.setDisabled(False)
self.app.ui.corner_snap_btn.setEnabled(True)
self.app.ui.exc_editor_menu.setDisabled(False)
self.app.ui.exc_editor_menu.menuAction().setVisible(True)
# Tell the App that the editor is active
self.editor_active = True
@ -4193,6 +4210,9 @@ class FlatCAMExcEditor(QtCore.QObject):
# Tell the app that the editor is no longer active
self.editor_active = False
self.app.ui.exc_editor_menu.setDisabled(True)
self.app.ui.exc_editor_menu.menuAction().setVisible(False)
# Show original geometry
if self.exc_obj:
self.exc_obj.visible = True
@ -5197,10 +5217,18 @@ class FlatCAMExcEditor(QtCore.QObject):
self.select_tool('add_array')
return
def exc_resize_drills(self):
self.select_tool('resize')
return
def exc_copy_drills(self):
self.select_tool('copy')
return
def exc_move_drills(self):
self.select_tool('move')
return
def distance(pt1, pt2):
return sqrt((pt1[0] - pt2[0]) ** 2 + (pt1[1] - pt2[1]) ** 2)

View File

@ -271,11 +271,26 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.menuview_toggle_workspace = self.menuview.addAction(QtGui.QIcon('share/workspace24.png'),
"Toggle Workspace\tSHIFT+W")
### Tool ###
# self.menutool = self.menu.addMenu('&Tool')
self.menutool = QtWidgets.QMenu('&Tool')
self.menutoolaction = self.menu.addMenu(self.menutool)
self.menutoolshell = self.menutool.addAction(QtGui.QIcon('share/shell16.png'), '&Command Line\tS')
### Help ###
self.menuhelp = self.menu.addMenu('&Help')
self.menuhelp_about = self.menuhelp.addAction(QtGui.QIcon('share/tv16.png'), 'About FlatCAM')
self.menuhelp_home = self.menuhelp.addAction(QtGui.QIcon('share/home16.png'), 'Home')
self.menuhelp_manual = self.menuhelp.addAction(QtGui.QIcon('share/globe16.png'), 'Manual\tF1')
self.menuhelp.addSeparator()
self.menuhelp_shortcut_list = self.menuhelp.addAction(QtGui.QIcon('share/shortcuts24.png'), 'Shortcuts List\t`')
self.menuhelp_videohelp = self.menuhelp.addAction(QtGui.QIcon('share/videohelp24.png'), 'See on YouTube\tF2')
### FlatCAM Editor menu ###
# self.editor_menu = QtWidgets.QMenu("Editor")
# self.menu.addMenu(self.editor_menu)
self.geo_editor_menu = QtWidgets.QMenu("Geo Editor")
self.geo_editor_menu = QtWidgets.QMenu(">Geo Editor<")
self.menu.addMenu(self.geo_editor_menu)
# self.select_menuitem = self.menu.addAction(QtGui.QIcon('share/pointer16.png'), "Select 'Esc'")
@ -320,26 +335,31 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
QtGui.QIcon('share/corner32.png'), "Toggle Corner Snap\tK"
)
# self.exc_editor_menu = QtWidgets.QMenu("Excellon Editor")
# self.menu.addMenu(self.exc_editor_menu)
self.exc_editor_menu = QtWidgets.QMenu(">Excellon Editor<")
self.menu.addMenu(self.exc_editor_menu)
self.exc_add_array_drill_menuitem = self.exc_editor_menu.addAction(
QtGui.QIcon('share/rectangle32.png'), 'Add Drill Array\tA')
self.exc_add_drill_menuitem = self.exc_editor_menu.addAction(QtGui.QIcon('share/plus16.png'), 'Add Drill\tD')
self.exc_editor_menu.addSeparator()
self.exc_resize_drill_menuitem = self.exc_editor_menu.addAction(
QtGui.QIcon('share/resize16.png'), 'Resize Drill(S)\tR'
)
self.exc_copy_drill_menuitem = self.exc_editor_menu.addAction(QtGui.QIcon('share/copy32.png'), 'Copy\tC')
self.exc_delete_drill_menuitem = self.exc_editor_menu.addAction(
QtGui.QIcon('share/deleteshape32.png'), 'Delete\tDEL'
)
self.exc_editor_menu.addSeparator()
self.exc_move_drill_menuitem = self.exc_editor_menu.addAction(
QtGui.QIcon('share/move32.png'), 'Move Drill(s)\tM')
self.geo_editor_menu.menuAction().setVisible(False)
self.geo_editor_menu.setDisabled(True)
# self.exc_editor_menu.setDisabled(True)
### Tool ###
# self.menutool = self.menu.addMenu('&Tool')
self.menutool = QtWidgets.QMenu('&Tool')
self.menutoolaction = self.menu.addMenu(self.menutool)
self.menutoolshell = self.menutool.addAction(QtGui.QIcon('share/shell16.png'), '&Command Line\tS')
### Help ###
self.menuhelp = self.menu.addMenu('&Help')
self.menuhelp_about = self.menuhelp.addAction(QtGui.QIcon('share/tv16.png'), 'About FlatCAM')
self.menuhelp_home = self.menuhelp.addAction(QtGui.QIcon('share/home16.png'), 'Home')
self.menuhelp_manual = self.menuhelp.addAction(QtGui.QIcon('share/globe16.png'), 'Manual\tF1')
self.menuhelp.addSeparator()
self.menuhelp_shortcut_list = self.menuhelp.addAction(QtGui.QIcon('share/shortcuts24.png'), 'Shortcuts List\t`')
self.menuhelp_videohelp = self.menuhelp.addAction(QtGui.QIcon('share/videohelp24.png'), 'See on YouTube\tF2')
self.exc_editor_menu.menuAction().setVisible(False)
self.exc_editor_menu.setDisabled(True)
################################
### Project Tab Context menu ###

View File

@ -13,6 +13,7 @@ CAD program, and create G-Code for Isolation routing.
- added a space before Y coordinate in end_code() function in some of the postprocessor files
- added in Calculators Tool an Electroplating Calculator.
- remade the App Menu for Editors: now they will be showed only when the respective Editor is active and hidden when the Editor is closed.
29.01.2019