Exemple #1
0
 def contextMenu(self, position):
     menu = QtWidgets.QMenu(self)
     selection = [int(i.row()) for i in self.selectionModel.selectedIndexes()]
     if self.rowDataSource:
         self.rowDataSource.contextMenu(selection, menu)
     self.contextMenuRequested.emit(selection, menu)
     menu.exec_(self.listview.viewport().mapToGlobal(position))
Exemple #2
0
    def __init__(self,
                 applicationModel,
                 title="Vortex",
                 width=1920,
                 height=1080,
                 icon="",
                 parent=None,
                 showOnInitialize=True):
        super(ApplicationWindow, self).__init__(title, width, height, icon,
                                                parent, showOnInitialize)
        self.setObjectName("VortexMainWindow")
        self.setStyleSheet(style.data)
        self.noteBook = graphnotebook.GraphNotebook(parent=self)
        self.setCustomCentralWidget(self.noteBook)
        self.noteBook.bindApplication(applicationModel)
        self.setupMenuBar()
        self.loadAction = QtWidgets.QAction("Load", parent=self)
        self.saveAction = QtWidgets.QAction("Save", parent=self)
        self.recentFilesMenu = QtWidgets.QMenu("Recent Files", parent=self)

        self.fileMenu.insertAction(self.exitAction, self.saveAction)
        self.fileMenu.insertAction(self.exitAction, self.loadAction)
        self.fileMenu.insertMenu(self.exitAction, self.recentFilesMenu)
        self.saveAction.triggered.connect(self.onSave)
        self.loadAction.triggered.connect(self.onLoad)
Exemple #3
0
 def _contextMenu(self, pos):
     menu = QtWidgets.QMenu()
     item = self.itemAt(pos)
     self.contextMenuRequest.emit(menu, item)
     if menu.isEmpty():
         return
     menu.exec_(self.mapToGlobal(pos))
Exemple #4
0
 def _ShowContextMenu(self, point):
     menu = QtWidgets.QMenu(self)
     if self._listView.selectedIndexes():
         menu.addAction("Copy Selected", self.CopySelected)
     else:
         menu.addAction("Copy All", self.CopyAll)
     menu.addAction("Select All", self.SelectAll)
     menu.exec_(QtGui.QCursor.pos())
Exemple #5
0
 def contextMenu(self, position):
     menu = QtWidgets.QMenu(self)
     selection = self.selectedRowColumns()
     if self.rowDataSource:
         self.rowDataSource.contextMenu(selection, menu)
     self.contextMenuRequested.emit(selection, menu)
     if not menu.isEmpty():
         menu.exec_(self.tableview.viewport().mapToGlobal(position))
Exemple #6
0
 def _contextMenu(self, position):
     model = self.model()
     if model is None:
         return
     menu = QtWidgets.QMenu(self)
     selectionModel = self.selectionModel()
     selection = [model.itemFromIndex(index) for index in selectionModel.selectedIndexes()]
     self.contextMenuRequested.emit(selection, menu)
     menu.exec_(self.viewport().mapToGlobal(position))
Exemple #7
0
 def createContextMenu(self, objectModel):
     if isinstance(objectModel,
                   SlitherUIObject) and objectModel.isCompound():
         menu = QtWidgets.QMenu()
         # note: this is temp, should run through a dialog
         menu.addAction(
             "Create Attribute",
             partial(objectModel.createAttribute, str(uuid.uuid4()), str,
                     "output"))
         return menu
Exemple #8
0
 def _headerMenu(self, pos):
     globalPos = self.mapToGlobal(pos)
     menu = QtWidgets.QMenu(parent=self)
     headers = self.headerItems()
     for i in range(len(headers)):
         item = QtWidgets.QAction(headers[i], menu, checkable=True)
         menu.addAction(item)
         item.setChecked(not self.treeView.header().isSectionHidden(i))
         item.setData({"index": i})
     selectedItem = menu.exec_(globalPos)
     self.toggleColumn(selectedItem.data()["index"],
                       QtCore.Qt.Checked if selectedItem.isChecked() else QtCore.Qt.Unchecked)
Exemple #9
0
    def _contextMenu(self, pos):
        """ Set up a custom context menu, the contextMenuRequested signal is called at the end of
        the function so the user can add their own actions/child menus without overriding the function. exec is Called
        after user mode.

        :param pos: the mouse position
        :type pos: QPoint
        """
        menu = QtWidgets.QMenu()
        rename = menu.addAction("Rename")
        rename.triggered.connect(self.renameTab)

        add = menu.addAction("Add Tab")
        add.triggered.connect(self.addTabWidget)

        self.contextMenuRequest.emit(menu)
        menu.exec_(self.mapToGlobal(pos))
Exemple #10
0
def loggingMenu():
    logManager = zlogging.CentralLogManager()

    logMenu = QtWidgets.QMenu("logging")
    logs = dict(logManager.logs.items())

    for level in zlogging.levelsDict():
        levelAction = logMenu.addAction(level)
        levelAction.triggered.connect(
            partial(logManager.changeLevel, "root", level))
    logMenu.addSeparator()

    for name, log in iter(logs.items()):
        subMenu = logMenu.addMenu(name)
        for level in zlogging.levelsDict():
            levelAction = subMenu.addAction(level)
            levelAction.triggered.connect(
                partial(logManager.changeLevel, name, level))
    return logMenu
Exemple #11
0
 def contextMenu(self, position):
     menu = QtWidgets.QMenu(self)
     self.contextMenuRequested.emit(menu, self.selectedItems())
     menu.exec_(self.treeView.viewport().mapToGlobal(position))
Exemple #12
0
 def _ShowContextMenu(self, point):
     menu = QtWidgets.QMenu(self)
     menu.addAction("Copy", self.Copy)
     menu.addAction("Select All", self.SelectAll)
     menu.exec_(QtGui.QCursor.pos())
Exemple #13
0
    def contextMenuEvent(self, event):
        menu = QtWidgets.QMenu(self)

        self.contextMenuRequested.emit(menu)
        menu.exec_(event.scenePos())
        event.setAccepted(True)
Exemple #14
0
 def contextMenu(self, position):
     menu = QtWidgets.QMenu(self)
     self.contextMenuRequested.emit(menu)
     menu.exec_(self.mapToGlobal(position))