Для тех кто пишет расширения на 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
Earthrise (William Anders, Lunar orbit, 24 December 1968).
It is described as one of the most influential photographs ever taken, leading Anders to comment that "We set out to explore the moon and instead discovered the Earth." The photograph is often used to illustrate the uneasy reports by some astronauts of what became known as the "Overview Effect", whereby they experienced a transformative sense of awe in gazing back at the Earth in a way that was incomparable to anything ever experienced on the ground.
#Earthday
روز جهانی زمین را به همه نگاهبانان آب و خاک و طبیعت ایران، کنشگران محیط زیست، محیطبانان، جنگلبانان و همه آنهایی که برای پایداری حیات در سرزمین باستانی ما میکوشند شادباش میگویم. باشد که ایرانزمین از این گرداب بلا رها شود و دیگربار میهن ما سرسبز، و پر برگ و بار شود.
#EarthDay
@OfficialRezaPahlavi
Earth, The Blue Planet, Gaia, Terra, The Big Blue Marble 🌎
No matter what you call it, it will always be home. We here at NASA are celebrating #EarthDay with you. From the depths of the oceans to the tallest peaks, from lush forests to arid deserts, our planet is full of brilliant diversity.
Earth is in the "Goldilocks Zone"; our planet's distance to the sun is ideal for liquid water to be on the surface, as we are neither too hot nor too cold. As we search among the stars for life, inspiration, and creation, we also look inward and study what makes our home planet just right to support life.
What's your favorite corner of the planet? Post an image or a selfie tagged NASA Earthling and NASA Earth, or share what you think makes our planet unique in the comments below.
#newtgingrich : RT @CallyGingrich: In honor of #EarthDay, I’m posting a photo that I took gorilla trekking in Rwanda in 2010 with @newtgingrich. These gorillas are part of an international conservation program. https://t.co/UVYVGk0JLC
🔥💦🌬️🍃 Only the master of all four elements can bring harmony to the world.
To celebrate Earth Day, let’s spotlight four key innovations that safeguard sustainable living. Let’s work together to secure a more sustainable future - for now and tomorrow! 🌎
#EarthDay#sustainability
It’s #EarthDay! This year’s theme is #RestoreOurEarth and take climate action. With rising temperatures and rising sea levels, we too are feeling the effects of climate change in Singapore.
So, what can we do to reduce our carbon footprint and help fight climate change? Start with any eco-friendly action, such as reducing the amount of waste we generate, volunteering for environmental activities, or using energy efficient appliances. Remember, our decisions affect the planet we live in. Learn more at greenplan.gov.sg
Plant a Love of Nature in Your Kids
This Earth Day, show kids they can find refuge in the outdoors. #EarthDay#Love#Nature
https://www.nytimes.com/2021/04/16/well/family/earth-day-kids.html
Join @LovelyNature
Earth Day, celebrated on 22 April every year, started in 1970 thanks to U.S. Senator Gaylord Nelson. It’s now a global event with over 190 countries involved. Earth Day raises awareness about environmental issues like pollution, climate change, and deforestation. People across the world take action by planting trees, cleaning up waste, and pushing for stronger policies to protect our planet. It’s a day to reflect on how our actions affect Earth and what we can do to create a more sustainable future.
🌍🌱🔥
[Read more]
@googlefactss
#EarthDay#SaveThePlanet#ClimateAction#Sustainability
⠀
22 апреля будет отмечается День Матери-Земли🌍 ⠀
⠀
На самом деле существует два таких праздника 21 марта и этот в апреле. В чем разница? ⠀
21 марта День Земли имеет миротворческую и гуманитарную направленность. В этот день во многих городах мира звучит Колокол Мира, призывающий к прекращению войн и миру во всем мире.
⠀
22 апреля праздник имеет экологическую направленность и призывает людей обратить внимание на здоровье нашей планеты🌱
⠀
Что может сделать один человек? Много. Сделать чище мир вокруг себя. Убраться возле дома. Посадить цветок, дерево. Собрать мусор. Не перекидывать всё на коммунальщиков.
⠀ ⠀
Поверьте , сделав одно доброе дело вы запустите механизм , который умножится многократно.
И на душе станет легче и чище ) Проверено!💪🏼 ⠀
#экология#чистаяпланета#деньземли2022#earthday2022#earthday
🌍 Earth Day x Tkong | Walking with the Earth
We believe that every action should be rooted in respect for nature.
Tkong is deeply committed to our shared home—Earth.
🌀 The image seen here reflects the natural elements within the Tkong logo—oceans, forests, and mountains, all part of our planet.
#EarthDay2025#Tkong#EnvironmentalProtection#EarthDay#WalkingWithTheEarth
Sabtu, (27/4) memperingati Hari Bumi, bersama Gereja Padua Santo Antonius Kendal mengadakan acara Tanam 3000 bibit mangrove di Pulau Tiban Kendal. Acara ini dihadiri pula oleh Paguyuban GUSDURian Kendal, IPNU-IPPNU, Orang Muda Katholik, JRHAN, Seniman Kendal, dan berbagai unsur lainnya.
Ini adalah salah satu usaha kami untuk mengembalikan sedimentasi pulau Tiban yang telah lama terkikis dan mengancam keberadaan tambak warga sekitar.
Dengan adanya mangrove kami berharap, selain petani tambak semakin dapat mengembangkan usahanya juga dapat mengembalikan Pulau Tiban seperti sedia kala.
#pulautiban
#gusdurian
#gusdur
#gusduriankendal
#earthday
#haribumi
#infokendal
#infojateng