Surface NMR processing and inversion GUI
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

pyuicfg.py 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. """Help you manage your pyuic.json file (pyqt-distutils)
  2. Usage:
  3. pyuicfg -g
  4. pyuicfg -g --pyqt5
  5. pyuicfg -g --pyside
  6. pyuicfg -a SOURCE_FILE DESTINATION_PACKAGE
  7. pyuicfg -r SOURCE_FILE
  8. pyuicfg (-h | --help)
  9. pyuicfg --version
  10. Options:
  11. -h, --help Show help
  12. --version Show version
  13. -g Generate pyuic.json
  14. -a SOURCE_FILE DESTINATION_PACKAGE Add file to pyuic.json
  15. -r SOURCE_FILE Remove file from pyuic.json
  16. --pyqt5 Generate a pyuic.json file for PyQt5 instead of PyQt4
  17. --pyside Generate a pyuic.json file for PySide instead of PyQt4
  18. """
  19. import os
  20. from docopt import docopt
  21. from pyqt_distutils import __version__
  22. from pyqt_distutils.config import Config, QtApi
  23. def qt_api_from_args(arguments):
  24. if arguments['--pyqt5']:
  25. return QtApi.pyqt5
  26. elif arguments['--pyside']:
  27. return QtApi.pyside
  28. return QtApi.pyqt4
  29. def main():
  30. arguments = docopt(__doc__, version=__version__)
  31. generate = arguments['-g']
  32. file_to_add = arguments['-a']
  33. destination_package = arguments['DESTINATION_PACKAGE']
  34. file_to_remove = arguments['-r']
  35. api = qt_api_from_args(arguments)
  36. cfg = Config()
  37. if generate:
  38. if os.path.exists('pyuic.json'):
  39. choice = input('pyuic.json already exists. Do you want to replace '
  40. 'it? (y/N) ').lower()
  41. if choice != 'y':
  42. return
  43. cfg.generate(api)
  44. elif file_to_add:
  45. cfg.add(file_to_add, destination_package)
  46. elif file_to_remove:
  47. cfg.remove(file_to_remove)
  48. if __name__ == '__main__':
  49. main()