Пример #1
0
    def initUI(self):
        self.setWindowTitle(PROJECTMETA.__label__)
        #self.center()  # center window position

        # create dummy widget (it will be selected if our node doesnot has ctrlWidget)
        self._dummyWidget = QtWidgets.QWidget(self)

        # init FlowChart
        self.initFlowchart()

        # connect on select QTreeWidgetItem > se text in QLineEdit
        self.treeWidget.itemActivated.connect(
            self.on_nodeLibTreeWidget_itemActivated)

        # init dock widgets
        css = "color: white; font-size: 12pt; font-weight: bold; background: rgb(102, 102, 204);  qproperty-alignment: 'AlignVCenter | AlignHCenter';"
        label_1 = QtWidgets.QLabel("Node Library")
        label_1.setStyleSheet(css)
        self.dockWidget.setTitleBarWidget(label_1)

        label_2 = QtWidgets.QLabel("Node Controls")
        label_2.setStyleSheet(css)
        self.dockWidget_2.setTitleBarWidget(label_2)

        #init node selector tab, set autocompletion etc
        #self._nodeNameCompleter = QtWidgets.QCompleter(self)
        self._nodeNameCompleter = CustomQCompleter(self)
        self._nodeNameCompleter.setModel(self.uiData.nodeNamesModel())
        self._nodeNameCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
        self.lineEdit_nodeSelect.setCompleter(self._nodeNameCompleter)
        # set tree view of node library
        fill_widget(self.treeWidget, self.uiData.nodeNamesTree())

        # create EMPTY Open Recent Actions
        self.recentFileActs = []
        for i in xrange(GlobalOptions.n_recent_files):
            action = QtGui.QAction(self,
                                   visible=False,
                                   triggered=self.openRecentFile)
            self.menuOpen_Recent.addAction(action)
            self.recentFileActs.append(action)
        self.menuOpen_Recent.addSeparator()
        self.actionClearRecent = QtGui.QAction(
            'Clear', self, visible=True, triggered=self.on_actionClearRecent)
        self.menuOpen_Recent.addAction(self.actionClearRecent)

        # create a tool bar menu button to open recent files and connect it to proper QMenu
        for widget in self.actionLoad_fc.associatedWidgets():
            # loop over assosiated widgets and search for QToolButton, assuming that only one is connected.
            if isinstance(widget, QtWidgets.QToolButton):
                widget.setMenu(self.menuOpen_Recent)
                widget.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)

        # now populate recent files QMenu
        self.uiData.updateRecentFileActions()
Пример #2
0
    def initUI(self):
        self.setWindowTitle(PROJECTMETA.__label__)
        #self.center()  # center window position
        
        # create dummy widget (it will be selected if our node doesnot has ctrlWidget)
        self._dummyWidget = QtWidgets.QWidget(self)

        # init FlowChart
        self.initFlowchart()

        # connect on select QTreeWidgetItem > se text in QLineEdit
        self.treeWidget.itemActivated.connect(self.on_nodeLibTreeWidget_itemActivated)

        # init dock widgets
        css = "color: white; font-size: 12pt; font-weight: bold; background: rgb(102, 102, 204);  qproperty-alignment: 'AlignVCenter | AlignHCenter';"
        label_1 = QtWidgets.QLabel("Node Library")
        label_1.setStyleSheet(css)
        self.dockWidget.setTitleBarWidget(label_1)
        
        label_2 = QtWidgets.QLabel("Node Controls")
        label_2.setStyleSheet(css)
        self.dockWidget_2.setTitleBarWidget(label_2)

        #init node selector tab, set autocompletion etc
        #self._nodeNameCompleter = QtWidgets.QCompleter(self)
        self._nodeNameCompleter = CustomQCompleter(self)
        self._nodeNameCompleter.setModel(self.uiData.nodeNamesModel())
        self._nodeNameCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
        self.lineEdit_nodeSelect.setCompleter(self._nodeNameCompleter)
        # set tree view of node library
        fill_widget(self.treeWidget, self.uiData.nodeNamesTree())

        # create EMPTY Open Recent Actions
        self.recentFileActs = []
        for i in xrange(GlobalOptions.n_recent_files):
            action = QtGui.QAction(self, visible=False, triggered=self.openRecentFile)
            self.menuOpen_Recent.addAction(action)
            self.recentFileActs.append(action)
        self.menuOpen_Recent.addSeparator()
        self.actionClearRecent = QtGui.QAction('Clear', self, visible=True, triggered=self.on_actionClearRecent)
        self.menuOpen_Recent.addAction(self.actionClearRecent)

        # create a tool bar menu button to open recent files and connect it to proper QMenu
        for widget in self.actionLoad_fc.associatedWidgets():
            # loop over assosiated widgets and search for QToolButton, assuming that only one is connected.
            if isinstance(widget, QtWidgets.QToolButton):
                widget.setMenu(self.menuOpen_Recent)
                widget.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)

        # now populate recent files QMenu
        self.uiData.updateRecentFileActions()
Пример #3
0
 def resetNodeLibraryWidgets(self):
     #init node selector tab, set autocompletion etc
     self.uiData.nodeNamesModel().setStringList(self.uiData.nodeNamesList())
     # set tree view of node library
     fill_widget(self.treeWidget, self.uiData.nodeNamesTree())
Пример #4
0
 def resetNodeLibraryWidgets(self):
     #init node selector tab, set autocompletion etc
     self.uiData.nodeNamesModel().setStringList(self.uiData.nodeNamesList())
     # set tree view of node library
     fill_widget(self.treeWidget, self.uiData.nodeNamesTree())