当前位置: 首页>>代码示例>>Python>>正文


Python QtCore.QDir方法代码示例

本文整理汇总了Python中PyQt5.QtCore.QDir方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QDir方法的具体用法?Python QtCore.QDir怎么用?Python QtCore.QDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtCore的用法示例。


在下文中一共展示了QtCore.QDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initUI

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QDir [as 别名]
def initUI(self):

        self.setStyleSheet('background-color: silver')
        mod_path = os.path.dirname(Pythonic.__file__)
        """
        image_folder = QDir('images')

        if not image_folder.exists():
            logging.error('Image foulder not found')
            sys.exit(1)
        """
            
        self.layout_h = QHBoxLayout()

        self.e_mail = MasterTool(self, 'ConnMail', 1)
        self.e_mail.setPixmap(QPixmap(join(mod_path, 'images/ConnMail.png')).scaled(120, 60))

        self.rest = MasterTool(self, 'ConnREST', 1)
        self.rest.setPixmap(QPixmap(join(mod_path, 'images/ConnREST.png')).scaled(120, 60))

        self.layout_h.addWidget(self.e_mail)
        self.layout_h.addWidget(self.rest)
        self.layout_h.addStretch(1)

        self.setLayout(self.layout_h) 
开发者ID:hANSIc99,项目名称:Pythonic,代码行数:27,代码来源:connectivitytools.py

示例2: __init__

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QDir [as 别名]
def __init__(self):
        self.version = 100  # Assume oldest config
        self.root_dir = QDir().currentPath()
        self.send_sleep = 0.1
        self.read_sleep = 0.1
        self.use_transfer_scripts = True
        self.use_custom_transfer_scripts = False
        self.external_transfer_scripts_folder = None
        self.wifi_presets = []
        self.python_flash_executable = None
        self.last_firmware_directory = None
        self.debug_mode = False
        self._geometries = {}
        self.external_editor_path = None
        self.external_editor_args = None
        self.new_line_key = QKeySequence(Qt.SHIFT + Qt.Key_Return, Qt.SHIFT + Qt.Key_Enter)
        self.send_key = QKeySequence(Qt.Key_Return, Qt.Key_Enter)
        self.terminal_tab_spaces = 4
        self.mpy_cross_path = None
        self.preferred_port = None
        self.auto_transfer = False

        if not self.load():
            if not self.load_old():
                # No config found, init at newest version
                self.version = Settings.newest_version
                return

        self._update_config() 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:31,代码来源:settings.py

示例3: browse_external_editor

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QDir [as 别名]
def browse_external_editor(self):
        path = QFileDialog().getOpenFileName(
            caption="Select external editor",
            directory=QDir().homePath(),
            options=QFileDialog.ReadOnly)

        if path[0]:
            self.externalPathLineEdit.setText(path[0]) 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:10,代码来源:settings_dialog.py

示例4: browse_mpy_cross

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QDir [as 别名]
def browse_mpy_cross(self):
        path = QFileDialog().getOpenFileName(
            caption="Select mpy-cross compiler",
            directory=QDir().homePath(),
            options=QFileDialog.ReadOnly)

        if path[0]:
            self.mpyCrossPathLineEdit.setText(path[0]) 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:10,代码来源:settings_dialog.py

示例5: browse_external_transfer_files

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QDir [as 别名]
def browse_external_transfer_files(self):
        path = QFileDialog().getExistingDirectory(
            caption="Select transfer files folder",
            directory=QDir().homePath(),
            options=QFileDialog.ShowDirsOnly | QFileDialog.DontResolveSymlinks)

        if path:
            self.transferFilesPathLineEdit.setText(path) 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:10,代码来源:settings_dialog.py

示例6: do_search

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QDir [as 别名]
def do_search(self):
        #print(f'Beginning search for: {self.term}')
        root = qtc.QDir.rootPath()
        self._search(self.term, root)
        self.finished.emit() 
开发者ID:PacktPublishing,项目名称:Mastering-GUI-Programming-with-Python,代码行数:7,代码来源:file_searcher.py

示例7: _search

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QDir [as 别名]
def _search(self, term, path):
        self.directory_changed.emit(path)
        directory = qtc.QDir(path)
        directory.setFilter(
            directory.filter() |
            qtc.QDir.NoDotAndDotDot |
            qtc.QDir.NoSymLinks
        )
        for entry in directory.entryInfoList():
            if term in entry.filePath():
                print(entry.filePath())
                self.match_found.emit(entry.filePath())
            if entry.isDir():
                self._search(term, entry.filePath()) 
开发者ID:PacktPublishing,项目名称:Mastering-GUI-Programming-with-Python,代码行数:16,代码来源:file_searcher.py

示例8: do_hashing

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QDir [as 别名]
def do_hashing(self, source, destination, threads):
        self.pool.setMaxThreadCount(threads)
        qdir = qtc.QDir(source)
        for filename in qdir.entryList(qtc.QDir.Files):
            filepath = qdir.absoluteFilePath(filename)
            runner = HashRunner(filepath, destination)
            self.pool.start(runner)

        # This call is why we put HashManager in its own thread.
        # If we don't care about being notified when the process is done,
        # we could leave this out and run HashManager in the main thread.
        self.pool.waitForDone()
        self.finished.emit() 
开发者ID:PacktPublishing,项目名称:Mastering-GUI-Programming-with-Python,代码行数:15,代码来源:hasher.py

示例9: run

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QDir [as 别名]
def run(self):
        #print(f'Beginning search for: {self.term}')
        root = qtc.QDir.rootPath()
        self._search(self.term, root)
        self.finished.emit() 
开发者ID:PacktPublishing,项目名称:Mastering-GUI-Programming-with-Python,代码行数:7,代码来源:file_searcher_subclassed.py

示例10: initUI

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QDir [as 别名]
def initUI(self):

        self.setStyleSheet('background-color: silver')
        mod_path = os.path.dirname(Pythonic.__file__)
        image_folder = QDir('images')

        self.layout_h = QHBoxLayout()

        self.op_tool = MasterTool(self, 'ExecOp', 1)
        self.op_tool.setPixmap(QPixmap(join(mod_path, 'images/ExecOp.png')).scaled(120, 60))

        self.branch_tool = MasterTool(self, 'ExecBranch', 2)
        self.branch_tool.setPixmap(QPixmap(join(mod_path, 'images/ExecBranch.png')).scaled(120, 60))

        self.return_tool = MasterTool(self, 'ExecReturn', 0)
        self.return_tool.setPixmap(QPixmap(join(mod_path, 'images/ExecReturn.png')).scaled(120, 60))

        self.proc_tool = MasterTool(self, 'ExecProcess', 2)
        self.proc_tool.setPixmap(QPixmap(join(mod_path, 'images/ExecProcess.png')).scaled(120, 60))

        self.ta_tool = MasterTool(self, 'ExecTA', 1)
        self.ta_tool.setPixmap(QPixmap(join(mod_path, 'images/ExecTA.png')).scaled(120, 60))

        self.sched_tool = MasterTool(self, 'ExecSched', 1)
        self.sched_tool.setPixmap(QPixmap(join(mod_path, 'images/ExecSched.png')).scaled(120, 60))

        self.stack_tool = MasterTool(self, 'ExecStack', 1)
        self.stack_tool.setPixmap(QPixmap(join(mod_path, 'images/ExecStack.png')).scaled(120, 60))

        self.layout_h.addWidget(self.op_tool)
        self.layout_h.addWidget(self.branch_tool)
        self.layout_h.addWidget(self.return_tool)
        self.layout_h.addWidget(self.proc_tool)
        self.layout_h.addWidget(self.ta_tool)
        self.layout_h.addWidget(self.sched_tool)
        self.layout_h.addWidget(self.stack_tool)
        self.layout_h.addStretch(1)

        self.setLayout(self.layout_h) 
开发者ID:hANSIc99,项目名称:Pythonic,代码行数:41,代码来源:basictools.py

示例11: initUI

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QDir [as 别名]
def initUI(self):

        self.setStyleSheet('background-color: silver')
        mod_path = os.path.dirname(Pythonic.__file__)
        """
        image_folder = QDir('images')

        if not image_folder.exists():
            logging.error('Image foulder not found')
            sys.exit(1)
        """
            
        self.layout_h = QHBoxLayout()

        self.svm = MasterTool(self, 'MLSVM', 1)
        self.svm.setPixmap(QPixmap(os.path.join(mod_path, 'images/MLSVM.png')).scaled(120, 60))

        self.svm_predict = MasterTool(self, 'MLSVM_Predict', 1)
        self.svm_predict.setPixmap(QPixmap(os.path.join(mod_path, 'images/MLSVM_Predict.png')).scaled(120, 60))


        self.layout_h.addWidget(self.svm)
        self.layout_h.addWidget(self.svm_predict)
        self.layout_h.addStretch(1)

        self.setLayout(self.layout_h) 
开发者ID:hANSIc99,项目名称:Pythonic,代码行数:28,代码来源:mltools.py

示例12: loadClicked

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QDir [as 别名]
def loadClicked(self):
        """
        The user has selected the "load from file" option. Prompt for a file
        location and load the wallet.
        """
        fd = QtWidgets.QFileDialog(self, "select wallet file")
        fd.setViewMode(QtWidgets.QFileDialog.Detail)
        qdir = QtCore.QDir
        fd.setFilter(qdir.Dirs | qdir.Files | qdir.NoDotAndDotDot | qdir.Hidden)
        noFileMsg = "no file selected"
        if fd.exec_():
            fileNames = fd.selectedFiles()
            if len(fileNames) != 1:
                msg = "more than one file selected for importing"
                logError(msg)
                return
        else:
            log.info(noFileMsg)
            return
        walletPath = fileNames[0]
        log.debug(f"loading wallet from {walletPath}")
        if walletPath == "":
            logError(noFileMsg)
            return
        elif not os.path.isfile(walletPath):
            msg = f"no file found at {walletPath}"
            logError(msg)
            return
        elif not database.isSqlite3DB(walletPath):
            logError(f"{walletPath} is not a sqlite3 database")
            return

        destination = app.walletFilename()
        shutil.copy(walletPath, destination)
        app.initialize() 
开发者ID:decred,项目名称:tinydecred,代码行数:37,代码来源:screens.py

示例13: onOpen

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QDir [as 别名]
def onOpen(self):
		dialog = QtWidgets.QFileDialog()
		curDir = QtCore.QDir()
		curPath = curDir.currentPath()
		dbPath = dialog.getOpenFileName(self, 'Open Database', curDir.currentPath())
		if dbPath:
			dbmgr = DBManager.DBManager.instance()
			dbmgr.openDB(dbPath[0])

			from UIManager import UIManager
			symScene = UIManager.instance().getSymbolScene() 
开发者ID:league1991,项目名称:CodeAtlasSublime,代码行数:13,代码来源:mainwindow.py

示例14: onOpenPath

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QDir [as 别名]
def onOpenPath(self, param):
		dialog = QtWidgets.QFileDialog()
		curDir = QtCore.QDir()
		curPath = curDir.currentPath()
		if param and False:
			curPath = param[0]
		dbPath = dialog.getOpenFileName(self, 'Open Database', curPath)
		if dbPath:
			dbmgr = DBManager.DBManager.instance()
			dbmgr.getDB().open(dbPath)
			from UIManager import UIManager
			symScene = UIManager.instance().getSymbolScene() 
开发者ID:league1991,项目名称:CodeAtlasSublime,代码行数:14,代码来源:mainwindow.py

示例15: dropEvent

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QDir [as 别名]
def dropEvent(self, event):
        event.ignore()
        return
        if event.source():
            QTreeView.dropEvent(self, event)
        else:
            ix = self.indexAt(event.pos())
            if not self.model().isDir(ix):
                ix = ix.parent()
            pathDir = self.model().filePath(ix)
            if not pathDir:
                pathDir = self.model().filePath(self.rootIndex())
            m = event.mimeData()
            if m.hasUrls():
                urlLocals = [url for url in m.urls() if url.isLocalFile()]
                accepted = False
                for urlLocal in urlLocals:
                    path = urlLocal.toLocalFile()
                    info = QFileInfo(path)
                    n_path = QDir(pathDir).filePath(info.fileName())
                    o_path = info.absoluteFilePath()
                    if n_path == o_path:
                        continue
                    if info.isDir():
                        if QDir(n_path).exists():
                            reply = QMessageBox.question(self, '提示', '所选的分组中存在同名文件夹,是否全部覆盖?',
                                                         QMessageBox.Yes | QMessageBox.No)
                            if reply == QMessageBox.Yes:
                                shutil.rmtree(n_path)
                                shutil.copytree(o_path, n_path)
                        else:
                            print(o_path)
                            for file in os.walk(o_path):
                                print(file)
                            shutil.copytree(o_path, n_path)
                            self.strategy_filters.append(os.path.split(n_path)[1])
                            self._model.setNameFilters(self.strategy_filters)
                    else:
                        qfile = QFile(o_path)
                        fname = qfile.fileName()
                        if not fname.endswith('.py'):
                            QMessageBox.warning(self, "提示", "暂不支持该类型文件", QMessageBox.Yes)
                        if QFile(n_path).exists():
                            reply = QMessageBox.question(self, '提示', '所选的分组中存在同名文件,是否覆盖?',
                                                         QMessageBox.Yes | QMessageBox.No)
                            if reply == QMessageBox.Yes:
                                shutil.copy(o_path, n_path)
                        # qfile.rename(n_path)
                    accepted = True
                if accepted:
                    event.acceptProposedAction() 
开发者ID:epolestar,项目名称:equant,代码行数:53,代码来源:utils.py


注:本文中的PyQt5.QtCore.QDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。