Ejemplo n.º 1
0
Archivo: laser.py Proyecto: djdt/pewpew
    def contextMenuEvent(self, event: QtGui.QContextMenuEvent):
        menu = QtWidgets.QMenu(self)
        # menu.addAction(self.action_duplicate)
        menu.addAction(self.action_copy_image)
        menu.addSeparator()

        if self.graphics.posInSelection(event.pos()):
            menu.addAction(self.action_select_copy_text)
            menu.addAction(self.action_select_crop)
            menu.addSeparator()
            menu.addAction(self.action_select_statistics)
            menu.addAction(self.action_select_colocalisation)
        else:
            menu.addAction(self.view.action_open)
            menu.addAction(self.action_save)
            menu.addAction(self.action_export)
            menu.addSeparator()
            menu.addAction(self.action_config)
            menu.addAction(self.action_calibration)
            menu.addAction(self.action_information)
            menu.addSeparator()
            menu.addAction(self.action_statistics)
            menu.addAction(self.action_colocalisation)
        menu.popup(event.globalPos())
        event.accept()
Ejemplo n.º 2
0
 def contextMenuEvent(self, event: QtGui.QContextMenuEvent) -> None:
     event.accept()
     menu = QtWidgets.QMenu(self)
     copy_action = QtWidgets.QAction(QtGui.QIcon.fromTheme("edit-copy"),
                                     "Copy", self)
     copy_action.triggered.connect(self._copy)
     menu.addAction(copy_action)
     menu.popup(event.globalPos())
Ejemplo n.º 3
0
 def contextMenuEvent(self, event: QtGui.QContextMenuEvent) -> None:
     event.accept()
     index = self.tabAt(event.pos())
     menu = QtWidgets.QMenu(self)
     menu.addAction(self.action_close_all)
     if index != -1:
         self.action_close_others.setData(index)
         menu.addAction(self.action_close_others)
     menu.popup(event.globalPos())
 def context_menu_event(self, menu_event: QtGui.QContextMenuEvent):
     menu: Qt.QMenu = self.editable.createStandardContextMenu()
     action = Qt.QAction('Split')
     action.setText('Split')
     action.triggered.connect(
         lambda *_: self.split.signal.emit(self.editable.cursorPosition()))
     menu.addAction(action)
     menu.exec_(menu_event.globalPos())
     menu.deleteLater()
    def contextMenuEvent(self, event: QContextMenuEvent) -> None:
        """
		Opens a context menu (right click menu) for the component.

		:param event: The event that was generated when the user right-clicked on this item.
		:type event: QGraphicsSceneContextMenuEvent
		:return: None
		:rtype: NoneType
		"""

        self.menu.exec_(event.globalPos())
Ejemplo n.º 6
0
 def contextMenuEvent(self, menu_event: QtGui.QContextMenuEvent):
     menu: Qt.QMenu = Qt.QMenu()
     add_action = Qt.QAction('Add new')
     add_action.setText('Add new')
     add_action.triggered.connect(self.add_line.signal.emit)
     menu.addAction(add_action)
     delete_action = Qt.QAction('Delete')
     delete_action.setText('Delete')
     delete_action.triggered.connect(self.close)
     menu.addAction(delete_action)
     menu.exec_(menu_event.globalPos())
     menu.deleteLater()
Ejemplo n.º 7
0
    def contextMenuEvent(self, event:QContextMenuEvent):
        menu = QMenu("", self)
        menu.addAction('Add POI', self.POIView.menu_add_empty_poi)

        remove = menu.addAction('Remove', self.POIView.menu_remove_poi)
        if len(self.POIView.multiPOIList.selectedItems()) == 0:
            remove.setDisabled(True)

        # remove = menu.addAction('Remove both locally and remotely...', self.POIView.menu_remove_poi_remotely)
        # if len(self.POIView.multiPOIList.selectedItems()) == 0:
        #     remove.setDisabled(True)

        menu.exec_(event.globalPos())
Ejemplo n.º 8
0
 def contextMenuEvent(self, menu_event: QtGui.QContextMenuEvent):
     menu = Qt.QMenu()
     action_add_right = Qt.QAction('Add token')
     action_add_right.setText('Add token')
     action_add_right.triggered.connect(
         lambda: self.add_right.signal.emit(self.index + 1))
     menu.addAction(action_add_right)
     action_delete = Qt.QAction('Delete token')
     action_delete.setText('Delete token')
     action_delete.triggered.connect(self.close)
     menu.addAction(action_delete)
     menu.exec_(menu_event.globalPos())
     menu.deleteLater()
Ejemplo n.º 9
0
    def contextMenuEvent(self, event: QContextMenuEvent) -> None:
        index = self.indexAt(event.pos())

        menu = QMenu("Menu")

        edit_action = QAction("Edit")
        edit_action.triggered.connect(lambda: self.edit_package(index))
        menu.addAction(edit_action)

        delete_action = QAction(f"Delete")
        delete_action.triggered.connect(lambda: self.delete_package(index))
        menu.addAction(delete_action)

        menu.exec_(event.globalPos())
    def contextMenuEvent(self, event: QContextMenuEvent) -> None:
        index = self.indexAt(event.pos())
        if not index.isValid():
            return
        if not self.transfer_model.transfer_at_index(index).player:
            return

        menu = QMenu("Menu")

        delete_action = QAction("Cancel")
        delete_action.triggered.connect(lambda: self.cancel_transfer(index))
        menu.addAction(delete_action)

        menu.exec_(event.globalPos())
Ejemplo n.º 11
0
 def contextMenuEvent(self, event: QContextMenuEvent):
     """ Have the parameter test to see if it can be deleted safely.
     """
     menu = QMenu(self)
     menu.addAction(self.rename_action)
     menu.addAction(self.delete_action)
     menu.addAction(self.modify_uncertainty_action)
     proxy = self.indexAt(event.pos())
     if proxy.isValid():
         param = self.get_parameter(proxy)
         if param.is_deletable():
             self.delete_action.setEnabled(True)
         else:
             self.delete_action.setEnabled(False)
         menu.exec_(event.globalPos())
Ejemplo n.º 12
0
    def contextMenuEvent(self, event: QContextMenuEvent):
        item = self.itemAt(event.pos())

        menu = QMenu()

        if item is None:
            add_action = menu.addAction("Add Jump")
            add_action.triggered.connect(self.add_jump.emit)

        else:
            edit_action = menu.addAction("Edit Jump")
            edit_action.triggered.connect(self.edit_jump.emit)

            remove_action = menu.addAction("Remove Jump")
            remove_action.triggered.connect(self.remove_jump.emit)

        menu.exec_(event.globalPos())
Ejemplo n.º 13
0
    def contextMenuEvent(self, event: QContextMenuEvent):
        """ Override and activate QTableView.contextMenuEvent()

        All possible menu events should be added and wired up here
        """
        menu = QMenu(self)
        menu.addAction(qicons.add, "Open activities", self.open_activity_tab)
        menu.addAction(self.rename_action)
        menu.addAction(self.delete_action)
        menu.addAction(self.modify_uncertainty_action)
        proxy = self.indexAt(event.pos())
        if proxy.isValid():
            param = self.get_parameter(proxy)
            if param.is_deletable():
                self.delete_action.setEnabled(True)
            else:
                self.delete_action.setEnabled(False)
            menu.exec_(event.globalPos())
Ejemplo n.º 14
0
    def contextMenuEvent(self, event: QtGui.QContextMenuEvent) -> None:
        event.accept()
        action_copy_to_clipboard = QtWidgets.QAction(
            QtGui.QIcon.fromTheme("insert-image"), "Copy to Clipboard"
        )
        action_copy_to_clipboard.setToolTip(
            "Copy the chart as an image to the clipboard."
        )
        action_copy_to_clipboard.triggered.connect(self.copyToClipboard)

        action_zoom_reset = QtWidgets.QAction(
            QtGui.QIcon.fromTheme("zoom-original"), "Reset View"
        )
        action_zoom_reset.setToolTip("Reset the charts view.")
        action_zoom_reset.triggered.connect(self.chart().zoomReset)

        menu = QtWidgets.QMenu(self)
        menu.addAction(action_copy_to_clipboard)
        menu.addAction(action_zoom_reset)
        menu.exec_(event.globalPos())
Ejemplo n.º 15
0
 def contextMenuEvent(self, event: QContextMenuEvent):
     # FIXME: seems hacky
     if self._callback_remove_tag:
         menu = QMenu()
         menu.addAction(self._remove_action)
         menu.exec_(event.globalPos())
Ejemplo n.º 16
0
 def contextMenuEvent(self, event: QContextMenuEvent):
     self.contextMenu.popup(event.globalPos())
Ejemplo n.º 17
0
Archivo: laser.py Proyecto: djdt/pewpew
 def contextMenuEvent(self, event: QtGui.QContextMenuEvent) -> None:
     menu = QtWidgets.QMenu(self)
     menu.addAction(self.action_open)
     menu.popup(event.globalPos())
     event.accept()
Ejemplo n.º 18
0
Archivo: laser.py Proyecto: djdt/pewpew
 def contextMenuEvent(self, event: QtGui.QContextMenuEvent):
     event.accept()
     menu = QtWidgets.QMenu(self)
     menu.addAction(self.action_edit_names)
     menu.popup(event.globalPos())