Для тех кто пишет расширения на 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
🐈⬛Мы возвращаемся к вам с итогами третьей недели рубрики Q&A
🔢 Появились ли новые тенденции в исследованиях с появлением ИИ?
🔢 Может ли искусственный интеллект самостоятельно провести исследование?
🔢 Какие существуют этические нормы по использованию ИИ?
🐈⬛ На эти и другие ваши вопросы по теме «Влияние искусственного интеллекта на научную сферу журналистики и медиаисследований» ответила заведующая кафедрой цифровых медиакоммуникаций Камилла Ренатовна Нигматуллина
🐈⬛ Завтра мы вернемся с анонсом следующего гостя, а пока предлагаем вам ознакомиться с ответами эксперта
#QnA
❗️❗️❗️Dear subscribers,❗️❗️❗️ please join us for a livestream on Friday, 19 July, at 8pm GMT!
Our friend Alex at UkraineWarTruth
had his YouTube channel banned after he published the video he made in Mariupol
The banned channel was instrumental in the great work Alex has been doing since 2014, bringing the truth about the Donbass to the people in the West. It had hundreds of thousands of views and thousands of subscribers, and it was taken down without a warning after posting three new videos, which were first-hand eye-witness accounts and which didn't break a single YouTube rule.
Please join us in supporting Alex's work by watching his latest video and subscribing to his Telegram channel: https://t.me/Ukraine_War_Truth
❗️We'd also like to invite you to our upcoming livestream on Friday, 19 July, at 8pm GMT, where Alex will join #TheBelgorodBrit to speak about Mariupol, Belgorod, Russia, Ukraine... and the freedom of speech, of course!
Please post any questions or comments in this thread.
#QnA
#stream
📱InfoDefenseENGLISH
📱InfoDefense
❗️❗️❗️Dear subscribers,❗️❗️❗️ please join us for a livestream on Friday, 19 July, at 8pm GMT!
Our friend Alex at UkraineWarTruth
had his YouTube channel banned after he published the video he made in Mariupol
The banned channel was instrumental in the great work Alex has been doing since 2014, bringing the truth about the Donbass to the people in the West. It had hundreds of thousands of views and thousands of subscribers, and it was taken down without a warning after posting three new videos, which were first-hand eye-witness accounts and which didn't break a single YouTube rule.
Please join us in supporting Alex's work by watching his latest video and subscribing to his Telegram channel: https://t.me/Ukraine_War_Truth
❗️We'd also like to invite you to our upcoming livestream on Friday, 19 July, at 8pm GMT, where Alex will join #TheBelgorodBrit to speak about Mariupol, Belgorod, Russia, Ukraine... and the freedom of speech, of course!
Please post any questions or comments in this thread.
#QnA
#stream
📱InfoDefenseENGLISH
📱InfoDefense
Qatar News Agency
Kazakh Vice Minister of Culture, Sports: Close Relations Between #Kazakhstan and #Qatar, Large Cooperation Projects Await Both Sides.
Chairman of the Management Board of JSC National Company “Kazakh Tourism” to #QNA: After HH the Amir's visit, we hope to establish great cooperation between #Kazakhstan and #Qatar, especially in the field of tourism.
Daily Questions-Answers, Facts, Idioms, Riddles and Quotes
#QnA
1. The pollutants which move downward with percolating groundwater are called
Ans . Leachates
2. Hasdo Valley in Chhattisgarh is famous for
Ans . Coal mines
3. Special Theory of Relative was proposed in
Ans . 1905
Via @askmenow
--------------------------------
#DidYouKnow
Eiffel Tower is six inches taller in summer due to 'Thermal Expansion'
#Idiom
"A hot potato"
What it means?Check Answer
#Riddle
"Where does today come before yesterday'
What is it?Check Answer
#Quote
"Optimism is a happiness magnet. If you stay positive, good things and good people will be drawn to you."
~ Mary Lou Retton
-----------------------------
Partnership with:Be Like Bro, sarcasticLOL, News Clips, Word Coach, Quiz MCQ, Ask Me Idiom & Ask Me Riddle
Daily Questions-Answers, Facts, Idioms, Riddles and Quotes
#QnA
1. Celsius and Fahrenheit show the same temperature at
Ans . 40
2. Exchange particle in Quark-Quark Interaction
Ans . Gluon
3. The working of a rockets based on the principle of:
Ans . Conservation of momentum
Via @askmenow
--------------------------------
#DidYouKnow
There are ice caves in Iceland that have hot springs.
#Idiom
"Letting the cat out of the bag"
What it means?Check Answer
#Riddle
"What has words, but never speaks"
What is it?Check Answer
#Quote
"Two roads diverged in a wood and I took the one less traveled by, and that made all the difference."
~ Robert Frost
-----------------------------
Partnership with:Be Like Bro, sarcasticLOL, News Clips, Word Coach, Quiz MCQ, Ask Me Idiom & Ask Me Riddle
Daily Questions-Answers, Facts, Idioms, Riddles and Quotes
#QnA
1. In Computer, what is the full form of UPS?
Ans . UPS = Uninterruptable Power Supply
2. Which city is built on more than 100 islands?
Ans . Venice
3. Name of vegetable which is also known as a flower?
Ans . Broccoli
4. Highest electrical conductivity found in which element?
Ans . Silver
5. Thermometer made first by?
Ans . Gauss
Via @askmenow
--------------------------------
#DidYouKnow
Lions have been observed to rest for a major part of the day, usually around 20 hours.
#Idiom
"A blessing in disguise"
What it means?Check Answer
#Riddle
"What can you hold in your left hand but not in your right"
What is it?Check Answer
#Quote
"Circumstances are beyond the control of man, but his conduct is in his own power."~Benjamin Disraeli
-----------------------------
Partnership with:Be Like Bro, sarcasticLOL, News Clips, Word Coach, Ask Me Idiom & Ask Me Riddle
Daily Questions-Answers, Facts, Idioms, Riddles and Quotes
#QnA
1. White Revolution’ is related to what?
Ans . Milk Production
2. A very successful invention ‘Liquid Oxygen’ discovered by whom?
Ans . Dewar
3. What is the radiant energy of the sun is transmitted?
Ans . Short waves
4. What is the chemical formula of ‘Sodium Hydroxide’?
Ans . NAOH
5. The Folded Earth book was written by?
Ans . Anuradha Roy
6. Barometer was invented by?
Ans . F. Banting
7. Which rays is very helpful in Long distance photography?
Ans . Infra-Red rays
Via @askmenow
____________________
____________________
#DidYouKnow
Grasshoppers have ears in their bellies
#Idiom
"A bird in the hand is worth two in the bush"
What it means?Check Answer
#Riddle
I’m light as a feather, yet the strongest person can’t hold me for five minutes.
What am I?Check Answer
#Quote
"If you spend your whole life waiting for the storm, you'll never enjoy the sunshine." ~ Morris West