Releases: mottosso/Qt.py
0.6.1
Minor refactoring.
0.6.0
Move added functionality to QtCompat
module.
# Before
import Qt
Qt.load_ui("my.ui")
Qt.__binding__ == "PyQt5"
# After
from Qt import QtCompat
QtCompat.load_ui("my.ui")
QtCompat.__binding__ == "PyQt5"
This module will contain anything that isn't remapped, but added to Qt.py. The reduces the risk of nameclashes, more explicitly points out what is unique to Qt.py while at the same time makes your code more readable via the use of the similar, but unique, module.
button = QtWidgets.QPushButton("Button")
QtCompat.load_ui(...)
Backwards compatibility is maintained
Previous members are preserved, but deprecated. You are advised to transition when you are able.
0.5.0
Alpha release of --convert
for Qt Designer files.
Steps
- Have your .ui file ready.
- Compile your .ui file using the PySide2
uic
module. - Convert your compiled .ui file with Qt.py
Demo
$ pyside2-uic my_ui.ui -o my_ui.py
$ python -m Qt --convert my_ui.py
# Creating "my_ui_backup.py"..
# Successfully converted "my_ui.py"
Note to Maya 2017-users: You can find pyside2-uic in your Maya installation directory
Implementation
The method at which the conversion happens is early alpha and is expected to work in common cases, but may not cover all edge cases.
What we need is for you to test this, and let us know where it fails so we can repair it.
The implementation will, at this point in time:
- Replace occurrences of
from PySide2 import
withfrom Qt import
- Replace occurrences of
QtWidgets.QApplication.translate
withQt.translate
And that's it.
The function is idempotent and will create a backup of your original, as my_ui_backup.py
Let us know what you think!
0.4.3
- Implements #137
Disable run-time validation of attribute overrides, safe those for tests.
If you've experienced issues where Qt.py is telling you it tried overriding an existing attribute..
AttributeError: Cannot override existing name: PySide.QtWidgets #
# Error: AttributeError: Cannot override existing name: PySide.QtWidgets #
Then this one's for you.
It maintains the safety of ensuring no original attributes are overridden, while at the same time enabling further flexibility for the users.
Enjoy!
0.4.2
Added compatibility with custom distribution of PyQt5, https://github.com/pyqt/python-qt5.
0.4.1
0.4.0
This release includes guards against problems related to co-existence.
Co-existence
Great care is taken to make sure Qt.py does not affect the original binding. This means no chances can be made to any pre-existing member.
Before, this care was made by eye. But now this care is automated and guarded against per commit, pull-request and at run-time (at minimal cost).
Theory
Notice the add
and remap
functions.
These replace the previous layout of remapping and adding.
# Before
PyQt4.QtWidgets = PyQt4.QtGui
# After
remap(PyQt4, "QtWidgets", PyQt4.QtGui)
By using a function as opposed to directly assigning, we lose out on readability, but gain security.
The safe=True
argument is meant to facilitate times where we do overwrite, but ensure to include a full array of tests to ensure the original member has not been broken.
The Qt.__modified__
list of strings holds any members that do alter an existing member of the original binding.
Today, no member uses safe=False
and __modified__
is empty as it should.
0.3.4
Changes.
PySide wasn't working under some circumstances, see stack trace on Travis.
0.3.3
0.3.1
Added support for vendoring.
myproject/
vendor/
Qt.py
# Absolute reference
from myproject.vendor.Qt import QtWidgets
# Local reference
from .vendor.Qt import QtWidgets
# Direct reference
from .vendor import Qt
You were able to bundle Qt.py before as well, via a slightly more awkward syntax.
from .vendor import Qt
from Qt import QtWidgets