Python PyQt5.QtWidgets.QFileDialog() Examples

The following are 30 code examples for showing how to use PyQt5.QtWidgets.QFileDialog(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .

Example 1
Project: nanovna-saver   Author: NanoVNA-Saver   File: CalibrationSettings.py    License: GNU General Public License v3.0 7 votes vote down vote up
def saveCalibration(self):
        if not self.app.calibration.isCalculated:
            logger.debug("Attempted to save an uncalculated calibration.")
            self.app.showError("Cannot save an unapplied calibration state.")
            return
        filedialog = QtWidgets.QFileDialog(self)
        filedialog.setDefaultSuffix("cal")
        filedialog.setNameFilter("Calibration Files (*.cal);;All files (*.*)")
        filedialog.setAcceptMode(QtWidgets.QFileDialog.AcceptSave)
        selected = filedialog.exec()
        if selected:
            filename = filedialog.selectedFiles()[0]
        else:
            return
        if filename == "":
            logger.debug("No file name selected.")
            return
        self.app.calibration.notes = self.notes_textedit.toPlainText().splitlines()
        try:
            self.app.calibration.save(filename)
            self.app.settings.setValue("CalibrationFile", filename)
        except IOError:
            logger.error("Calibration save failed!")
            self.app.showError("Calibration save failed.") 
Example 2
Project: simnibs   Author: simnibs   File: main_gui.py    License: GNU General Public License v3.0 6 votes vote down vote up
def openSimulation(self):
        dialog = QtWidgets.QFileDialog(self)
        dialog.setWindowTitle('Open GMSH File')
        dialog.setNameFilter('GMSH files (*.msh)')
        dialog.setDirectory(QtCore.QDir.currentPath())
        dialog.setFileMode(QtWidgets.QFileDialog.ExistingFile)
        if dialog.exec_() == QtWidgets.QDialog.Accepted:
            file_full_path = str(dialog.selectedFiles()[0])

        else:
            return None

        self.thread = openGmshThread(file_full_path)
        self.thread.start()



    #Generates a sim_struct.session() structure, for saving and running 
Example 3
Project: simnibs   Author: simnibs   File: main_gui.py    License: GNU General Public License v3.0 6 votes vote down vote up
def coilDialog(self):
        #get folder with ccd files
        try:
            ccd_folder = os.path.join(SIMNIBSDIR, 'ccd-files')
        except:
            ccd_folder = './'


        dialog = QtWidgets.QFileDialog(self)
        dialog.setWindowTitle('Open Coil Definition File')
        dialog.setNameFilter('Coil Definition files (*.ccd *.nii *.gz)')
        dialog.setDirectory(ccd_folder)
        dialog.setFileMode(QtWidgets.QFileDialog.ExistingFile)
        if dialog.exec_() == QtWidgets.QDialog.Accepted:
            fn = str(dialog.selectedFiles()[0])
        else:
            return None

        self.tmslist.fnamecoil = fn
        self.coil_line_edit.setText(fn) 
Example 4
Project: simnibs   Author: simnibs   File: simulation_menu.py    License: GNU General Public License v3.0 6 votes vote down vote up
def selectFile(self):
        if self.fname is not None and os.path.isfile(self.fname):
            eeg_cap_dir = os.path.dirname(self.fname)
        else:
            eeg_cap_dir = QtCore.QDir.currentPath()
        dialog = QtWidgets.QFileDialog(self)
        dialog.setWindowTitle('Open EEG Position file')
        dialog.setNameFilter('(*.csv)')
        dialog.setDirectory(eeg_cap_dir)
        dialog.setFileMode(QtWidgets.QFileDialog.ExistingFile)
        filename = None
        if dialog.exec_() == QtWidgets.QDialog.Accepted:
            filename = dialog.selectedFiles()
        if filename:
            self.fname = str(filename[0])
            self.group_box.lineEdit.setText(self.fname) 
Example 5
Project: dottorrent-gui   Author: kz26   File: gui.py    License: GNU General Public License v3.0 6 votes vote down vote up
def createTorrent(self):
        if os.path.isfile(self.inputEdit.text()):
            save_fn = os.path.splitext(
                os.path.split(self.inputEdit.text())[1])[0] + '.torrent'
        else:
            save_fn = self.inputEdit.text().split(os.sep)[-1] + '.torrent'
        if self.last_output_dir and os.path.exists(self.last_output_dir):
            save_fn = os.path.join(self.last_output_dir, save_fn)
        fn = QtWidgets.QFileDialog.getSaveFileName(
            self.MainWindow, 'Save torrent', save_fn,
            filter=('Torrent file (*.torrent)'))[0]
        if fn:
            self.last_output_dir = os.path.split(fn)[0]
            self.creation_thread = CreateTorrentQThread(
                self.torrent,
                fn)
            self.creation_thread.started.connect(
                self.creation_started)
            self.creation_thread.progress_update.connect(
                self._progress_update)
            self.creation_thread.finished.connect(
                self.creation_finished)
            self.creation_thread.onError.connect(
                self._showError)
            self.creation_thread.start() 
Example 6
Project: dottorrent-gui   Author: kz26   File: gui.py    License: GNU General Public License v3.0 6 votes vote down vote up
def export_profile(self):

        fn = QtWidgets.QFileDialog.getSaveFileName(
            self.MainWindow, 'Save profile', self.last_output_dir,
            filter=('JSON configuration file (*.json)'))[0]
        if fn:
            exclude = self.excludeEdit.toPlainText().strip().splitlines()
            trackers = self.trackerEdit.toPlainText().strip().split()
            web_seeds = self.webSeedEdit.toPlainText().strip().split()
            private = self.privateTorrentCheckBox.isChecked()
            compute_md5 = self.md5CheckBox.isChecked()
            source = self.sourceEdit.text()
            data = {
                'exclude': exclude,
                'trackers': trackers,
                'web_seeds': web_seeds,
                'private': private,
                'compute_md5': compute_md5,
                'source': source
            }
            with open(fn, 'w') as f:
                json.dump(data, f, indent=4, sort_keys=True)
            self._statusBarMsg("Profile saved to " + fn) 
Example 7
Project: dottorrent-gui   Author: kz26   File: gui.py    License: GNU General Public License v3.0 6 votes vote down vote up
def import_profile(self):
        fn = QtWidgets.QFileDialog.getOpenFileName(
            self.MainWindow, 'Open profile', self.last_input_dir,
            filter=('JSON configuration file (*.json)'))[0]
        if fn:
            with open(fn) as f:
                data = json.load(f)
            exclude = data.get('exclude', [])
            trackers = data.get('trackers', [])
            web_seeds = data.get('web_seeds', [])
            private = data.get('private', False)
            compute_md5 = data.get('compute_md5', False)
            source = data.get('source', '')
            try:
                self.excludeEdit.setPlainText(os.linesep.join(exclude))
                self.trackerEdit.setPlainText(os.linesep.join(trackers))
                self.webSeedEdit.setPlainText(os.linesep.join(web_seeds))
                self.privateTorrentCheckBox.setChecked(private)
                self.md5CheckBox.setChecked(compute_md5)
                self.sourceEdit.setText(source)
            except Exception as e:
                self._showError(str(e))
                return
            self._statusBarMsg("Profile {} loaded".format(
                os.path.split(fn)[1])) 
Example 8
Project: MDT   Author: robbert-harms   File: main.py    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
def _select_file(self):
        graphical_image_filters = [' '.join(el) for el in self._extension_filters] + ['All files (*)']

        open_file, used_filter = QFileDialog().getSaveFileName(caption='Select the output file',
                                                               filter=';;'.join(graphical_image_filters))

        if not any(open_file.endswith(el[0]) for el in self._extension_filters):
            extension_from_filter = list(filter(lambda v: ' '.join(v) == used_filter, self._extension_filters))
            if extension_from_filter:
                extension = extension_from_filter[0][0]
            else:
                extension = self._extension_filters[0][0]

            open_file += '.{}'.format(extension)

        if open_file:
            self.outputFile_box.setText(open_file)
            self._update_ok_button() 
Example 9
Project: MDT   Author: robbert-harms   File: generate_brain_mask_tab.py    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
def _select_image(self):
        initial_dir = self._shared_state.base_dir
        if self.selectedImageText.text() != '':
            initial_dir = self.selectedImageText.text()

        open_file, used_filter = QFileDialog().getOpenFileName(
            caption='Select the 4d diffusion weighted image', directory=initial_dir,
            filter=';;'.join(image_files_filters))

        if os.path.isfile(open_file):
            self.selectedImageText.setText(open_file)
            self._shared_state.base_dir = os.path.dirname(open_file)

            if self.selectedOutputText.text() == '':
                split_path = split_image_path(open_file)
                self.selectedOutputText.setText(os.path.join(split_path[0], split_path[1] + '_mask' + split_path[2])) 
Example 10
Project: CQ-editor   Author: CadQuery   File: test_app.py    License: Apache License 2.0 6 votes vote down vote up
def main_multi(qtbot,mocker):

    mocker.patch.object(QMessageBox, 'question', return_value=QMessageBox.Yes)
    mocker.patch.object(QFileDialog, 'getSaveFileName', return_value=('out.step',''))

    win = MainWindow()
    win.show()

    qtbot.addWidget(win)
    qtbot.waitForWindowShown(win)
    
    editor = win.components['editor']
    editor.set_text(code_multi)

    debugger = win.components['debugger']
    debugger._actions['Run'][0].triggered.emit()

    return qtbot, win 
Example 11
Project: nanovna-saver   Author: NanoVNA-Saver   File: CalibrationSettings.py    License: GNU General Public License v3.0 6 votes vote down vote up
def loadCalibration(self):
        filename, _ = QtWidgets.QFileDialog.getOpenFileName(
            filter="Calibration Files (*.cal);;All files (*.*)")
        if filename:
            self.app.calibration.load(filename)
        if not self.app.calibration.isValid1Port():
            return
        for i, name in enumerate(
                ("short", "open", "load", "through", "isolation")):
            self.cal_label[name].setText(
                _format_cal_label(self.app.calibration.data_size(name), "Loaded"))
            if i == 2 and not self.app.calibration.isValid2Port():
                break
        self.calculate()
        self.notes_textedit.clear()
        for note in self.app.calibration.notes:
            self.notes_textedit.appendPlainText(note)
        self.app.settings.setValue("CalibrationFile", filename) 
Example 12
Project: eddy   Author: danielepantaleone   File: workspace.py    License: GNU General Public License v3.0 6 votes vote down vote up
def choosePath(self):
        """
        Bring up a modal window that allows the user to choose a valid workspace path.
        """
        path = self.workspaceField.value()
        if not isPathValid(path):
            path = expandPath('~')

        dialog = QtWidgets.QFileDialog(self)
        dialog.setAcceptMode(QtWidgets.QFileDialog.AcceptOpen)
        dialog.setDirectory(path)
        dialog.setFileMode(QtWidgets.QFileDialog.Directory)
        dialog.setOption(QtWidgets.QFileDialog.ShowDirsOnly, True)
        dialog.setViewMode(QtWidgets.QFileDialog.Detail)

        if dialog.exec_() == QtWidgets.QFileDialog.Accepted:
            self.workspaceField.setValue(first(dialog.selectedFiles())) 
Example 13
Project: eddy   Author: danielepantaleone   File: plugin.py    License: GNU General Public License v3.0 6 votes vote down vote up
def selectPlugin(self):
        """
        Bring up a modal window that allows the user to choose a valid plugin archive.
        """
        path = os.path.dirname(self.pluginField.value())
        if not isPathValid(path):
            path = expandPath('~')

        dialog = QtWidgets.QFileDialog(self)
        dialog.setAcceptMode(QtWidgets.QFileDialog.AcceptOpen)
        dialog.setDirectory(path)
        dialog.setFileMode(QtWidgets.QFileDialog.ExistingFile)
        dialog.setViewMode(QtWidgets.QFileDialog.Detail)
        dialog.setNameFilters([File.Zip.value])

        if dialog.exec_() == QtWidgets.QFileDialog.Accepted:
            self.pluginField.setValue(first(dialog.selectedFiles()))
            self.confirmationBox.setEnabled(not isEmpty(self.pluginField.value())) 
Example 14
Project: eddy   Author: danielepantaleone   File: session.py    License: GNU General Public License v3.0 6 votes vote down vote up
def doExport(self):
        """
        Export the current project.
        """
        if not self.project.isEmpty():
            dialog = QtWidgets.QFileDialog(self)
            dialog.setAcceptMode(QtWidgets.QFileDialog.AcceptSave)
            dialog.setDirectory(expandPath('~/'))
            dialog.setFileMode(QtWidgets.QFileDialog.AnyFile)
            dialog.setNameFilters(sorted(self.ontologyExporterNameFilters() + self.projectExporterNameFilters({File.Graphol})))
            dialog.setViewMode(QtWidgets.QFileDialog.Detail)
            dialog.selectFile(self.project.name)
            dialog.selectNameFilter(File.Owl.value)
            if dialog.exec_():
                filetype = File.valueOf(dialog.selectedNameFilter())
                try:
                    worker = self.createOntologyExporter(filetype, self.project, self)
                except ValueError:
                    worker = self.createProjectExporter(filetype, self.project, self)
                worker.run(expandPath(first(dialog.selectedFiles()))) 
Example 15
Project: eddy   Author: danielepantaleone   File: session.py    License: GNU General Public License v3.0 6 votes vote down vote up
def doSaveAs(self):
        """
        Creates a copy of the currently open diagram.
        """
        diagram = self.mdi.activeDiagram()
        if diagram:
            dialog = QtWidgets.QFileDialog(self)
            dialog.setAcceptMode(QtWidgets.QFileDialog.AcceptSave)
            dialog.setDirectory(expandPath('~/'))
            dialog.setFileMode(QtWidgets.QFileDialog.AnyFile)
            dialog.setNameFilters(self.diagramExporterNameFilters())
            dialog.setViewMode(QtWidgets.QFileDialog.Detail)
            dialog.selectFile(diagram.name)
            dialog.selectNameFilter(File.Pdf.value)
            if dialog.exec_():
                filetype = File.valueOf(dialog.selectedNameFilter())
                worker = self.createDiagramExporter(filetype, diagram, self)
                worker.run(expandPath(first(dialog.selectedFiles()))) 
Example 16
Project: Jade-Application-Kit   Author: codesardine   File: WebEngine.py    License: GNU General Public License v3.0 6 votes vote down vote up
def _download_requested(self, download_item) -> None:
        """
        * If a download is requested call a save file dialog
        * :param download_item: file to be downloaded
        """
        if bindings() == "PyQt5":
            from PyQt5.QtWidgets import QFileDialog
        else:
            from PySide2.QtWidgets import QFileDialog
        dialog = QFileDialog(self)
        path = dialog.getSaveFileName(dialog, "Save File", download_item.path())

        if path[0]:
            download_item.setPath(path[0])
            print(f"downloading file to:( {download_item.path()} )")
            download_item.accept()
            self.download_item = download_item
            download_item.finished.connect(self._download_finished)
        else:
            print("Download canceled") 
Example 17
Project: Jade-Application-Kit   Author: codesardine   File: WebEngine.py    License: GNU General Public License v3.0 6 votes vote down vote up
def _download_requested(self, download_item) -> None:
        """
        * If a download is requested call a save file dialog
        * :param download_item: file to be downloaded
        """
        if bindings() == "PyQt5":
            from PyQt5.QtWidgets import QFileDialog
        else:
            from PySide2.QtWidgets import QFileDialog
        dialog = QFileDialog(self)
        path = dialog.getSaveFileName(dialog, "Save File", download_item.path())

        if path[0]:
            download_item.setPath(path[0])
            print(f"downloading file to:( {download_item.path()} )")
            download_item.accept()
            self.download_item = download_item
            download_item.finished.connect(self._download_finished)
        else:
            print("Download canceled") 
Example 18
Project: bap-ida-python   Author: BinaryAnalysisPlatform   File: bap_trace.py    License: MIT License 6 votes vote down vote up
def __init__(self, parent=None):
        super(TraceFileSelector, self).__init__(parent)
        box = QtWidgets.QHBoxLayout(self)
        label = MonitoringLabel('Trace &file:')
        self.is_ready = label.is_ready
        self.updated = label.updated
        box.addWidget(label)
        self.location = QtWidgets.QLineEdit('incidents')
        self.text = self.location.text
        must_exist = ExistingFileValidator()
        self.location.setValidator(must_exist)
        label.setBuddy(self.location)
        box.addWidget(self.location)
        openfile = QtWidgets.QPushButton(self)
        openfile.setIcon(self.style().standardIcon(
            QtWidgets.QStyle.SP_DialogOpenButton))
        dialog = QtWidgets.QFileDialog(self)
        openfile.clicked.connect(dialog.open)
        dialog.fileSelected.connect(self.location.setText)
        box.addWidget(openfile)
        box.addStretch(1)
        self.setLayout(box) 
Example 19
Project: quick   Author: szsdk   File: quick.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *args, exists = False, file_okay = True, dir_okay= True,  **kwargs):
        super(GFileDialog, self).__init__(*args, **kwargs)
        self.setOption(QtWidgets.QFileDialog.DontUseNativeDialog, True)
        self.setLabelText(QtWidgets.QFileDialog.Accept, "Select")
        if (exists, file_okay, dir_okay) == (True, True, False):
            self.setFileMode(QtWidgets.QFileDialog.ExistingFile)
        elif (exists, file_okay, dir_okay) == (False, True, False):
            self.setFileMode(QtWidgets.QFileDialog.AnyFile)
        elif (exists, file_okay, dir_okay) == (True, False, True):
            self.setFileMode(QtWidgets.QFileDialog.Directory)
        elif (exists, file_okay, dir_okay) == (False, False, True):
            self.setFileMode(QtWidgets.QFileDialog.Directory)
        elif exists == True:
            self.setFileMode(QtWidgets.QFileDialog.ExistingFile)
            self.accept = self.accept_all
        elif exists == False:
            self.setFileMode(QtWidgets.QFileDialog.AnyFile)
            self.accept = self.accept_all 
Example 20
Project: simnibs   Author: simnibs   File: main_gui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def fileDialog(self):
        dialog = QtWidgets.QFileDialog(self)
        dialog.setWindowTitle('Open Mesh File')
        dialog.setNameFilter('gmsh files (*.msh)')
        dialog.setDirectory(QtCore.QDir.currentPath())
        dialog.setFileMode(QtWidgets.QFileDialog.ExistingFile)
        filename = None
        if dialog.exec_() == QtWidgets.QDialog.Accepted:
            filename = dialog.selectedFiles()
        if filename:
            fn = str(filename[0])
            self.file_name.setText(fn)
            self.loadHeadModel(fn)
            self.lookForTensors(fn) 
Example 21
Project: simnibs   Author: simnibs   File: main_gui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def m2mFolderDialog(self):
        folder = str(QtWidgets.QFileDialog.getExistingDirectory(self, "Select Directory"))
        if folder == '':
            return None
        else:
            self.m2m_folder_lineEdit.setText(folder)
            self.session.subpath = folder
            sub_files = SubjectFiles(subpath=folder)
            fn_mesh = sub_files.fnamehead
            if fn_mesh and not self.session.fnamehead:
                self.loadHeadModel(fn_mesh)



    #Defines the dialog for selecting output folder 
Example 22
Project: simnibs   Author: simnibs   File: main_gui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def outFolderDialog(self):
        folder = str( QtWidgets.QFileDialog.getExistingDirectory(self, "Select Directory"))
        if folder == '':
            return None
        else:
            self.out_folder_lineEdit.setText(folder)
            self.session.pathfem = folder
    #Loads the head model in a separate thread 
Example 23
Project: simnibs   Author: simnibs   File: simulation_menu.py    License: GNU General Public License v3.0 5 votes vote down vote up
def selectFile(self):
        if self.fname is not None and os.path.isfile(self.fname):
            directory = self.fname
        else:
            directory = QtCore.QDir.currentPath()
        dialog = QtWidgets.QFileDialog.getOpenFileName(
            self, 'Select tensor conductivity file', directory,  'Tensor files (*.nii *.nii.gz)')
        if dialog[0] != 0:
            self.fname = str(dialog[0])
            self.group_box.lineEdit.setText(str(dialog[0])) 
Example 24
Project: dottorrent-gui   Author: kz26   File: gui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def browseInput(self):
        qfd = QtWidgets.QFileDialog(self.MainWindow)
        if self.last_input_dir and os.path.exists(self.last_input_dir):
            qfd.setDirectory(self.last_input_dir)
        if self.inputMode == 'file':
            qfd.setWindowTitle('Select file')
            qfd.setFileMode(QtWidgets.QFileDialog.ExistingFile)
        else:
            qfd.setWindowTitle('Select directory')
            qfd.setFileMode(QtWidgets.QFileDialog.Directory)
        if qfd.exec_():
            fn = qfd.selectedFiles()[0]
            self.inputEdit.setText(fn)
            self.last_input_dir = os.path.split(fn)[0]
            self.initializeTorrent() 
Example 25
Project: dottorrent-gui   Author: kz26   File: gui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def createTorrentBatch(self):
        save_dir = QtWidgets.QFileDialog.getExistingDirectory(
            self.MainWindow, 'Select output directory', self.last_output_dir)
        if save_dir:
            self.last_output_dir = save_dir
            trackers = self.trackerEdit.toPlainText().strip().split()
            web_seeds = self.webSeedEdit.toPlainText().strip().split()
            self.creation_thread = CreateTorrentBatchQThread(
                path=self.inputEdit.text(),
                exclude=self.excludeEdit.toPlainText().strip().splitlines(),
                save_dir=save_dir,
                trackers=trackers,
                web_seeds=web_seeds,
                private=self.privateTorrentCheckBox.isChecked(),
                source=self.sourceEdit.text(),
                comment=self.commentEdit.text(),
                include_md5=self.md5CheckBox.isChecked(),
            )
            self.creation_thread.started.connect(
                self.creation_started)
            self.creation_thread.progress_update.connect(
                self._progress_update_batch)
            self.creation_thread.finished.connect(
                self.creation_finished)
            self.creation_thread.onError.connect(
                self._showError)
            self.creation_thread.start() 
Example 26
Project: grap   Author: AirbusCyber   File: QtShim.py    License: MIT License 5 votes vote down vote up
def get_QFileDialog():
    """QFileDialog getter."""

    try:
        import PySide.QtCore as QtCore
        return QtCore.QFileDialog
    except ImportError:
        import PyQt5.QtWidgets as QtWidgets
        return QtWidgets.QFileDialog 
Example 27
Project: MDT   Author: robbert-harms   File: main.py    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
def _set_qdialog_basedir(self):
        if not self._qdialog_basedir_set:
            data = self._controller.get_model().get_data()
            for map_name, file_path in data.get_file_paths().items():
                if file_path:
                    QFileDialog().setDirectory(file_path)
                    self._qdialog_basedir_set = True
                    return 
Example 28
Project: MDT   Author: robbert-harms   File: main.py    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
def _add_new_files(self):
        new_files = QFileDialog(self).getOpenFileNames(caption='Nifti files',
                                                       filter=';;'.join(image_files_filters))
        if new_files[0]:
            self._add_new_maps(new_files[0]) 
Example 29
Project: MDT   Author: robbert-harms   File: main.py    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
def _save_settings(self):
        """Save the current settings as a text file.
        """
        current_model = self._controller.get_model()

        config_file = ['conf (*.conf)', 'All files (*)']
        file_name, used_filter = QFileDialog().getSaveFileName(caption='Select the GUI config file',
                                                               filter=';;'.join(config_file))
        if file_name:
            with open(file_name, 'w') as f:
                f.write(current_model.get_config().to_yaml()) 
Example 30
Project: MDT   Author: robbert-harms   File: main.py    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
def _load_settings(self):
        config_file = ['conf (*.conf)', 'All files (*)']
        file_name, used_filter = QFileDialog().getOpenFileName(caption='Select the GUI config file',
                                                               filter=';;'.join(config_file))
        if file_name:
            with open(file_name, 'r') as f:
                try:
                    self._controller.apply_action(NewConfigAction(MapPlotConfig.from_yaml(f.read())))
                except yaml.parser.ParserError:
                    pass
                except yaml.scanner.ScannerError:
                    pass
                except ValueError:
                    pass