From e30e8690255a107d4d1d2d1b9a956c8fa639d1ad Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 13 Jun 2016 09:40:23 +0200 Subject: [PATCH 1/3] Add instruction for security issues --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7d4747a6..1576d2a0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,6 +18,10 @@ it on https://github.com/GNS3/gns3-gui we will take care of the triage. For bugs specific to the GNS3 VM, please report on https://github.com/GNS3/gns3-vm +## Security issues + +For security issues please keep it private and send an email to developers@gns3.net + ## Asking for new features The best is to start a discussion on the community website in order to get feedback From 4f3d20a7c47e130cb832a058dcdd03027dc41cea Mon Sep 17 00:00:00 2001 From: Cometo Date: Mon, 20 Jun 2016 09:50:24 +0100 Subject: [PATCH 2/3] Add snap to grid feature --- gns3/items/node_item.py | 4 ++++ gns3/ui/main_window_ui.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/gns3/items/node_item.py b/gns3/items/node_item.py index c6c7be3a..af0f9adc 100644 --- a/gns3/items/node_item.py +++ b/gns3/items/node_item.py @@ -377,6 +377,10 @@ class NodeItem(): :param value: value of the change """ + if change == 9 and self._main_window.uiSnapToGridAction.isChecked(): # Unsure but change seems to alternate between 0/9 while dragging + GRID_SIZE = 75 + self.setPos(float(GRID_SIZE * round(self.x() / GRID_SIZE)), float(GRID_SIZE * round(self.y() / GRID_SIZE))) + # dynamically change the renderer when this node item is selected/unselected. if change == QtWidgets.QGraphicsItem.ItemSelectedChange: if value: diff --git a/gns3/ui/main_window_ui.py b/gns3/ui/main_window_ui.py index f4e7ae24..51cdc738 100644 --- a/gns3/ui/main_window_ui.py +++ b/gns3/ui/main_window_ui.py @@ -316,6 +316,9 @@ class Ui_MainWindow(object): self.uiShowLayersAction = QtWidgets.QAction(MainWindow) self.uiShowLayersAction.setCheckable(True) self.uiShowLayersAction.setObjectName("uiShowLayersAction") + self.uiSnapToGridAction = QtWidgets.QAction(MainWindow) + self.uiSnapToGridAction.setCheckable(True) + self.uiSnapToGridAction.setObjectName("uiSnapToGridAction") self.uiSaveProjectAsAction = QtWidgets.QAction(MainWindow) icon20 = QtGui.QIcon() icon20.addPixmap(QtGui.QPixmap(":/icons/save-as-project.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) @@ -467,6 +470,7 @@ class Ui_MainWindow(object): self.uiViewMenu.addAction(self.uiFitInViewAction) self.uiViewMenu.addSeparator() self.uiViewMenu.addAction(self.uiShowLayersAction) + self.uiViewMenu.addAction(self.uiSnapToGridAction) self.uiViewMenu.addAction(self.uiResetPortLabelsAction) self.uiViewMenu.addAction(self.uiShowPortNamesAction) self.uiViewMenu.addSeparator() @@ -632,6 +636,8 @@ class Ui_MainWindow(object): self.uiSnapshotAction.setStatusTip(_translate("MainWindow", "Manage snapshots")) self.uiShowLayersAction.setText(_translate("MainWindow", "Show layers")) self.uiShowLayersAction.setStatusTip(_translate("MainWindow", "Show layers")) + self.uiSnapToGridAction.setText(_translate("MainWindow", "Snap To Grid")) + self.uiSnapToGridAction.setStatusTip(_translate("MainWindow", "Snap To Grid")) self.uiSaveProjectAsAction.setText(_translate("MainWindow", "&Save project as...")) self.uiSaveProjectAsAction.setToolTip(_translate("MainWindow", "Save project as...")) self.uiSaveProjectAsAction.setStatusTip(_translate("MainWindow", "Save project as...")) From fbbe8aff54315ec22196ef8a829f12bc383a33f8 Mon Sep 17 00:00:00 2001 From: Cometo Date: Mon, 20 Jun 2016 10:27:45 +0100 Subject: [PATCH 3/3] Add Snap to Grid to Qt ui file --- gns3/items/node_item.py | 3 ++- gns3/ui/main_window.ui | 12 ++++++++++++ gns3/ui/main_window_ui.py | 5 ++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gns3/items/node_item.py b/gns3/items/node_item.py index af0f9adc..128f6fc5 100644 --- a/gns3/items/node_item.py +++ b/gns3/items/node_item.py @@ -377,7 +377,8 @@ class NodeItem(): :param value: value of the change """ - if change == 9 and self._main_window.uiSnapToGridAction.isChecked(): # Unsure but change seems to alternate between 0/9 while dragging + # was causing infinite recursion loops when placed within the below if statements + if change == QtWidgets.QGraphicsItem.ItemPositionHasChanged and self._main_window.uiSnapToGridAction.isChecked(): GRID_SIZE = 75 self.setPos(float(GRID_SIZE * round(self.x() / GRID_SIZE)), float(GRID_SIZE * round(self.y() / GRID_SIZE))) diff --git a/gns3/ui/main_window.ui b/gns3/ui/main_window.ui index 51b0f1f6..97bb3b27 100644 --- a/gns3/ui/main_window.ui +++ b/gns3/ui/main_window.ui @@ -126,6 +126,7 @@ background-none; + @@ -889,6 +890,17 @@ background-none; Show layers + + + true + + + Snap To Grid + + + Snap To Grid + + diff --git a/gns3/ui/main_window_ui.py b/gns3/ui/main_window_ui.py index 51cdc738..9145c73c 100644 --- a/gns3/ui/main_window_ui.py +++ b/gns3/ui/main_window_ui.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/ui/main_window.ui' +# Form implementation generated from reading ui file '/home/cometo/dev/gns3-gui/gns3/ui/main_window.ui' # -# Created: Tue Apr 26 11:38:43 2016 -# by: PyQt5 UI code generator 5.2.1 +# Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost!