Просмотр исходного кода

- 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.

Marius Stanciu 7 лет назад
Родитель
Сommit
8a6c48c7a9
4 измененных файлов с 54 добавлено и 22 удалено
  1. 22 11
      FlatCAMApp.py
  2. 17 4
      FlatCAMGUI.py
  3. 14 6
      ObjectCollection.py
  4. 1 1
      README.md

+ 22 - 11
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()")
 

+ 17 - 4
FlatCAMGUI.py

@@ -756,9 +756,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
 <br>
 <b>~:</b>       Show Shortcut List<br>
 <br>
-<b>1:</b>       Zoom Fit<br>
-<b>2:</b>       Zoom Out<br>
-<b>3:</b>       Zoom In<br>
+<b>1:</b>       Switch to Project Tab<br>
+<b>2:</b>       Switch to Selected Tab<br>
+<b>3:</b>       Switch to Tool Tab<br>
 <b>E:</b>       Edit Object (if selected)<br>
 <b>G:</b>       Grid On/Off<br>
 <b>J:</b>       Jump to Coordinates<br>
@@ -770,9 +770,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
 <b>P:</b>       Open Properties Tool<br>
 <b>R:</b>       Rotate by 90 degree CW<br>
 <b>S:</b>       Shell Toggle<br>
-<b>V:</b>       View Fit<br>
+<b>V:</b>       Zoom Fit<br>
 <b>X:</b>       Flip on X_axis<br>
 <b>Y:</b>       Flip on Y_axis<br>
+<b>=:</b>       Zoom Out<br>
+<b>-:</b>       Zoom In<br>
 <br>
 <b>Space:</b>    En(Dis)able Obj Plot<br>
 <b>CTRL+A:</b>   Select All<br>
@@ -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()

+ 14 - 6
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()

+ 1 - 1
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