Для тех кто пишет расширения на 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
🖼Gaza : soutien pictural
▪️Dans la bande de #Gaza, des artistes ont réalisé des fresques murales pour exprimer leur soutien à la flottille internationale Global Sumud.
Crédit vidéo : Agence Anadolu
RT en français • Osez questionner !
⏺À #Gaza, des mariés ont opté pour un moyen de transport inédit : une pelleteuse
Le couple a traversé les rues, malgré les décombres témoignant de la destruction générale dont elles ont été le théâtre.
Source : réseaux sociaux
RT en français • Osez questionner !
🫦 Algunas personas podrían encontrar perturbadoras las imágenes y videos compartidos. Se recomienda discreción.
⚠️🤔🏴☠️⚔️🇵🇸 Imágenes de la horrible masacre perpetrada por las fuerzas de ocupación contra un grupo de ciudadanos en el barrio de Beit Lahia, al norte de #Gaza.
🚨 The IOF carried out a new massacre, destroying an entire residential block above the heads of citizens on Tal Al-Zaatar in Jabalia, northern #Gaza Strip. Two martyrs have been recovered so far and there are a large amount of wounded.
Artillery shelling continues on various parts of Jabalia, and several martyrs have ascended there as a result of residential homes being targeted.
4 martyrs and 5 injuries were reported as a result of the IOF targeting of a gathering of citizens on Al-Nasr Street west of Gaza City.
Further, internet and communications have been cut off in the northern Gaza Strip as a result of the IOF aggression, as the siege enters its third week.
🚨🟢 BREAKING - Hamas leader Khalil Al-Hayya announces the martyrdom of the great leader, President of the Hamas Political Bureau, the hero of Al-Aqsa Flood, Yahya Sinwar, who sought martyrdom and attained it after clashing with a zionist force alongside other fighters in the #Gaza Strip. Further coverage of the Al-Hayya’s statement will be provided.
Glory to the martyrs.
Ahmed Al-Telbani, Director of the Central Station in the Medical Services’ Emergency and Ambulance Department, ascended to martyrdom along with his family members in the IOF air strike of their home in Maghazi camp, central #Gaza Strip.
Glory to the martyrs.
🔻 The IOF admits to the death of 5 IOF soldiers, including two officers, during a battle with the resistance in southern Lebanon. In the same incident, three Golani Brigade soldiers (including an officer) were seriously wounded. In total, the IOF admitted to the critical wounding of 8 zionist soldiers in three battles in southern Lebanon.
They also admitted to the serious wounding of a soldier during a battle in the southern #Gaza Strip yesterday.
🚨 10 martyrs have been recovered by Civil Defense crews following the IOF bombing the Al-Telbani family home in Maghazi camp in the central #Gaza Strip.
60 martyrs have ascended in the Gaza Strip today, with at least 25 of them in Jabalia camp.
On October 17th, 2023, in a cowardly assassination, commander Ayman Nofal ascended after US-funded IOF warplanes targeted him in Bureij camp in central #Gaza. Beloved by allfactions, the commanding martyr was an Al-Qassam Brigades leader who created the foundations of the united Joint Operations Room of Palestinian Resistance Factions, a room in which the spectrum of Palestinian and Arab resistance coordinate. Just weeks ago, Ayman's nephew was martyred at the Gaza border protests.
Ayman embodied the spirit of the Joint Room which he led in his words and deeds, recognizing, like martyred leaders before him, "Either we rise together, or they will kill us individually."
Here, Ayman speaks in 2021 at the Joint Operation's Room annual training for all factions. Without a doubt, Ayman was one of the engineers of the long-planned Al-Aqsa Flood for the sake of our prisoners and Al-Aqsa, evident in the words of this speech: GiladShalit was just practice. Learning from the lessons of previous operations and honoring the blood of the martyrs, we march forth towards liberation, never forgetting those who paved the path.
Glory to our martyrs! Glory to our resistance! Liberation nears with their guiding illumination.
🚨 22 martyrs have ascended in the horrific massacre at the Abu Hussein School in Jabalia camp, northern #Gaza Strip, and dozens are wounded. Most of the martyrs are children and women, after the IOF bombed the school housing a large number of displaced people.
Tanks began firing shells at the school after advancing from west of Jabalia. The hospitals in the north are unable to deal with the large number of injuries and martyrs.
The IOF also bombed the Khalifa School in the northern #Gaza Strip, resulting in a large fire and one martyr. In a series of strikes, at least 11 martyrs ascended in Gaza City. The siege of Jabalia camp and the north continues for the 13th day without any aid reaching it.