Для тех кто пишет расширения на 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
🧠 Do you know how, if you repeat a word or phrase over and over again or stare at it for a long time, it starts to lose its meaning and sound like gibberish or just a random set of letters?
🔍 What is this phenomenon called?
A. 🗣️ Phonetic Decay
B. 🔁 Semantic Satiation
C. 📚 Lexical Overload
D. 🎧 Auditory Fatigue
@languagetrivia#phenomenon
🧠 The Stroop Effect Challenge!
👉 Instructions:
1) Read out loud the name of the colors in the top half of the image.
2) Now, in the bottom half say the color of the text, not the word itself.
(E.g. for the first word of the bottom part you need to say “green”, because this is the color in which the word is written)
This is called the Stroop Effect – a psychological phenomenon where your brain struggles to process conflicting information.
Your brain wants to read the word (e.g. "Purple"), but the task is to say the color of the text (e.g. "Green"). This mismatch causes a slight mental slowdown as your brain processes the conflict.
Did your brain glitch? Yes 🤯| No 😎
Subscribe to Language Trivia || #experiment#phenomenon
🌎 The “singing” sands of select deserts produce eerie musical tones when walked on or disturbed. This haunting sound comes from millions of perfectly sized sand grains rubbing together and vibrating in harmony—nature’s own desert orchestra! ✨
#geology⚡#sound⚡#phenomenon
👉subscribe Interesting Planet
🌎 Glowing tides known as bioluminescent bays light up in places like Puerto Rico. Microorganisms called dinoflagellates produce blue-green light when stirred by waves or movement. The brightest, Mosquito Bay, can host up to 700,000 glowing organisms in just one liter of water. ✨
#bioluminescence⚡#ocean⚡#phenomenon
👉subscribe Interesting Planet
👉more Channels
🌍 Sometimes, sunlight shining through millions of tiny ice crystals in high clouds creates halos—glowing circles or arcs—around the Sun or Moon, a beautiful effect of atmospheric optics. ✨
#atmosphere⚡#light⚡#phenomenon⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography🌍
🪐 In the galaxy NGC 660, astronomers have discovered a rare and bizarre "polar ring"—a huge ring of gas and stars wrapping around the galaxy at a right angle to its main disk. These unusual rings may form after galactic collisions, twisting the cosmic structure into a shape unlike any other in the universe. ✨
#phenomenon⚡#galaxies⚡#collisions⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🌎 A rare natural phenomenon, “ball lightning” appears as glowing orbs during storms, sometimes rolling along the ground or bursting in mid-air. Its true cause is still being unraveled by physicists, adding mystery to thunderstorm science. ✨
#weather⚡#phenomenon⚡#electricity
👉subscribe Interesting Planet
🧪 Experiment time!
Which of these shapes would you associate with the word 'Bouba,' and which with 'Kiki'?
👀 Check the first comment under the poll below for details about this experiment and what it reveals about human perception!
@languagetrivia#experiment#fact#phenomenon
⠀
Девчонки! Вчера радости моей не было предела! Сейчас расскажу…
⠀
Я так старалась, преодолевая себя, участвовала в беговом челлендже в приложении #бегаешькакдевчонка
⠀
На второй день челленджа я поняла, что в тройку лидеров точно не зайду. Девчонки быстро вырвались вперед…Тогда я нацелилась войти хотя бы в десятку лидеров. Это был спортивный интерес! Азарт мной руководил)
⠀
В итоге я заняла 16 место из 1468 участниц!🔥Представляете?! Ну огонь же!
⠀
Так рада, что взяла такую планку!
А вчера получила письмо от организаторов, что я победила в беговом челлендже! Представляете?! То есть, помимо первых трёх призовых, ещё было 9 победителей, я в том числе! (получу небольшой подарок от брендов #Hitrospletenia X #Phenomenon )
⠀
Вчера я радовалась, как ребенок, потому что прошла небольшой путь преодоления: каждое утро, в течение челленджа я бегала по 5 км в любую погоду, днём и вечером активно ходила, гуляла, чтобы шаги росли)
В итоге 16 место из 1468 участниц!
⠀
Интересно посмотреть результаты в целом за октябрь! Поделюсь с вами!
В общем, горжусь собой!
🌎 The Morning Glory cloud is a rare, enormous roll-shaped cloud that can stretch over 1,000 kilometers across northern Australia. It forms when humid air, sea breezes, and temperature inversions combine during specific conditions—glider pilots seek it for its powerful updrafts. ✨
#phenomenon⚡#meteorology⚡#Australia
👉subscribe Interesting Planet
“Paris in the the spring.”
Did you notice the extra “the”?
If not, don’t worry – it’s a common perception error!
🔍Why does this happen?
The second “the” is often skipped because of how our eyes move while reading. Our brains prioritize speed and smoothness, filling in the blanks as we read. When your eyes jump from “Paris” to “spring”, the brain might overlook the extra “the” in between.
📝 This illusion shows how our minds sometimes trade accuracy for efficiency.
[Source]
Did you catch the repetition right away 🤓, or did it take a second glance to spot it 🙈?
@languagetrivia#illusion#phenomenon#experiment
🪐 In the galaxy PKS 2014-55, astronomers have discovered a cosmic oddity known as an "X-shaped radio galaxy." This galaxy's energetic jets of particles, powered by a supermassive black hole, create two pairs of huge lobes that form a striking X pattern, suggesting a sudden flip in the black hole's rotation or direction—one of the rarest shapes found among radio galaxies. ✨
#phenomenon⚡#radiogalaxy⚡#jets⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries