Для тех кто пишет расширения на 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
🚀 Acum 50 de ani, la 22 octombrie 1975, stația automată interplanetară sovietică „Venera-9” a efectuat o aterizare lină pe suprafața planetei Venus.
Legătura cu modulul de coborâre a fost menținută timp de 53 de minute. Au fost obținute primele imagini panoramice din lume transmise de pe suprafața altei planete. Tot pentru prima dată au fost efectuate măsurători ale vitezei vântului la suprafața planetei. „Venera-9” a devenit, de asemenea, primul satelit artificial al planetei #Venus din istorie.
Această misiune a reprezentat o realizare remarcabilă a științei și tehnicii sovietice, confirmând pozițiile de vârf ale URSS în domeniul explorării spațiale. Datele obținute de „Venera-9” privind temperatura, presiunea și compoziția atmosferei planetei au constituit o contribuție esențială la dezvoltarea planetologiei mondiale.
Astăzi, la 50 de ani de la acel eveniment, fapta eroică a inginerilor și oamenilor de știință care au creat „Venera-9” rămâne un simbol al curajului științific și al dorinței omenirii de a cunoaște Universul.
🇷🇺 Rusia este mândră de școala sa spațială, una dintre pietrele de temelie ale istoriei mondiale a explorării cosmosului.
📸 Foto: primele imagini din istorie realizate de pe suprafața planetei Venus, 1975.
#review#poetry#venus
My mother
Blessed with all the might
To tolerate my naiveness
Blessed with all the courage
To withstand my mistakes
Amidst she stands with all the beauty
With all the light behind her eyes
She shows me the way
Though are beliefs aren't ever the same
Yet she acknowledges my vision
When I stumble upon in life
She has the weight to balance
Encountering all my questions away
Believe me or not she's the best in her way
No she isn't the very person
I'd remember in my toughest times
And despite all my dislikes
I believe she's the strongest woman
I'll ever meet in my life
#review#poetry#venus
My mother
Blessed with all the might
To tolerate my naiveness
Blessed with all the courage
To withstand my mistakes
Amidst she stands with all the beauty
With all the light behind her eyes
She shows me the way
Though are beliefs aren't ever the same
Yet she acknowledges my vision
When I stumble upon in life
She has the weight to balance
Encountering all my questions away
Believe me or not she's the best in her way
No she isn't the very person
I'd remember in my toughest times
And despite all my dislikes
I believe she's the strongest woman
I'll ever meet in my life
#review#poetry#venus
Just got away with one
Opened a new door
Shaped a little fantasy
With numerous miracles to adore
Stayed with anger so long
Realised it was my grief
Hadn't it made me this strong
I would've stumbled upon in brief
Earned a little patience
Coiled up with jist of tolerance
Tore a few tied interests
As a result of unfulfilled wishes
Now I can see cure as perception
Witnessed fear, failure and hatred all the same
So now I wish to love and to be loved
Solemnly, perfectly as a beautiful exception
Here I stand amidst all wonders
Drifting with the flow of life
what I've gained as a blessing to realise
For one's finest survival mere love would suffice
#review#poetry#venus
In this world of surprises
My life took a turn and I met you
Blessed with happiness you took me to the moon
But oh my mistrustfulness
You left me in a few
So For the sake of forgiveness
I have an apology
I don't know what's wrong with me
Still I say I'm sorry , really
I'm sure I caused a headache
For I'm trying to get distant
But I promise I'll try harder
But will you have my back at ends??