python类getOpenFileName()的实例源码

uamodeler.py 文件源码 项目:opcua-modeler 作者: FreeOpcUa 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def open(self):
        if not self.try_close_model():
            return
        path, ok = QFileDialog.getOpenFileName(self.modeler, caption="Open OPC UA XML", filter="XML Files (*.xml *.XML)", directory=self._last_model_dir)
        if not ok:
            return
        if self._last_model_dir != os.path.dirname(path):
            self._last_model_dir = os.path.dirname(path)
            self.settings.setValue("last_model_dir", self._last_model_dir)
        self._model_mgr.open_model(path)
uamodeler.py 文件源码 项目:opcua-modeler 作者: FreeOpcUa 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def import_xml(self):
        last_import_dir = self.settings.value("last_import_dir", ".")
        path, ok = QFileDialog.getOpenFileName(self.modeler, caption="Import reference OPC UA XML", filter="XML Files (*.xml *.XML)", directory=last_import_dir)
        if not ok:
            return None
        self.settings.setValue("last_import_dir", last_import_dir)
        self._model_mgr.import_xml(path)
backgroundWindow.py 文件源码 项目:Py2DSpectroscopy 作者: SvenBo90 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def cb_file_browse_push_button(self):

        # get file name
        file_name = QFileDialog.getOpenFileName(self._app.windows['backgroundWindow'], 'Select File', '')
        file_name = file_name[0]

        # check if a file has been selected
        if file_name == '':
            return

        # set file name to line edit
        self.ui.file_path_line_edit.setText(file_name)
input.py 文件源码 项目:climate 作者: FIDS-UWO 项目源码 文件源码 阅读 65 收藏 0 点赞 0 评论 0
def cfm_get_obs_file(self):
        fl, _ = QFileDialog.getOpenFileName(self, "Select Observed File",
                                            filter="CSV files (*.csv)")
        self.ui.observedFileEdit.setText(fl)
input.py 文件源码 项目:climate 作者: FIDS-UWO 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def cfm_get_his_file(self):
        fl, _ = QFileDialog.getOpenFileName(self,
                                            "Select Historical GCM File",
                                            filter="CSV files (*.csv)")
        self.ui.historicalFileEdit.setText(fl)
input.py 文件源码 项目:climate 作者: FIDS-UWO 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def cfm_get_fut_file(self):
        fl, _ = QFileDialog.getOpenFileName(self, "Select Future GCM File",
                                            filter="CSV files (*.csv)")
        self.ui.futureFileEdit.setText(fl)
input.py 文件源码 项目:climate 作者: FIDS-UWO 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def knn_get_input_file(self):
        fl, _ = QFileDialog.getOpenFileName(self, "Select Input File",
                                            filter="CSV files (*.csv)")
        self.ui.knnInputEdit.setText(fl)
lecture11_file_dialog.py 文件源码 项目:ITC110 作者: SeattleCentral 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def openFileNameDialog(self):    
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        fileName, _ = QFileDialog.getOpenFileName(self,"QFileDialog.getOpenFileName()", "","All Files (*);;Python Files (*.py)", options=options)
        if fileName:
            print(fileName)
mainwindow.py 文件源码 项目:solar-sails 作者: metrasynth 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def on_action_import_parameter_values_triggered(self):
        with self.catcher.more:
            filename, _ = QFileDialog.getOpenFileName(
                parent=self,
                caption='Import Parameter Values',
                directory='.',
                filter='Supported Files (*.sunsynth *.sunvox)',
            )
            if filename:
                obj = rv.read_sunvox_file(filename)
                if isinstance(obj, rv.Project):
                    project = obj
                elif isinstance(obj, rv.Synth) and isinstance(obj.module, rv.m.MetaModule):
                    project = obj.module.project
                else:
                    print('{} is not a project or metamodule'.format(filename))
                    return
                mmckdata = None
                for mod in reversed(project.modules):
                    if mod.name == 'mmckdata':
                        mmckdata = mod
                        break
                if not mmckdata:
                    print('Could not find mmckdata module in {}'.format(filename))
                    return
                params = json.loads(mmckdata.samples[-2].data.decode('utf8'))
                self.kit.parameter_values.update(params)
                self.parameters_manager.parameters = self.kit.parameters
                self.rebuild_project()
                self.save_kit_parameter_values()
                if hasattr(self.kit.py_module, 'udc_assignments'):
                    self.update_udc_assignments(self.kit.py_module.udc_assignments(self.kit.parameter_values))
                print('Imported parameter values from {}'.format(filename))
opener.py 文件源码 项目:solar-sails 作者: metrasynth 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def requested_filename(self, directory='.'):
        return QFileDialog.getOpenFileName(
            parent=self.parent,
            caption=self.caption,
            directory=directory,
            filter=self.filter(),
        )
pyqthelperfunctions.py 文件源码 项目:RigIt 作者: the4chancup 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def getOpenFileName(parent=None, dir=None, filter=None, caption=None):
    if (dir == None):
        dir = QDir.currentPath()
    if (filter == None):
        filter = 'File (*.*)'
    filename = QFileDialog.getOpenFileName(parent, caption, dir, filter)
    if (filename == ('', '')): # two null strings for cancel
        return None
    return filename[0]
gui.py 文件源码 项目:Frida 作者: Alejandro-Valdes 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def Open(self):
        filename = QFileDialog.getOpenFileName(self, 'Open File')
        f = open(filename, 'r')
        filedata = f.read()
        self.text.getTextEdit().setText(filedata)
        f.close()
full.py 文件源码 项目:GUI-for-EWBF 作者: K4P11 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def openFileNameDialog(self):    
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog

        fileName, _ = QFileDialog.getOpenFileName(self,"QFileDialog.getOpenFileName()", "","All Files (*);;Python Files (*.py)", options=options)
        if fileName:
            return str(fileName)
        else:
            return 'Path to the file used to start miner'
CSVImportDialogController.py 文件源码 项目:urh 作者: jopohl 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def on_btn_choose_file_clicked(self):
        filename, _ = QFileDialog.getOpenFileName(self, self.tr("Choose file"), directory=FileOperator.RECENT_PATH,
                                                  filter="CSV files (*.csv);;All files (*.*)")

        if filename:
            self.ui.lineEditFilename.setText(filename)
            self.ui.lineEditFilename.editingFinished.emit()
run_gui.py 文件源码 项目:ClassifyHub 作者: Top-Ranger 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def get_file_path(self, title):
        return QFileDialog.getOpenFileName(None, title)[0]

    ##
    # \brief Qt slot for check_user_and_secret().
    #
    # Tests if user/secret file is setup correctly and shows error message if not.
widgets.py 文件源码 项目:BigBrotherBot-For-UrT43 作者: ptitbigorneau 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def new_process_dialog(self):
        """
        Open the File dialog used to select a B3 configuration file.
        """
        self.make_visible()
        init = b3.getAbsolutePath('@b3/conf')
        extensions = ['INI (*.ini)', 'XML (*.xml)', 'All Files (*.*)']
        path, _ = QFileDialog.getOpenFileName(self.centralWidget(), 'Select configuration file', init, ';;'.join(extensions))
        self.make_new_process(path)
widgets.py 文件源码 项目:BigBrotherBot-For-UrT43 作者: ptitbigorneau 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def install_plugin(self):
        """
        Handle the install of a new B3 plugin.
        """
        self.make_visible()
        init = b3.getAbsolutePath('~')
        path, _ = QFileDialog.getOpenFileName(self.centralWidget(), 'Select plugin package', init, 'ZIP (*.zip)')
        if path:
            install = PluginInstallDialog(self.centralWidget(), path)
            install.show()
amazfit_exporter_gui.py 文件源码 项目:amazfit_exporter 作者: botmakerdvd 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def but_select_orig_clicked(self):
        self.text_path_orig.setText(QFileDialog.getOpenFileName()[0])
import_lyrics_wizard.py 文件源码 项目:songscreen 作者: maccesch 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def _old_epub_dialog(self):
        self.old_epub = QFileDialog.getOpenFileName(self, self.tr("Open EPUB"), "", "EPUB (*.epub)")[0]
        if self.old_epub:
            self.old_epub_button.setText(os.path.basename(self.old_epub))
        else:
            self.old_epub_button.setText(self.tr("Select File..."))
        self.completeChanged.emit()
import_lyrics_wizard.py 文件源码 项目:songscreen 作者: maccesch 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _new_epub_dialog(self):
        self.new_epub = QFileDialog.getOpenFileName(self, self.tr("Open EPUB"), "", "EPUB (*.epub)")[0]
        if self.new_epub:
            self.new_epub_button.setText(os.path.basename(self.new_epub))
        else:
            self.new_epub_button.setText(self.tr("Select File..."))
        self.completeChanged.emit()


问题


面经


文章

微信
公众号

扫码关注公众号