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


Python QDir.homePath方法代码示例

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


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

示例1: read_path_and_show_one_image

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

        hyperlpr_dir_info_filepath = QDir.homePath() + "/hyperlpr_dir_file"
        if os.path.exists(hyperlpr_dir_info_filepath):
            with open(hyperlpr_dir_info_filepath, 'r') as f:
                self.hyperlpr_dir_path = f.read()

        if len(self.hyperlpr_dir_path) > 0:
            self.reset_info_gui()

        if len(self.image_filename_list) > 0:
            self.recognize_and_show_one_image(self.image_filename_list[0], 0) 
开发者ID:fanghon,项目名称:lpr,代码行数:14,代码来源:HyperLprGUI.py

示例2: select_new_dir

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

        self.hyperlpr_dir_path = QFileDialog.getExistingDirectory(
            self, "读取文件夹", QDir.currentPath())

        if len(self.hyperlpr_dir_path) > 0:
            hyperlpr_dir_info_filepath = QDir.homePath() + "/hyperlpr_dir_file"
            with open(hyperlpr_dir_info_filepath, 'w') as f:
                f.write(self.hyperlpr_dir_path)
            self.reset_info_gui() 
开发者ID:fanghon,项目名称:lpr,代码行数:12,代码来源:HyperLprGUI.py

示例3: setPath

# 需要导入模块: from PyQt5.QtCore import QDir [as 别名]
# 或者: from PyQt5.QtCore.QDir import homePath [as 别名]
def setPath(self, backend: str, field: QLineEdit) -> None:
        path = field.text()
        if path is None or not len(path):
            path = self.parent.parent.lastFolder if os.path.exists(self.parent.parent.lastFolder) else QDir.homePath()
        selectedpath, _ = QFileDialog.getOpenFileName(
            self,
            caption='Set {} path'.format(backend),
            directory=path,
            options=self.parent.parent.getFileDialogOptions())
        if selectedpath is not None and os.path.isfile(selectedpath) and os.access(selectedpath, os.X_OK):
            self.parent.service.backends[backend.lower()] = selectedpath
            self.parent.settings.setValue('tools/{}'.format(backend.lower()), selectedpath)
            field.setText(selectedpath) 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:15,代码来源:settings.py

示例4: getSettingsPath

# 需要导入模块: from PyQt5.QtCore import QDir [as 别名]
# 或者: from PyQt5.QtCore.QDir import homePath [as 别名]
def getSettingsPath() -> str:
        if sys.platform == 'win32':
            settings_path = os.path.join(QDir.homePath(), 'AppData', 'Local', 'vidcutter')
        elif sys.platform == 'darwin':
            settings_path = os.path.join(QDir.homePath(), 'Library', 'Preferences', 'vidcutter')
        else:
            if QFileInfo(__file__).absolutePath().startswith('/app/'):
                settings_path = QProcessEnvironment.systemEnvironment().value('XDG_CONFIG_HOME', '')
                if not len(settings_path):
                    settings_path = os.path.join(QDir.homePath(), '.var', 'app', vidcutter.__desktopid__, 'config')
            else:
                settings_path = os.path.join(QDir.homePath(), '.config', 'vidcutter')
        return os.path.join(settings_path, 'vidcutter.ini') 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:15,代码来源:singleapplication.py

示例5: on_btn_choose_command_clicked

# 需要导入模块: from PyQt5.QtCore import QDir [as 别名]
# 或者: from PyQt5.QtCore.QDir import homePath [as 别名]
def on_btn_choose_command_clicked(self):
        file_name, ok = QFileDialog.getOpenFileName(self, self.tr("Choose program"), QDir.homePath())

        if file_name is not None and ok:
            self.ui.lineEditTriggerCommand.setText(file_name) 
开发者ID:jopohl,项目名称:urh,代码行数:7,代码来源:SimulatorTabController.py

示例6: choose_decoder

# 需要导入模块: from PyQt5.QtCore import QDir [as 别名]
# 或者: from PyQt5.QtCore.QDir import homePath [as 别名]
def choose_decoder(self):
        f, ok = QFileDialog.getOpenFileName(self, self.tr("Choose decoder program"), QDir.homePath())
        if f and ok:
            self.ui.external_decoder.setText(f)
            self.handle_external() 
开发者ID:jopohl,项目名称:urh,代码行数:7,代码来源:DecoderDialog.py

示例7: choose_encoder

# 需要导入模块: from PyQt5.QtCore import QDir [as 别名]
# 或者: from PyQt5.QtCore.QDir import homePath [as 别名]
def choose_encoder(self):
        f, ok = QFileDialog.getOpenFileName(self, self.tr("Choose encoder program"), QDir.homePath())
        if f and ok:
            self.ui.external_encoder.setText(f)
            self.handle_external() 
开发者ID:jopohl,项目名称:urh,代码行数:7,代码来源:DecoderDialog.py

示例8: close_project

# 需要导入模块: from PyQt5.QtCore import QDir [as 别名]
# 或者: from PyQt5.QtCore.QDir import homePath [as 别名]
def close_project(self):
        self.save_project()
        self.close_all_files()
        self.compare_frame_controller.proto_analyzer.message_types.clear()
        self.compare_frame_controller.active_message_type.clear()
        self.compare_frame_controller.updateUI()
        self.project_manager.participants.clear()
        self.participant_legend_model.update()

        self.filemodel.setRootPath(QDir.homePath())
        self.ui.fileTree.setRootIndex(self.file_proxy_model.mapFromSource(self.filemodel.index(QDir.homePath())))
        self.hide_file_tree()

        self.project_manager.project_path = ""
        self.project_manager.project_file = None 
开发者ID:jopohl,项目名称:urh,代码行数:17,代码来源:MainController.py

示例9: get_directory

# 需要导入模块: from PyQt5.QtCore import QDir [as 别名]
# 或者: from PyQt5.QtCore.QDir import homePath [as 别名]
def get_directory():
    directory = QFileDialog.getExistingDirectory(None, "Choose Directory", QDir.homePath(),
                                                 QFileDialog.ShowDirsOnly | QFileDialog.DontResolveSymlinks)
    return directory 
开发者ID:jopohl,项目名称:urh,代码行数:6,代码来源:FileOperator.py

示例10: __init__

# 需要导入模块: from PyQt5.QtCore import QDir [as 别名]
# 或者: from PyQt5.QtCore.QDir import homePath [as 别名]
def __init__(self, tasmota_env):
        super().__init__()
        self.settings = QSettings("{}/TDM/tdm.cfg".format(QDir.homePath()), QSettings.IniFormat)
        self.devices = QSettings("{}/TDM/devices.cfg".format(QDir.homePath()), QSettings.IniFormat)
        self.tasmota_env = tasmota_env
        self.columns = []

        self.devices_short_version = self.settings.value("devices_short_version", True, bool)

        for d in self.tasmota_env.devices:
            d.property_changed = self.notify_change
            d.module_changed = self.module_change 
开发者ID:jziolkowski,项目名称:tdm,代码行数:14,代码来源:models.py

示例11: save_dump

# 需要导入模块: from PyQt5.QtCore import QDir [as 别名]
# 或者: from PyQt5.QtCore.QDir import homePath [as 别名]
def save_dump(self):
        fname = self.dl.header(QNetworkRequest.ContentDispositionHeader)
        if fname:
            fname = fname.split('=')[1]
            save_file = QFileDialog.getSaveFileName(self, "Save config backup", "{}/TDM/{}".format(QDir.homePath(), fname))[0]
            if save_file:
                with open(save_file, "wb") as f:
                    f.write(self.backup) 
开发者ID:jziolkowski,项目名称:tdm,代码行数:10,代码来源:Devices.py

示例12: save_console

# 需要导入模块: from PyQt5.QtCore import QDir [as 别名]
# 或者: from PyQt5.QtCore.QDir import homePath [as 别名]
def save_console(self):
        new_fname = "{}/TDM/{} {}.log".format(QDir.homePath(), self.device.p["FriendlyName1"], datetime.now().strftime("%Y%m%d-%H%M%S"))
        file, ok = QFileDialog.getSaveFileName(self, "Save console", new_fname, "Log files | *.log")
        if ok:
            with open(file, "w") as f:
                f.write(self.console.toPlainText()) 
开发者ID:jziolkowski,项目名称:tdm,代码行数:8,代码来源:Console.py

示例13: export

# 需要导入模块: from PyQt5.QtCore import QDir [as 别名]
# 或者: from PyQt5.QtCore.QDir import homePath [as 别名]
def export(self):
        fname, _ = QFileDialog.getSaveFileName(self, "Export device list as...", directory=QDir.homePath(), filter="CSV files (*.csv)")
        if fname:
            if not fname.endswith(".csv"):
                fname += ".csv"

            with open(fname, "w", encoding='utf8') as f:
                column_titles = ['mac', 'topic', 'friendly_name', 'full_topic', 'cmnd_topic', 'stat_topic', 'tele_topic', 'module', 'module_id', 'firmware', 'core']
                c = csv.writer(f)
                c.writerow(column_titles)

                for r in range(self.device_model.rowCount()):
                    d = self.device_model.index(r,0)
                    c.writerow([
                        self.device_model.mac(d),
                        self.device_model.topic(d),
                        self.device_model.friendly_name(d),
                        self.device_model.fullTopic(d),
                        self.device_model.commandTopic(d),
                        self.device_model.statTopic(d),
                        self.device_model.teleTopic(d),
                        # modules.get(self.device_model.module(d)),
                        self.device_model.module(d),
                        self.device_model.firmware(d),
                        self.device_model.core(d)
                    ]) 
开发者ID:jziolkowski,项目名称:tdm,代码行数:28,代码来源:tdmgr.py

示例14: __init__

# 需要导入模块: from PyQt5.QtCore import QDir [as 别名]
# 或者: from PyQt5.QtCore.QDir import homePath [as 别名]
def __init__(self, *args, **kwargs):
        super(BSSIdDialog, self).__init__(*args, **kwargs)
        self.setMinimumHeight(400)
        self.setMinimumWidth(400)
        self.setWindowTitle("BSSId aliases")

        self.settings = QSettings("{}/TDM/tdm.cfg".format(QDir.homePath()), QSettings.IniFormat)
        self.settings.beginGroup("BSSId")

        vl = VLayout()
        cols = ["BSSId", "Alias"]
        self.tw = QTableWidget(0,2)
        self.tw.setHorizontalHeaderLabels(cols)
        self.tw.verticalHeader().hide()

        for c in range(2):
            self.tw.horizontalHeader().setSectionResizeMode(c, QHeaderView.Stretch)

        for k in self.settings.childKeys():
            row = self.tw.rowCount()
            self.tw.insertRow(row)
            self.tw.setItem(row, 0, QTableWidgetItem(k))
            self.tw.setItem(row, 1, QTableWidgetItem(self.settings.value(k)))

        vl.addWidget(self.tw)

        hl_btns = HLayout([0,3,0,3])
        btnAdd = QPushButton("Add")
        btnDel = QPushButton("Delete")
        btnCancel = QPushButton("Cancel")
        btnSave = QPushButton("Save")
        hl_btns.addWidgets([btnAdd, btnDel, btnSave, btnCancel])
        hl_btns.insertStretch(2)
        vl.addLayout(hl_btns)

        self.setLayout(vl)

        self.idx = None
        self.tw.clicked.connect(self.select)
        btnAdd.clicked.connect(self.add)
        btnDel.clicked.connect(self.delete)
        btnSave.clicked.connect(self.accept)
        btnCancel.clicked.connect(self.reject) 
开发者ID:jziolkowski,项目名称:tdm,代码行数:45,代码来源:BSSID.py

示例15: __init__

# 需要导入模块: from PyQt5.QtCore import QDir [as 别名]
# 或者: from PyQt5.QtCore.QDir import homePath [as 别名]
def __init__(self, *args, **kwargs):
        super(PrefsDialog, self).__init__(*args, **kwargs)
        self.setWindowTitle("Preferences")
        # self.setMinimumSize(QSize(300, 200))

        self.settings = QSettings("{}/TDM/tdm.cfg".format(QDir.homePath()), QSettings.IniFormat)

        self.devices_short_version = self.settings.value("devices_short_version", True, bool)

        self.console_word_wrap = self.settings.value("console_word_wrap", True, bool)
        self.console_font_size = self.settings.value("console_font_size", 9, int)

        vl = VLayout()

        gbDevices = QGroupBox("Device list")
        fl_dev = QFormLayout()

        self.cbDevShortVersion = QCheckBox()
        self.cbDevShortVersion.setChecked(self.devices_short_version)

        fl_dev.addRow("Show short Tasmota version", self.cbDevShortVersion)

        fl_dev.setAlignment(self.cbDevShortVersion, Qt.AlignTop | Qt.AlignRight)

        gbDevices.setLayout(fl_dev)

        gbConsole = QGroupBox("Console")
        fl_cons = QFormLayout()

        self.cbConsWW = QCheckBox()
        self.cbConsWW.setChecked(self.console_word_wrap)

        self.sbConsFontSize = SpinBox(minimum=9, maximum=100)
        self.sbConsFontSize.setValue(self.console_font_size)

        gbConsole.setLayout(fl_cons)

        fl_cons.addRow("Word wrap", self.cbConsWW)
        fl_cons.addRow("Font size", self.sbConsFontSize)

        fl_cons.setAlignment(self.cbConsWW, Qt.AlignTop | Qt.AlignRight)
        fl_cons.setAlignment(self.sbConsFontSize, Qt.AlignTop | Qt.AlignRight)

        btns = QDialogButtonBox(QDialogButtonBox.Save | QDialogButtonBox.Close)
        btns.accepted.connect(self.accept)
        btns.rejected.connect(self.reject)

        vl.addWidgets([gbDevices, gbConsole, btns])

        self.setLayout(vl) 
开发者ID:jziolkowski,项目名称:tdm,代码行数:52,代码来源:Prefs.py


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