コード例 #1
0
    def setDirPath(self, path):
        dir = QtCore.QDir(path)

        self.beginResetModel()
        self.fileList = list(dir.entryList())
        self.fileCount = 0
        self.endResetModel()
コード例 #2
0
    def find(self):
        self.filesTable.setRowCount(0)

        fileName = self.fileComboBox.currentText()
        text = self.textComboBox.currentText()
        path = self.directoryComboBox.currentText()

        self.updateComboBox(self.fileComboBox)
        self.updateComboBox(self.textComboBox)
        self.updateComboBox(self.directoryComboBox)

        self.currentDir = QtCore.QDir(path)
        if not fileName:
            fileName = "*"
        files = self.currentDir.entryList([fileName],
                QtCore.QDir.Files | QtCore.QDir.NoSymLinks)

        if text:
            files = self.findFiles(files, text)
        self.showFiles(files)
コード例 #3
0
    def loadUi(uifile,
               baseinstance=None,
               customWidgets=None,
               workingDirectory=None):

        loader = UiLoader(baseinstance, customWidgets)

        # If the .ui file references icons or other resources it may
        # not find them unless the cwd is defined. If this compat library
        # is in the same directory as the calling script, things should work.
        # If it's in another directory, however, you may need to set the
        # PYSIDE_LOADUI_CWD environment variable to the resource's directory first.
        # Best practice is not to define icons in the .ui file. Do it at the app level.
        if os.environ('PYSIDE_LOADUI_CWD') is not None:
            loader.setWorkingDirectory(os.environ('PYSIDE_LOADUI_CWD'))
        else:
            loader.setWorkingDirectory(QtCore.QDir(SCRIPT_DIRECTORY))

        widget = loader.load(uifile)
        QtCore.QMetaObject.connectSlotsByName(widget)
        return widget