示例#1
0
    def mousePressEvent(self, event):
        """ Call when the node is clicked
            event: QtGui.QGraphicsSceneMouseEvent instance
        """

        if globals.addingLinkFlag and globals.currentLinkType != globals.Enum.LinkType.Manual and event.button() == QtCore.Qt.LeftButton:
            interface = self.smart_interface(globals.linkAbrv[globals.currentLinkType])
            if interface:
                self.emit(QtCore.SIGNAL("Add link"), self.id, interface)
            else:
                QtGui.QMessageBox.critical(globals.GApp.mainWindow, translate("IOSRouter", "Connection"),  translate("IOSRouter", "No interface available"))
                return
        else:
            AbstractNode.mousePressEvent(self, event)
        QtSvg.QGraphicsSvgItem.mousePressEvent(self, event)
示例#2
0
    def mousePressEvent(self, event):
        """ Call when the node is clicked
            event: QtGui.QGraphicsSceneMouseEvent instance
        """

        if globals.addingLinkFlag and globals.currentLinkType != globals.Enum.LinkType.Manual and event.button() == QtCore.Qt.LeftButton:
            connected_interfaces = self.getConnectedInterfaceList()
            for interface in self.config['interfaces']:
                if not str(interface) in connected_interfaces:
                    self.emit(QtCore.SIGNAL("Add link"), self.id, str(interface))
                    return
            QtGui.QMessageBox.critical(globals.GApp.mainWindow, translate("DecorativeNode", "Connection"),  translate("DecorativeNode", "No interface available"))
            # tell the scene to cancel the link addition by sending a None id and None interface
            self.emit(QtCore.SIGNAL("Add link"), None, None)
        else:
            AbstractNode.mousePressEvent(self, event)
示例#3
0
    def mousePressEvent(self, event):
        """ Call when the node is clicked
            event: QtGui.QGraphicsSceneMouseEvent instance
        """

        if globals.addingLinkFlag and globals.currentLinkType != globals.Enum.LinkType.Manual and event.button(
        ) == QtCore.Qt.LeftButton:
            interface = self.smart_interface(
                globals.linkAbrv[globals.currentLinkType])
            if interface:
                self.emit(QtCore.SIGNAL("Add link"), self.id, interface)
            else:
                QtGui.QMessageBox.critical(
                    globals.GApp.mainWindow,
                    translate("IOSRouter", "Connection"),
                    translate("IOSRouter", "No interface available"))
                return
        else:
            AbstractNode.mousePressEvent(self, event)
        QtSvg.QGraphicsSvgItem.mousePressEvent(self, event)
示例#4
0
    def mousePressEvent(self, event):
        """ Call when the node is clicked
            event: QtGui.QGraphicsSceneMouseEvent instance
        """

        AbstractNode.mousePressEvent(self, event)
示例#5
0
    def mousePressEvent(self, event):
        """ Call when the node is clicked
            event: QtGui.QGraphicsSceneMouseEvent instance
        """

        AbstractNode.mousePressEvent(self, event)