Для тех кто пишет расширения на 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
👮♂️ Another social media thrill-seeker in Bali has ended up in an immigration report
📍 A video has gone viral showing a tourist speeding on a motorbike and launching off a well-known cliff near Balangan Beach straight into the ocean.
🛵 He tied the bike with a rope to keep it from falling into the water, but it didn’t help — the rented vehicle was badly damaged, and the offender refused to pay for the damages.
#incidents@BaliNews
👮♂️ A major scandal is unfolding in Bali
📰 According to local reports, russian influencer Sergey Domogatsky, known in Indonesian social media as Mr. Terimakasih (“Mr. Thank You”), is suspected of running a large-scale real-estate investment scheme. Amid the ongoing police investigation, Domogatsky has already left Indonesia.
👮♂️ Authorities say there are 30 complaints filed by 29 foreign nationals against the 40-year-old Russian. Victims claim he collected funds under the pretext of investing in luxury property developments on the island — projects that were never completed.
💸 The estimated losses amount to 80 billion Indonesian rupiah, roughly 5 million USD.
🔎 The situation continues to develop as Bali police carry on with the investigation.
#incidents@BaliNews
🚕Waymo robotaxis are back at the center of a scandal
📍 This time, the vehicles caused chaos on the streets of San Francisco.
🚥 The autonomous taxis use the traffic-light system for navigation, so when it goes down, route planning breaks as well.
⛔ For several hours, Waymo cars stood on the roads like bricks, blocking other drivers from getting through.
Is rise of the the machines beginning?
#driverless#incidents@Car_News
😰Three Waymo robotaxis caused a “standoff” and blocked a street in San Francisco
📰 In the northern part of San Francisco, three Waymo autonomous taxis got stuck on a narrow street, completely blocking traffic. Two cars lightly collided while trying to maneuver, after which both went into emergency mode, and the third stopped right in front of them, creating a full traffic jam.
😤 Because of this, residents couldn’t leave their driveways and had to wait for company engineers to intervene and resolve the situation. All vehicles were empty — no passengers were inside.
💬 Waymo commented on the incident, calling it a “learning moment” for improving their autonomous driving system.
#driverless#incidents@Car_News
😱 А very impressive python crawled onto Seminyak beach for a rest yesterday
🐍 It was not allowed to rest, though – despite its status as a public beach, the snake was politely but firmly asked to leave.
@BaliNews
#places#incidents#Seminyak
🗺63 bogus investors kicked out of Bali, 111 more await deportation
📰 The Immigration Service conducted Operation Wira Waspada from January 14 to February 21, 2025, together with the police and the Investment Coordination Board (BKPM).
🕵️♂️ During the operation, about 520 foreign nationals were found to have used investor visas to enter Bali although they were in the country for other purposes. Most of these foreigners came from China, Russia, Pakistan, India and Australia and were engaged in trading and consulting businesses.
💸 Due to such practices, Indonesia has lost investments worth about 1.6 trillion IDR.
@BaliNews
#incidents#realestate#investment
🇩🇪 Plus de 20 personnes ont été blessées à des degrés divers lorsqu’une voiture a percuté des personnes dans le centre de Leipzig (est de l'Allemagne), tandis que deux morts ont été signalés. C’est ce qu’a déclaré le chef des pompiers de la ville, Axel Schuh.
Deux personnes ont été grièvement blessées, elles ont immédiatement reçu les premiers soins avant d’être transportées en soins intensifs. [...] En outre, nous avons aussi une vingtaine de blessés,
a-t-il indiqué, cité par le journal Leipziger Volkszeitung.
#incidents#allemagne#voiture#victimes
🇩🇪 Au moins deux personnes ont été tuées lorsqu’une voiture a percuté un groupe de personnes dans le centre de Leipzig (est de l’Allemagne). C’est ce qu’a rapporté le journal Berliner Zeitung, citant son correspondant sur place.
Deux autres personnes ont été grièvement blessées, tandis que plusieurs autres ont subi des blessures moins graves. Selon les premières informations, l’accident s’est produit dans le centre historique de Leipzig, sur la principale rue commerçante de la ville.
#incidents#allemagne#voiture#victimes
Key Events of Monday, March 16
Bailiffs seized 32.1 billion rubles from Yuzhuralzoloto. Near Moscow, 61 drones were shot down within 24 hours. The Israeli army launched an operation against Hezbollah in Lebanon. Telegram fined 35 million rubles for incomplete removal of banned content. A powerful solar flare threatens a geomagnetic storm. The Ministry of Culture announced personnel changes. Gas prices rose in Moscow. Medvedev returned to ATP top 10.
#Russia#InternationalNews#Incidents#Culture#Sports
The main news of Russia and the world ishere.