diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 5564f600..45962d4f 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -494,9 +494,9 @@ class App(QtCore.QObject): "global_shell_shape": [500, 300], # Shape of the shell in pixels. "global_shell_at_startup": False, # Show the shell at startup. "global_recent_limit": 10, # Max. items in recent list. - "fit_key": '1', - "zoom_out_key": '2', - "zoom_in_key": '3', + "fit_key": 'V', + "zoom_out_key": '-', + "zoom_in_key": '=', "grid_toggle_key": 'G', "zoom_ratio": 1.5, "global_point_clipboard_format": "(%.4f, %.4f)", @@ -3914,8 +3914,6 @@ class App(QtCore.QObject): if index.internalPointer().parent_item != self.collection.root_item: self.ui.notebook.setCurrentWidget(self.ui.selected_tab) - - def grid_status(self): if self.ui.grid_snap_btn.isChecked(): return 1 @@ -4054,15 +4052,11 @@ class App(QtCore.QObject): webbrowser.open(self.video_url) return - if event.key == self.defaults['fit_key']: # 1 - self.on_zoom_fit(None) - return - - if event.key == self.defaults['zoom_out_key']: # 2 + if event.key == self.defaults['zoom_out_key']: # '-' self.plotcanvas.zoom(1 / self.defaults['zoom_ratio'], self.mouse) return - if event.key == self.defaults['zoom_in_key']: # 3 + if event.key == self.defaults['zoom_in_key']: # '=' self.plotcanvas.zoom(self.defaults['zoom_ratio'], self.mouse) return @@ -4075,6 +4069,15 @@ class App(QtCore.QObject): self.collection.get_active().ui.plot_cb.toggle() self.delete_selection_shape() + if event.key == '1': + self.on_select_tab('project') + + if event.key == '2': + self.on_select_tab('selected') + + if event.key == '3': + self.on_select_tab('tool') + if event.key == 'E': self.object2editor() @@ -4149,6 +4152,14 @@ class App(QtCore.QObject): self.ui.plot_tab_area.setCurrentWidget(self.ui.shortcuts_tab) self.ui.show() + def on_select_tab(self, name): + if name == 'project': + self.ui.notebook.setCurrentWidget(self.ui.project_tab) + elif name == 'selected': + self.ui.notebook.setCurrentWidget(self.ui.selected_tab) + elif name == 'tool': + self.ui.notebook.setCurrentWidget(self.ui.tool_tab) + def on_copy_name(self): self.report_usage("on_copy_name()") diff --git a/FlatCAMGUI.py b/FlatCAMGUI.py index d9540230..9d09186c 100644 --- a/FlatCAMGUI.py +++ b/FlatCAMGUI.py @@ -756,9 +756,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
~: Show Shortcut List

-1: Zoom Fit
-2: Zoom Out
-3: Zoom In
+1: Switch to Project Tab
+2: Switch to Selected Tab
+3: Switch to Tool Tab
E: Edit Object (if selected)
G: Grid On/Off
J: Jump to Coordinates
@@ -770,9 +770,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow): P: Open Properties Tool
R: Rotate by 90 degree CW
S: Shell Toggle
-V: View Fit
+V: Zoom Fit
X: Flip on X_axis
Y: Flip on Y_axis
+=: Zoom Out
+-: Zoom In

Space: En(Dis)able Obj Plot
CTRL+A: Select All
@@ -1215,6 +1217,17 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.corner_snap_btn.setDisabled(True) self.snap_magnet.setDisabled(True) + def keyPressEvent(self, event): + + if event.key() == QtCore.Qt.Key_1: + self.app.on_select_tab('project') + + if event.key() == QtCore.Qt.Key_2: + self.app.on_select_tab('selected') + + if event.key() == QtCore.Qt.Key_3: + self.app.on_select_tab('tool') + def dragEnterEvent(self, event): if event.mimeData().hasUrls: event.accept() diff --git a/ObjectCollection.py b/ObjectCollection.py index 5a6f9744..ff967a74 100644 --- a/ObjectCollection.py +++ b/ObjectCollection.py @@ -387,17 +387,17 @@ class ObjectCollection(QtCore.QAbstractItemModel): if key == QtCore.Qt.Key_F2: webbrowser.open(self.app.video_url) - # Zoom Fit + # Switch to Project Tab if key == QtCore.Qt.Key_1: - self.app.on_zoom_fit(None) + self.app.on_select_tab('project') - # Zoom In + # Switch to Selected Tab if key == QtCore.Qt.Key_2: - self.app.plotcanvas.zoom(1 / self.app.defaults['zoom_ratio'], self.app.mouse) + self.app.on_select_tab('selected') - # Zoom Out + # Switch to Tool Tab if key == QtCore.Qt.Key_3: - self.app.plotcanvas.zoom(self.app.defaults['zoom_ratio'], self.app.mouse) + self.app.on_select_tab('tool') # Delete if key == QtCore.Qt.Key_Delete and active: @@ -477,6 +477,14 @@ class ObjectCollection(QtCore.QAbstractItemModel): if key == QtCore.Qt.Key_Y: self.app.on_flipy() + # Zoom In + if key == QtCore.Qt.Key_Equal: + self.app.plotcanvas.zoom(1 / self.app.defaults['zoom_ratio'], self.app.mouse) + + # Zoom Out + if key == QtCore.Qt.Key_Minus: + self.app.plotcanvas.zoom(self.app.defaults['zoom_ratio'], self.app.mouse) + # Show shortcut list if key == QtCore.Qt.Key_Ampersand: self.app.on_shortcut_list() diff --git a/README.md b/README.md index 4a78cd3c..3c46f4e4 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ CAD program, and create G-Code for Isolation routing. - whatever was the visibility of the corresponding toolbar when we enter in the Editor, it will be set after exit from the Editor (either Geometry Editor or Excellon Editor). - added ability to be detached for the tabs in the Notebook section (Project, Selected and Tool) - added ability for all detachable tabs to be restored to the same position from where they were detached. - +- changed the shortcut keys for Zoom In, Zoom Out and Zoom Fit from 1, 2, 3 to '-', '=' respectively 'V'. Added new shortcut keys '1', '2', '3' for Select Project Tab, Select Selected Tab and Select Tool Tab. 3.3.2019 - updated the new shortcut list with the shortcuts added lately