Для тех кто пишет расширения на PyQt/PySide для CG-софтов.
Когда я только начинал писать тулзы под Maya (тогда еще версия 2010-2011) мне приходилось ручками ставить PyQt4 под Maya. Даже написал мануалы по установке на своём сайте. Но потом стал доступен из коробки PySide и позже он обновится до PySide2. Для некоторых систем была поддержка PyQt5.
И как простому разработчику поддерживать этот зоопарк? Ведь хочется чтобы тул работал на любой версии (вы тоже делали модуль что-то типа import_qt.py?😁)
На помощь приходит проект Qt.py который поставил себе цель унифицировать использование Qt-биндингов вне зависимости от среды где запускается код. Те, кто давно пишут на Qt, скорее всего знают этот проект.
Он стал стандартом для CG-индустрии и используется в топовых студиях и проектах.
Qt․py помогает запускать один и тот же код на разных платформах с разными вариантами Qt-библиотек. Это может быть как интеграция в CG-софт, так и переносимость стендалонов между разными платформами с разными версиями Python.
Я решил рассказать о некоторых особенностях работы с этой библиотекой.
Сегодня о том, как установить и использовать Qt․py и что это вам даёт.
Установка
pip install Qt.py
Чтобы начать использовать Qt․py в коде достаточно заменить импорт вашего варианта Qt-биндинга на Qt․py
from [PySide|PyQt4|PySide2|PyQt5] import QtWidgets
=>
from Qt import QtWidgets
Теперь ваш код будет поддерживать любой вариант биндинга Qt в Python.
При этом не потребуется использовать if-else конструкции под разные версии. Все вызовы теперь одинаковы.
Всё что нужно сделать, это написать его по правилам PySide2. Именно эта версия была взята за основу.
Приоритет импорта такой:
1. PySide2
2. PyQt5
3. PySide
4. PyQt4
Что именно загрузилось можно посмотреть в переменной __binding__
>>> import Qt
>>> Qt.__binding__
'PySide2'
Приоритет имопрта можно изменить через переменные QT_PREFERRED_BINDING и QT_PREFERRED_BINDING_JSON. Причем под каждый проект оверрайды можно настраивать индивидеально.
#qt#libs
@RusEmbMalta:
❗Appeal of the State Duma to the United Nations, international parliamentary organizations, world parliaments in connection with the heavy toll of children’s deaths and current humanitarian situation in the Israeli–#Palestinian conflict zone
🇺🇸🇮🇱🇵🇸Ben is finally waking up to the strategic intent behind October 7.
On October 6 no one was seriously talking about a #Palestinian State.
Since October 7, everyone is.
All Hamas had to do was provide #Israel the opportunity to show the world the true face of its genocidal existence.
@MostMoralArmy
@RusEmbMalta: 📄Excerpts from the briefing by Foreign Ministry Spokeswoman Maria Zakharova, Moscow, November 15, 2023
🔹Update on #Palestinian-Israeli conflict
🔹#Ukraine crisis
🇮🇱🇵🇸Horrific scenes emerging from Al-Shati refugee camp in northern #Gaza Strip shows the bodies of #Palestinian civilians slaughtered by an #Israeli occupation bombing.
@MostMoralArmy
#Palestinian Civil Defence is currently recovering remains of #Gazan martyrs which they couldn’t previously reach. Many of these bodies have decomposed.
Gaza’s Civil Defence Spokesperson Mahmoud Basal said that the number of martyrs whose bodies evaporated reached 2848 martyrs.
#Israel’s use of internationally forbidden arms stands behind this phenomenon.
The #Palestinian Media Center said that these weapons, which haven’t been identified, melt and evaporate bodies due to the extreme heat produced by these weapons.
🇮🇱🇵🇸BREAKING: #Israeli occupation forces execute an elderly #Palestinian woman and her daughter while fleeing from Road 8 in #Gaza's Sabra neighborhood.
The two were directly shot by snipers positioned on rooftops, according to eyewitnesses.
@MostMoralArmy
🇺🇸#USA#Texas
The raising of the #Palestinian#flag in a live broadcast of the University of #Texas graduation ceremony, was accompanied by applause from the audience.
#Commentary: #Ethiopia’s Policy Realignment: From #Pan_African Beacon to Client State
On 31 March 2026, the UN Human Rights Council adopted a resolution condemning #Israel’s actions in the occupied #Palestinian territories and the Syrian Golan Heights. Thirty-one countries supported it; Ethiopia was among only three in opposition. Sidoc Haytu describes the move as “a profound betrayal of the Pan-Africanist and anti-colonial principles that once defined the Ethiopian state.”
While officials frame the vote as pragmatic, he argues it serves elite interests, noting “the calculation was not performed on behalf of the 120 million Ethiopians.”
Contrasting Ethiopia’s past stance, he claims, “When Ethiopia votes at the #UN… it is voting as a client of…Tel Aviv,” urging a reversal: “Ethiopia will not stand with colonizers.”
https://addisstandard.com/?p=56716
#EU member states #Ireland, #Spain and #Norway announce official recognition of #Palestinian#Statehood
The three countries are the only European countries, thus far, who have officially recognised the State of Palestine.
#Israel was founded by #Zionist#terrorists.
Keep that in mind next time you hear Zionists claim that recognising #Palestinian#Statehood is "rewarding #terrorism"