Example #1
0
    def contextMenuEvent(self, event: QGraphicsSceneContextMenuEvent):
        """
        Right click on node to show node menu
        Except on wallet node

        :param event: scene context menu event
        """
        #  no menu on the wallet node
        if self.status_wallet:
            return None
        # create node context menus
        self.menu = QMenu()
        # action show member
        QT_TRANSLATE_NOOP('WoT.Node', 'Informations')
        self.action_show_member = QAction(QCoreApplication.translate('WoT.Node', 'Informations'), self.scene())
        self.menu.addAction(self.action_show_member)
        self.action_show_member.triggered.connect(self.member_action)
        # action add identity as contact
        QT_TRANSLATE_NOOP('WoT.Node', 'Add as contact')
        self.action_contact = QAction(QCoreApplication.translate('WoT.Node', 'Add as contact'), self.scene())
        self.menu.addAction(self.action_contact)
        self.action_contact.triggered.connect(self.contact_action)
        # action transaction toward identity
        QT_TRANSLATE_NOOP('WoT.Node', 'Send money')
        self.action_transaction = QAction(QCoreApplication.translate('WoT.Node', 'Send money'), self.scene())
        self.menu.addAction(self.action_transaction)
        self.action_transaction.triggered.connect(self.transaction_action)
        # action sign identity
        QT_TRANSLATE_NOOP('WoT.Node', 'Certify identity')
        self.action_sign = QAction(QCoreApplication.translate('WoT.Node', 'Certify identity'), self.scene())
        self.menu.addAction(self.action_sign)
        self.action_sign.triggered.connect(self.sign_action)
        # run menu
        self.menu.exec(event.screenPos())
Example #2
0
 def contextMenuEvent(self, evt: QGraphicsSceneContextMenuEvent) -> None:
     menu = QMenu()
     action: QAction = menu.addAction("Delete point")
     delete_point = menu.exec_(evt.screenPos())
     if action == delete_point:
         self.scene().removeItem(self)
         self.signals.deleted.emit(self.index)
Example #3
0
    def contextMenuEvent(self,
                         event: QtWidgets.QGraphicsSceneContextMenuEvent):
        mw = self.scene().parent()
        if mw.state != mw.State.ACTIONS:
            return
        menu = QtWidgets.QMenu()
        if self.suit is not None and self.rank is not None:
            action = QtWidgets.QAction("Inconnue")
            action.triggered.connect(lambda: setattr(self, "suit", None))
            actions = [action]
        else:
            actions = []
        for suit in Suit:
            action = QtWidgets.QAction(str(suit))
            action.triggered.connect(
                lambda e, s=suit: setattr(self, "suit", s))
            actions.append(action)

        for rank in Rank:
            action = QtWidgets.QAction(str(rank))
            action.triggered.connect(
                lambda e, r=rank: setattr(self, "rank", r))
            actions.append(action)

        menu.addActions(actions)
        menu.exec(event.screenPos())
Example #4
0
    def contextMenuEvent(self, event: QGraphicsSceneContextMenuEvent):
        self.scene().clearSelection()
        self.setSelected(True)

        self._create_action()
        self._create_context_menu()

        # call the context menu at the item position
        self.context_menu.exec_(event.screenPos())
 def contextMenuEvent(self, event: qt.QGraphicsSceneContextMenuEvent):
     item = self.itemAt(event.scenePos(), gui.QTransform())
     item = item if item and isinstance(item, AugmentItem) else self._selected
     if item:
         self._selected = item
         context_menu = qt.QMenu()
         context_menu.addAction(self.delete_act)
         context_menu.exec(event.screenPos())
         event.accept()
     else:
         event.ignore()
Example #6
0
 def contextMenuEvent(self, evt: QGraphicsSceneContextMenuEvent) -> None:
     menu = QMenu()
     action_delete: QAction = menu.addAction("Delete")
     if self.tag:
         result = self._labels_dao.fetch_all(self.tag.dataset)
         if len(result) > 0:
             labels_menu = menu.addMenu("labels")
             for vo in result:
                 action = labels_menu.addAction(vo.name)
                 action.setData(vo)
     action = menu.exec_(evt.screenPos())
     if action == action_delete:
         self.scene().removeItem(self)
         self.signals.deleted.emit(self)
     elif action and isinstance(action.data(), LabelVO):
         self.label = action.data()
Example #7
0
    def contextMenuEvent(self, event: QGraphicsSceneContextMenuEvent):
        """
        Right click on node to show node menu
        Except on wallet node

        :param event: scene context menu event
        """
        #  no menu on the wallet node
        if self.status_wallet:
            return None
        # create node context menus
        self.menu = QMenu()
        # action show member
        QT_TRANSLATE_NOOP('WoT.Node', 'Informations')
        self.action_show_member = QAction(
            QCoreApplication.translate('WoT.Node', 'Informations'),
            self.scene())
        self.menu.addAction(self.action_show_member)
        self.action_show_member.triggered.connect(self.member_action)
        # action add identity as contact
        QT_TRANSLATE_NOOP('WoT.Node', 'Add as contact')
        self.action_contact = QAction(
            QCoreApplication.translate('WoT.Node', 'Add as contact'),
            self.scene())
        self.menu.addAction(self.action_contact)
        self.action_contact.triggered.connect(self.contact_action)
        # action transaction toward identity
        QT_TRANSLATE_NOOP('WoT.Node', 'Send money')
        self.action_transaction = QAction(
            QCoreApplication.translate('WoT.Node', 'Send money'), self.scene())
        self.menu.addAction(self.action_transaction)
        self.action_transaction.triggered.connect(self.transaction_action)
        # action sign identity
        QT_TRANSLATE_NOOP('WoT.Node', 'Certify identity')
        self.action_sign = QAction(
            QCoreApplication.translate('WoT.Node', 'Certify identity'),
            self.scene())
        self.menu.addAction(self.action_sign)
        self.action_sign.triggered.connect(self.sign_action)
        # run menu
        self.menu.exec(event.screenPos())
Example #8
0
 def contextMenuEvent(self, event: QGraphicsSceneContextMenuEvent):
     self.scene().clearSelection()
     self.setSelected(True)
     self.context_menu.exec_(event.screenPos())