Esempio n. 1
0
 def onSaveClicked(self):
     savedia = saveDialog.saveDialog()
     result = savedia.exec_()
     if result == QtWidgets.QDialog.Accepted:
         category, name = savedia.getCatandName()
         self.preset = addExpression.presetXML()
         self.preset.saveXML(category, name, self.textArea.toPlainText())
         self.onRefreshClicked()
Esempio n. 2
0
    def onItemDoubleClicked(self, item, column):
        #self.treeWidget.editItem(item, column)
        newName = item.text(0)
        newExp = item.text(1)
        snippetDia = snippetDialog.snippetDialog(parent = self, text=item.text(column))
        result = snippetDia.exec_()
        if result == QtWidgets.QDialog.Accepted:
            if column == 0:
                newName = snippetDia.getNewText()
            elif column == 1:
                newExp = snippetDia.getNewText()
            categoryList = self.getParentItems(item)
            #print categoryList
            self.preset = addExpression.presetXML()
            self.preset.updateExpression(categoryList, item.text(0), newName, newExp)

            self.onRefreshClicked()
Esempio n. 3
0
    def __init__(self, parent=None):
        #super(pickerWidget, self).__init__(parent)
        QtWidgets.QFrame.__init__(self, parent)

        self.draggedItem = None

        layout = QtWidgets.QVBoxLayout()
        #layout.setContentsMargins(0,0,0,0)
        self.splitter = QtWidgets.QSplitter(QtCore.Qt.Vertical)

        ### set up buttons
        buttonLayout = QtWidgets.QHBoxLayout()
        self.refreshButton = QtWidgets.QPushButton("Refresh")
        self.sortButton = QtWidgets.QPushButton("Sort")
        self.saveButton = QtWidgets.QPushButton("Save")
        self.deleteButton = QtWidgets.QPushButton("Delete")
        buttonLayout.addWidget(self.refreshButton)
        buttonLayout.addWidget(self.sortButton)
        buttonLayout.addWidget(self.saveButton)
        buttonLayout.addWidget(self.deleteButton)
        self.refreshButton.clicked.connect(self.onRefreshClicked)
        self.refreshButton.clicked.connect(self.onSortClicked)
        self.saveButton.clicked.connect(self.onSaveClicked)
        self.deleteButton.clicked.connect(self.onDeleteClicked)

        ### set up tree widget
        self.treeWidget = expressionTreeWidget.expressionTreeWidget()
        self.treeWidget.setColumnCount(2)
        self.treeWidget.setSelectionMode(
            QtWidgets.QAbstractItemView.ExtendedSelection)
        self.treeWidget.setColumnWidth(0, 150)
        self.treeWidget.setColumnWidth(1, 800)
        self.treeWidget.setAutoScroll(False)
        self.treeWidget.setHeaderLabels(["Name", "Expression"])

        self.treeWidget.itemClicked.connect(self.onItemClicked)
        self.treeWidget.itemDoubleClicked.connect(self.onItemDoubleClicked)

        searchLayout = QtWidgets.QHBoxLayout()
        self.staticSearchText = QtWidgets.QLabel()
        self.staticSearchText.setText("Filter : ")
        self.searchTextArea = QtWidgets.QLineEdit()
        self.clearFilterButton = QtWidgets.QPushButton("Clear")
        self.searchTextArea.textEdited.connect(self.onSearchTextEdited)
        self.searchTextArea.editingFinished.connect(self.onEditFinished)
        self.clearFilterButton.clicked.connect(self.onClearFilterClicked)
        searchLayout.addWidget(self.staticSearchText)
        searchLayout.addWidget(self.searchTextArea)
        searchLayout.addWidget(self.clearFilterButton)

        labelLayout = QtWidgets.QHBoxLayout()
        self.pathLabel = QtWidgets.QLabel()
        self.pathLabel.setStyleSheet(stylesheet.styles["initial"])
        self.pathLabel.setText("Drop parameter above:")
        #self.pathLabel.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum))

        self.clearButton = QtWidgets.QPushButton("Clear")
        self.clearButton.setSizePolicy(
            QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed))
        labelLayout.addWidget(self.pathLabel)
        #labelLayout.addStretch(0)
        labelLayout.addWidget(self.clearButton)
        self.clearButton.clicked.connect(self.onClearClicked)

        self.textArea = snippet.snippet(pathLabel=self.pathLabel)
        cursor = self.textArea.textCursor()
        font = QtGui.QFont()
        font.setPointSize(12)
        self.textArea.setCurrentFont(font)

        layout.addLayout(buttonLayout)
        layout.addLayout(searchLayout)
        layout.addWidget(self.splitter)
        self.splitter.addWidget(self.treeWidget)
        self.splitter.addWidget(self.textArea)
        layout.addLayout(labelLayout)
        self.setLayout(layout)
        self.splitter.setSizes([250, 100])

        self.preset = addExpression.presetXML()

        self.updateTree()
        self.setStyleSheet(hou.qt.styleSheet())
Esempio n. 4
0
 def onRefreshClicked(self):
     self.preset = addExpression.presetXML()
     #menus = self.importXmlMenus()
     #menus, categories = self.importExpressions(menus)
     self.updateTree()