Пример #1
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)
Пример #2
0
 def createAlignmentActions(self, parent):
     icons = os.environ["VORTEX_ICONS"]
     iconsData = {
         "horizontalAlignCenter.png":
         ("Aligns the selected nodes to the horizontal center",
          utils.CENTER | utils.X),
         "horizontalAlignLeft.png":
         ("Aligns the selected nodes to the Left", utils.LEFT),
         "horizontalAlignRight.png":
         ("Aligns the selected nodes to the Right", utils.RIGHT),
         "verticalAlignBottom.png":
         ("Aligns the selected nodes to the bottom", utils.BOTTOM),
         "verticalAlignCenter.png":
         ("Aligns the selected nodes to the vertical center",
          utils.CENTER | utils.Y),
         "verticalAlignTop.png": ("Aligns the selected nodes to the Top",
                                  utils.TOP)
     }
     for name, tip in iconsData.items():
         act = QtWidgets.QAction(QtGui.QIcon(os.path.join(icons, name)), "",
                                 self)
         act.setStatusTip(tip[0])
         act.setToolTip(tip[0])
         act.triggered.connect(partial(self.alignSelectedNodes, tip[1]))
         parent.addAction(act)
Пример #3
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)
Пример #4
0
    def setupMenuBar(self):
        self.hasMainMenu = True
        self.fileMenu = self.menuBar().addMenu("File")
        self.viewMenu = self.menuBar().addMenu("View")
        self.exitAction = QtWidgets.QAction(self)
        self.exitAction.setIcon(iconlib.icon("close"))
        self.exitAction.setText("Close")
        self.exitAction.setShortcut("ctrl+Q")
        self.exitAction.setToolTip("Closes application")
        self.fileMenu.addAction(self.exitAction)
        self.exitAction.triggered.connect(self.close)

        for i in self.docks:
            self.viewMenu.addAction(i.toggleViewAction())