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.
pyuiw -h
run this command can show up the help documentation.
usage: pyuiw [-h] [-p] [-o FILE] [-x] [-d] [-i N] [--from-imports] [--useQt] [--QtModule module] [--black] [--isort] [-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: <${py_dir}/${py_name}_ui.py>)
${py_dir} - input python directory path
${py_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 '.'
--useQt using Qt.py module for Qt compat
--QtModule module customize import Qt module name | only work in --useQt false
--black using black format code
--isort using isort format code
Watcher options:
-w [WATCH [WATCH ...]], --watch [WATCH [WATCH ...]]
watch files or directories
-e [EXCLUDE [EXCLUDE ...]], --exclude [EXCLUDE [EXCLUDE ...]]
exclude files re 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 = <${py_dir}/${py_name}_ui.py>
black = true
isort = true
here is a example setup.
[tool.pyuiw]
exclude = ["*launcher*"] # exclude file container `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
- unittest
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.0.tar.gz
(66.1 kB
view details)
Built Distribution
pyuiw-0.2.0-py3-none-any.whl
(52.4 kB
view details)
File details
Details for the file pyuiw-0.2.0.tar.gz
.
File metadata
- Download URL: pyuiw-0.2.0.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | aead9ebb9a7cd53b217241f54b6a9dc5e9d35ed48cf127ad62cee09248ee76f2 |
|
MD5 | 3865c8801f83fbc242018061b4a09a7a |
|
BLAKE2b-256 | d07e87c928919ee427704c17f0400b7d388aef0debb1a7e76b1dadb2390bcf22 |
File details
Details for the file pyuiw-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: pyuiw-0.2.0-py3-none-any.whl
- Upload date:
- Size: 52.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.8.12 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a42273c256fb17d0968298c588f90bf6fd343e2d302fc203be6a95d0fe7b8ed |
|
MD5 | 5c331cd1431de4bd0608a2b02cea0efd |
|
BLAKE2b-256 | 727043f0e9862743a13cffd32a6c32c85ebb739dda8391d3f4f58f7e65f010e8 |