Coder Social home page Coder Social logo

reimarbauer / fs_filepicker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from open-mss/fs_filepicker

0.0 1.0 0.0 592 KB

QT file picker (Open|Save|GetDirectory) for accessing a pyfilesystem2

Home Page: https://github.com/Open-MSS/fs_filepicker

License: Apache License 2.0

Python 100.00%

fs_filepicker's Introduction

fs_filepicker

Source Coveralls Platforms Downloads License Documentation

This project is based on PyFilesystem2 As fs_url you can enter any valid url which the fs.open_fs accepts.

image

Example for commandline:

~$: fs_filepicker -h
usage: fs_filepicker [-h] [-v] [-s] [-d DEFAULT_NAME] [-u FS_URL]
                     [-f FILE_PATTERN] [-t TITLE]
optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show version
  -s, --save            show save button
  -d DEFAULT_NAME, --default_name DEFAULT_NAME
                        default name for saving
  -u FS_URL, --fs_url FS_URL
                        fs url to filesystem
  -f FILE_PATTERN, --file_pattern FILE_PATTERN
                        file pattern
  -t TITLE, --title TITLE
                        title of window


~$: fs_filepicker -u ftp://ftp.de.debian.org/debian

Examples for PyQt5:

from PyQt5 import QtWidgets
app = QtWidgets.QApplication([])
from fslib.fs_filepicker import getOpenFileName, getSaveFileName, getExistingDirectory, getOpenFileNameAndFilter, \
                                getSaveFileNameAndFilter
filename = getOpenFileName(parent=None, fs_url=u'~/', file_pattern=u'All Files (*)',
                         title=u'Open Config File')
print(filename)

patterns = [u'All Files (*)', u'Config Files (*.json)']
filename = getSaveFileName(parent=None, fs_url=u'~/', file_pattern=patterns,
                           default_filename=u'config.json',
                           title=u'Save Config File')
print(filename)

dirname = getExistingDirectory(parent=None, fs_url=u'~/')
print(dirname)

patterns = [u'Data Files (*.xml)', u'Config Files (*.json)']
filename, pattern = getOpenFileNameAndFilter(parent=None, fs_url=u'~/', file_pattern=patterns)
print(filename, pattern)

patterns = [u'Data Files (*.xml)', u'Config Files (*.json)']
filename, pattern = getSaveFileNameAndFilter(parent=None, fs_url=u'~/', file_pattern=patterns)
print(filename, pattern)

def load_file(self):
    from fslib.fs_filepicker import getOpenFileName
    filename = getOpenFileName(self, fs_url=u'ftp://ftp.de.debian.org/debian', file_pattern=u'All Files (*)',
                               title=u"Debian files")

fs_filepicker's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.