Function creates a file chooser dialog with title text
544121
def create_file_chooser_dialog(self, text, parent, name=Gtk.STOCK_OPEN):
        
        text = None
        dialog = Gtk.FileChooserDialog(
            text, parent,
            Gtk.FileChooserAction.SELECT_FOLDER,
            (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, name, Gtk.ResponseType.OK)
        )
        response = dialog.run()
        if response == Gtk.ResponseType.OK:
            text = dialog.get_filename()
        dialog.destroy()
        return text
618521
private void promptForFiles() {
        DialogProperties properties = new DialogProperties();
        properties.selection_mode = DialogConfigs.MULTI_MODE;
        properties.selection_type = DialogConfigs.FILE_SELECT;
        properties.root = new File(DialogConfigs.DEFAULT_DIR);
        properties.error_dir = new File(DialogConfigs.DEFAULT_DIR);
        properties.offset = new File(DialogConfigs.DEFAULT_DIR);

        Set<String> registeredExtensions = ArchiveFileFactory.getRegisteredExtensions();
        //api check
        if (Build.VERSION.SDK_INT >= 14)
            registeredExtensions.add("gpkg");
        registeredExtensions.add("map");

        String[] ret = new String[registeredExtensions.size()];
        ret = registeredExtensions.toArray(ret);
        properties.extensions = ret;

        FilePickerDialog dialog = new FilePickerDialog(getContext(), properties);
        dialog.setTitle("Select a File");
        dialog.setDialogSelectionListener(new DialogSelectionListener() {
            @Override
            public void onSelectedFilePaths(String[] files) {
                //files is the array of the paths of files selected by the Application User.
                setProviderConfig(files);
            }

        });
        dialog.show();
    }
317053
def on_save(self, event):
        ''''''
        dlg = wx.FileDialog(None, self.settings.get_title(), '', "", '*.*',
                            wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
        if dlg.ShowModal() == wx.ID_OK:
            self.settings.save(dlg.GetPath())
914479
def select_option_dialog(windowTitle, optionList):
    

    class OptionFrame(wx.Frame):
        selectedOption = None

        def __init__(self, windowTitle, optionList):
            wx.Frame.__init__(self, None, -1, windowTitle, size=(250, 200))
            panel = wx.Panel(self, -1)
            listBox = wx.ListBox(panel, -1, (20, 20), (80, 120), optionList, wx.LB_SINGLE)
            listBox.SetSelection(0)
            self.Bind(wx.EVT_LISTBOX_DCLICK, self.doubleclick)
            self.optionList = optionList

        def doubleclick(self, event):
            index = event.GetSelection()
            value = self.optionList[index]
            OptionFrame.selectedOption = (index, value)
            self.Close()

    app = wx.PySimpleApp()
    OptionFrame(windowTitle, optionList).Show()
    app.MainLoop()

    return OptionFrame.selectedOption
713380
@SuppressLint("NewApi")
    public static Intent createChooser(Intent target, CharSequence title) {
        if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
            return Intent.createChooser(target, title);
        }
        Intent intent = new Intent();
        intent.setClass(Application.getLastInstance(), ChooserActivity.class);
        intent.putExtra(Intent.EXTRA_INTENT, target);
        if (title != null) {
            intent.putExtra(Intent.EXTRA_TITLE, title);
        }
        int permFlags = target.getFlags()
                & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
        if (permFlags != 0 && VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
            ClipData targetClipData = target.getClipData();
            if (targetClipData == null && target.getData() != null) {
                ClipData.Item item = new ClipData.Item(target.getData());
                String[] mimeTypes;
                if (target.getType() != null) {
                    mimeTypes = new String[]{
                            target.getType()
                    };
                } else {
                    mimeTypes = new String[]{};
                }
                targetClipData = new ClipData(null, mimeTypes, item);
            }
            if (targetClipData != null) {
                intent.setClipData(targetClipData);
                intent.addFlags(permFlags);
            }
        }
        return intent;
    }
1204321
def save(title='Save', parent=None, current_name='', folder=None,
         _before_run=None, _before_overwrite=None):
    """"""
    filechooser = gtk.FileChooserDialog(title, parent,
                                        gtk.FILE_CHOOSER_ACTION_SAVE,
                                        (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                         gtk.STOCK_SAVE, gtk.RESPONSE_OK))
    if current_name:
        filechooser.set_current_name(current_name)
    filechooser.set_default_response(gtk.RESPONSE_OK)

    if folder:
        filechooser.set_current_folder(folder)

    path = None
    while True:
        if _before_run:
            _before_run(filechooser)
            _before_run = None  # XXX: find better implications
        response = filechooser.run()
        if response != gtk.RESPONSE_OK:
            path = None
            break

        path = filechooser.get_filename()
        if not os.path.exists(path):
            break

        if ask_overwrite(path, parent, _before_run=_before_overwrite):
            break
        _before_overwrite = None  # XXX: same
    _destroy(filechooser)
    return path
203454
def open_file_dialog(self):
        
        dialog = QtWidgets.QFileDialog
        sender = self.sender()
        if sender == self.btn_open_source:
            textbox = self.source_path
        elif sender == self.btn_open_target:
            textbox = self.target_path
        folder = dialog.getExistingDirectory(self, 'Select a file:', textbox.text(), options = QtWidgets.QFileDialog.ShowDirsOnly)
        if str(folder) != '':
            textbox.setText(folder)
            # load elements from file and display in tree
            if sender == self.btn_open_source:
                self.reset_avaliable(folder)
698437
def dirBrowser(self):
        """"""
        if capable.OF_TKFD_IN_EPAR:
            fname = askdirectory(parent=self.entry, title="Select Directory")
        else:
            raise NotImplementedError('Fix popupChoices() logic.')

        if not fname:
            return # canceled

        self.choice.set(fname)
        # don't select when we go back to widget to reduce risk of
        # accidentally typing over the filename
        self.lastSelection = None
24418
function (filepath, options, callback) {
        if (typeof options === 'function') {
            callback = options;
            options = undefined;
        }

        options = options || '';
        var args = _.compact([filepath].concat(options.replace(/\ \ /g, ' ').split(' ')));

        logger.debug('cmd:', constant.PROG_OPTIPNG, args.join(' '));

        var proc = spawn(constant.PROG_OPTIPNG, args);

        proc.stdout.on('data', function (data) {
            logger.debug(data.toString());
        });

        proc.stderr.on('data', function (data) {
            logger.debug(data.toString());
        });

        proc.addListener('exit', function (e) {
            if (e) {
                return callback(e);
            }
            callback();
        });
    }
1200789
def getsavefilename(parent=None, caption='', basedir='', filters='',
                    selectedfilter='', options=None):
    """"""
    return _qfiledialog_wrapper('getSaveFileName', parent=parent,
                                caption=caption, basedir=basedir,
                                filters=filters, selectedfilter=selectedfilter,
                                options=options)
460770
public void setDialogTitle(String singleKey, String multiKey) {

        if (isMultiOperation()) {
            // generate title with number of selected resources and parent folder parameters
            String resCount = String.valueOf(getResourceList().size());
            String currentFolder = CmsResource.getFolderPath(getSettings().getExplorerResource());
            currentFolder = CmsStringUtil.formatResourceName(currentFolder, 40);
            Object[] params = new Object[] {resCount, currentFolder};
            setParamTitle(key(multiKey, params));
        } else {
            // generate title using the resource name as parameter for the key
            String resourceName = CmsStringUtil.formatResourceName(getParamResource(), 50);
            setParamTitle(key(singleKey, new Object[] {resourceName}));
        }
    }
840805
private void openButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openButtonActionPerformed
		final File dir = lastOpenDirectory();
		final JFileChooser chooser = dir != null
			? new JFileChooser(dir)
			: new JFileChooser();
		chooser.setDialogTitle("Choose Image");
		chooser.setDialogType(JFileChooser.OPEN_DIALOG);
		chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
		chooser.setMultiSelectionEnabled(false);
		chooser.addChoosableFileFilter(new FileNameExtensionFilter(
			format(
				"Images (%s)",
				Stream.of(ImageIO.getReaderFileSuffixes())
					.map(s -> format(" *.%s", s))
					.collect(Collectors.joining(","))
			),
			ImageIO.getReaderFileSuffixes()
		));

		final int returnVal = chooser.showOpenDialog(this);
		if (returnVal == JFileChooser.APPROVE_OPTION) {
			final File imageFile = chooser.getSelectedFile();
			try {
				update(ImageIO.read(imageFile));
				if (imageFile.getParentFile() != null) {
					lastOpenDirectory(imageFile.getParentFile());
				}
			} catch (IOException e) {
				JOptionPane.showMessageDialog(
					rootPane,
					format("Error while loading image '%s'.", imageFile),
					e.toString(),
					JOptionPane.ERROR_MESSAGE
				);
			}
		}
	}
375037
function title(title, widths, opt){
  var wid = title.length;
  var total = widths.reduce((a, b) => a + b + 3, 0) - 1;
  var left = parseInt((total - wid) / 2);
  if (!opt.plain) title = '\u001b[1m' + title + '\u001b[22m';
  log(p[0][0] + widths.map(col => p.h + strN(col, p.h) + p.h).join(p.h) + p[0][2]);
  log(p.v + widths.map(col => ' ' + strN(col, ' ') + ' ').join(' ') + p.v);
  log(p.v + strN(left) + title + strN(total - left - wid) + p.v);
  log(p.v + widths.map(col => ' ' + strN(col, ' ') + ' ').join(' ') + p.v);
}
1310027
function parseInstallerLog(filepath, searchstring, encoding, callback) {
        var line = "";
        var searchFn = function searchFn(str) {
            var arr = str.split('\n'),
                lineNum,
                pos;
            for (lineNum = arr.length - 1; lineNum >= 0; lineNum--) {
                var searchStrNum;
                for (searchStrNum = 0; searchStrNum < searchstring.length; searchStrNum++) {
                    pos = arr[lineNum].search(searchstring[searchStrNum]);
                    if (pos !== -1) {
                        line = arr[lineNum];
                        break;
                    }
                }
                if (pos !== -1) {
                    break;
                }
            }
            callback(line);
        };

        fs.readFile(filepath, {"encoding": encoding})
            .then(function (str) {
                return searchFn(str);
            }).catch(function () {
                callback("");
            });
    }
850203
public static String createDialogTitle(String appName, String dialogName) {
        if (appName != null) {
            StringBuffer buf = new StringBuffer(appName);
            buf.append(": ");
            buf.append(dialogName);
            return buf.toString();
        }

        return dialogName;
    }
545586
def on_m_save_file(self,event):

        '''
        
        '''
        fout = open(os.path.join(self.WD, "demag_orient.txt"), 'w')
        STR = "tab\tdemag_orient\n"
        fout.write(STR)
        headers = [header[0] for header in self.headers]
        STR = "\t".join(headers) + "\n"
        fout.write(STR)
        for sample in self.samples_list:
            STR = ""
            for header in headers:
                sample_index = self.samples_list.index(sample)
                i = headers.index(header)
                value = self.grid.GetCellValue(sample_index, i)
                STR = STR + value + "\t"
            fout.write(STR[:-1] + "\n")
        if event != None:
            dlg1 = wx.MessageDialog(None,caption="Message:", message="data saved in file demag_orient.txt" ,style=wx.OK|wx.ICON_INFORMATION)
            dlg1.ShowModal()
            dlg1.Destroy()
276692
def open_filechooser(title, parent=None, patterns=None,
                     folder=None, filter=None, multiple=False,
                     _before_run=None, action=None):
    

    assert not (patterns and filter)
    if multiple:
        if action is not None and action != gtk.FILE_CHOOSER_ACTION_OPEN:
            raise ValueError('`multiple` is only valid for the action '
                             '`gtk.FILE_CHOOSER_ACTION_OPEN`.')
        action = gtk.FILE_CHOOSER_ACTION_OPEN
    else:
        assert action is not None
    filechooser = gtk.FileChooserDialog(title,
                                        parent,
                                        action,
                                        (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                         gtk.STOCK_OPEN, gtk.RESPONSE_OK))
    if multiple:
        filechooser.set_select_multiple(True)

    if patterns or filter:
        if not filter:
            filter = gtk.FileFilter()
            for pattern in patterns:
                filter.add_pattern(pattern)
        filechooser.set_filter(filter)
    filechooser.set_default_response(gtk.RESPONSE_OK)

    if folder:
        filechooser.set_current_folder(folder)

    try:
        if _before_run is not None:
            _before_run(filechooser)
        response = filechooser.run()
        if response not in (gtk.RESPONSE_OK, gtk.RESPONSE_NONE):
            return

        if multiple:
            return filechooser.get_filenames()
        else:
            return filechooser.get_filename()
    finally:
        _destroy(filechooser)