Для тех кто пишет расширения на 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
🚀 The #Zealy sprint has officially begun! 🚀
It's time to dive into action as our thrilling sprint is now underway. With a fantastic prize pool of $5,000 + 500,000 Basalt tokens, this is a journey you won't want to miss 🎉
Join us and make your mark in this exciting sprint: https://zealy.io/c/basaltcoin/questboard💰
🚀 The future is green, and BasaltCoin is leading the way! Don't miss out on the opportunity to be part of the Greentech revolution. Invest with us and make a positive impact on our planet while growing your assets🌱
💰
Basalt presale 👉https://basaltcoin.com/sale
📦BasaltCoin✅️
🔥 Total Reward: $5,000 + 500,000 Basalt tokens
👑 The #Zealy sprint has officially begun! 🚀
🚧Rating: ⭐️⭐️⭐️⭐️⭐️
🎁Joining Link :https://zealy.io/c/basaltcoin/questboard
📔Information:
🚀The future is green, and BasaltCoin is leading the way! Don't miss out on the opportunity to be part of the Greentech revolution. Invest with us and make a positive impact on our planet while growing your assets🌱💰
🌐 Presale Link: https://basaltcoin.com/sale
🔴Note:Please do your own research (DYOR) before joining to any airdrops project, also airdrop is 100% free. Don't send any fee or penny for receiving airdrop token.
📦 HIPP Merch Giveway ✅
💲 Reward: 🔹1st 300 - $30
🔹 Next 700 - $20
🪙 Additional rewards: You'll also get the #BitgetPioneer role, extra #Zealy Sprint Points, and the chance to win an El Hippo x Bitget t-shirt!
🛡 Rating: ⭐⭐⭐⭐⭐
😀Airdrop Link:https://partner.bitget.com/bg/5WHE9P
=============================
✅Steps to Participate:
🔘Signup on Bitget withthis link
🔘 Make a deposit of $50 (a net deposit, meaning $50 more than your withdrawals) from November 21 - 28. Deposit cannot be from a CEX.
🔘 Provide yout Bitget UID on our Zealy quest.
=============================
👑Let's Go:https://zealy.io/c/elhippo/questboard
🖥Information:
💎Only transfers from non-CEX wallets are eligible.
💎 It's IMPORTANT to join #Bitget using our link.
💎If you have already registered at Bitget, you can still join the airdrop
😀Note:Please do your own research (DYOR) before joining to any project, also projects are 100% free. Don't send any fee or penny for receiving any token.
Introducing #Skrimples exciting new #airdrop campaign on #Zealy🔥🔥
https://zealy.io/c/skrimples/questboard
We have a massive prize pool of 1,000,000,000 $Skrimp tokens worth $4200 waiting for all the Zealy #ruffhouse hunters out there. 🔽🔽
Medium 🔉
#airdrop#giveaway#shib#pepeburn
👑HOMERUN #Giveaway IS LIVE - 500 USDT to grab👑
Homerun team would like to showcase our appreciation for all of you guys who have been providing great support which enables us to observe extraordinary development during the last couple of months 🚀
We would like to announce the Official #Giveaway event for all of you in our community
👉Prize Pool: $500 $USDT for participants
👉Finish all the tasks in Zealy and grab the USDT
👉Event time (21/08 - 29/08)
👉Join Zealy now: https://zealy.io/c/homerun/questboard/2312ddde-0986-4991-857b-875b4af2698d
#NFTGiveaway#Giveaway#AirdropCrypto#Airdrop#FreeMoney#Web3#USDT#USDTGiveaway#Zealy#QuestN