Skip to main content

Command Line File Watcher for Qt ui file to python file.

Project description

pyuiw

Command Line Watcher for auto compile Qt ui to python file.

Original Tool Source from pyside2-tools pyside2uic I modified some code for customization.

Install pyuiw

pip install pyuiw

How to Use

python -m pyuiw
pyuiw

two command run the same alternatively.

demo

pyuiw -h

run this command can show up the help documentation.

usage: pyuiw [-h] [-p] [-o FILE] [-x] [-d] [-i N] [--from-imports] [-nq] [--QtModule module] [-nb] [-ni]
             [-w WATCH [WATCH ...]] [-e EXCLUDE [EXCLUDE ...]] [-c FILE]

Qt User Interface Compiler version , running on PySide2 5.15.2.
Command Line Watcher for auto compile Qt ui to python file.

Usage Example:

optional arguments:
  -h, --help            show this help message and exit
  -p, --preview         show a preview of the UI instead of generating code
  -o FILE, --output FILE
                        write generated code to FILE instead of stdout
                        <EXP> to define a output expression (default: <${ui_dir}/${ui_name}_ui.py>)
                        ${ui_dir} - input python directory path
                        ${ui_name} - input python file name
  -x, --execute         generate extra code to test and display the class
  -d, --debug           show debug output
  -i N, --indent N      set indent width to N spaces, tab if N is 0 (default: 4)

Code generation options:
  --from-imports        generate imports relative to '.'
  -nq, --no-useQt       ignore Qt.py module for Qt compat
  --QtModule module     customize import Qt module name (default: Qt) | only work in --no-useQt flag set
  -nb, --no-black       ignore black format code
  -ni, --no-isort       ignore isort format code

Watcher options:
  -w WATCH [WATCH ...], --watch WATCH [WATCH ...]
                        watch files or directories
  -e EXCLUDE [EXCLUDE ...], --exclude EXCLUDE [EXCLUDE ...]
                        exclude files glob expression
  -c FILE, --config FILE
                        read specific config file

Configuration

pyuiw would read the pyproject.toml by default or you can set the --config flag to read specific config file.

here is the default options in config file.

[tool.pyuiw]
QtModule = "Qt"
exclude = [] # using glob pattern for exclude
useQt = true
watch = []
execute = true
debug = false
from_imports = false
preview = false
indent = 4
output = "<${ui_dir}/${ui_name}_ui.py>"
black = true
isort = true

here is a example setup.

[tool.pyuiw]
exclude = ["*launcher*"] # exclude file contain `launcher`
watch = ["./tests/ui","./test2/test.ui"] # read the file or directory get all the `.ui` file for watch

TodoList

  • import code to the top (implement isort)
  • black format code
  • implement Qt.py for QApplication.translate
  • customize import
  • poetry pypi python package
  • poetry command line tool
  • add pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyuiw-0.2.2.tar.gz (66.1 kB view details)

Uploaded Source

Built Distribution

pyuiw-0.2.2-py3-none-any.whl (52.5 kB view details)

Uploaded Python 3

File details

Details for the file pyuiw-0.2.2.tar.gz.

File metadata

  • Download URL: pyuiw-0.2.2.tar.gz
  • Upload date:
  • Size: 66.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.12 Windows/10

File hashes

Hashes for pyuiw-0.2.2.tar.gz
Algorithm Hash digest
SHA256 2f631e4bbc06eac187f7103cb2471eb102f870d641da4d3bbf3a0ae6fd8680c5
MD5 93ec28df4823f188729bf7d77a5ef7e5
BLAKE2b-256 9ec652f2776c073f63971808c834fbef9642a17b6a1d58b60483d185dd8e06d2

See more details on using hashes here.

File details

Details for the file pyuiw-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: pyuiw-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 52.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.12 Windows/10

File hashes

Hashes for pyuiw-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9ac50ff81338465fce0b1cb91894736127dd4e57886b34795f70aef51a2a1e1c
MD5 428d8a6a12c80ce494d2cf2b1505aced
BLAKE2b-256 5ec670018a72ededeba87f8187590bd757da6bd3bce5964577ec717217a4c6f0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page