From 4906678d13053ac5fce436c1a26eead32c33aca7 Mon Sep 17 00:00:00 2001 From: Bilal_Raza Date: Mon, 22 Jul 2024 16:53:58 +0500 Subject: [PATCH 1/2] feature/FitInViewShortcut --- gns3/main_window.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gns3/main_window.py b/gns3/main_window.py index 223902e5e..78b3a0f89 100644 --- a/gns3/main_window.py +++ b/gns3/main_window.py @@ -1131,6 +1131,8 @@ def keyPressEvent(self, event): status_bar_message = self.uiStatusBar.currentMessage() if status_bar_message: QtWidgets.QApplication.clipboard().setText(status_bar_message) + elif key == QtCore.Qt.Key_1 and event.modifiers() & QtCore.Qt.ControlModifier: + self._fitInViewActionSlot() else: super().keyPressEvent(event) From 2ed48def9fc112fca0325ffdd100f7ec275017a7 Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 22 Jul 2024 23:25:05 +0200 Subject: [PATCH 2/2] Add Fit In View Shortcut in Ui file instead --- gns3/main_window.py | 2 -- gns3/ui/main_window.ui | 3 +++ gns3/ui/main_window_ui.py | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gns3/main_window.py b/gns3/main_window.py index 78b3a0f89..223902e5e 100644 --- a/gns3/main_window.py +++ b/gns3/main_window.py @@ -1131,8 +1131,6 @@ def keyPressEvent(self, event): status_bar_message = self.uiStatusBar.currentMessage() if status_bar_message: QtWidgets.QApplication.clipboard().setText(status_bar_message) - elif key == QtCore.Qt.Key_1 and event.modifiers() & QtCore.Qt.ControlModifier: - self._fitInViewActionSlot() else: super().keyPressEvent(event) diff --git a/gns3/ui/main_window.ui b/gns3/ui/main_window.ui index c58245133..9d255541c 100644 --- a/gns3/ui/main_window.ui +++ b/gns3/ui/main_window.ui @@ -1147,6 +1147,9 @@ background-none; Fit in view + + Ctrl+1 + diff --git a/gns3/ui/main_window_ui.py b/gns3/ui/main_window_ui.py index 1635394fc..ec919505f 100644 --- a/gns3/ui/main_window_ui.py +++ b/gns3/ui/main_window_ui.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/ui/main_window.ui' # -# Created by: PyQt5 UI code generator 5.15.9 +# Created by: PyQt5 UI code generator 5.15.6 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. @@ -702,6 +702,7 @@ def retranslateUi(self, MainWindow): self.uiAddLinkAction.setToolTip(_translate("MainWindow", "Add a link")) self.uiAddLinkAction.setStatusTip(_translate("MainWindow", "Add a link")) self.uiFitInViewAction.setText(_translate("MainWindow", "Fit in view")) + self.uiFitInViewAction.setShortcut(_translate("MainWindow", "Ctrl+1")) self.uiActionFullscreen.setText(_translate("MainWindow", "Fullscreen")) self.uiActionFullscreen.setShortcut(_translate("MainWindow", "Ctrl+F")) self.uiSetupWizard.setText(_translate("MainWindow", "&Setup Wizard"))