Для тех кто пишет расширения на 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
Which linguistic term, named after an Oxford professor, describes the humorous mistake of swapping the initial sounds of two words, as in
➖“belly jeans” instead of “jelly beans”
➖“our queer old dean” instead of “our dear old queen”
A) Malapropism
B) Anagram
C) Palindrome
D) Spoonerism
@languagetrivia#term
😮Did you know that some words can mean their own opposite?
☯️ There's a cool linguistic phenomenon where certain words have two opposing meanings. These words are like linguistic chameleons, adapting to completely different interpretations in different scenarios!
Here are 5 examples of such words:
➖Sanction
➖To officially approve or permit something: The government sanctioned the new policy.
➖To punish or penalize: The country faced sanctions for its actions.
➖Dust
➖To remove dust: I dusted the shelves yesterday.
➖To add a layer of fine particles: She dusted the cake with powdered sugar.
➖Overlook
➖To supervise or watch over: The manager will overlook the project.
➖To fail to notice something: I accidentally overlooked that mistake.
➖Clip
➖To attach or fasten: He clipped the papers together with a binder clip.
➖To cut or remove: The gardener clipped the hedges neatly.
➖Screen
➖To show or display something: The theater screened a new movie.
➖To block or shield: Trees screened the house from view.
Can you think of any other words like that? Let me know in the comments 💬
Quiz Time!
What do we call words that mean their own opposite? 🧐
A. Antonyms
B. Palindromes
C. Contronyms
D. Capitonyms
Tap ❤️ if you found this interesting
@languagetrivia#theory#term
Sometimes, we don't want to be too direct with our words. For instance, instead of saying someone "died," we might say they "passed away." This way of softening our language helps us avoid discomfort or show sensitivity in delicate situations.
People use this kind of phrasing in various scenarios:
➖To avoid offending someone (e.g. saying "full-figured" instead of "overweight")
➖To speak politely about jobs (e.g. "sanitation worker" instead of "garbage collector")
➖To make bad news sound less harsh (e.g. "let go" instead of "fired" or ”downsizing” instead of “cutting jobs”)
➖To talk about sensitive topics (e.g. "use the restroom" instead of "go to the toilet" or ”gosh" instead of "God")
These phrases help us navigate social interactions tactfully, showing how language can soften or enhance our message.
What do we call this practice of using less direct language to soften or sugarcoat an idea?
Options:
A) Oxymoron
B) Metaphor
C) Hyperbole
D) Euphemism
Take the quiz below to see the correct answer
@languagetrivia#theory#term
❓What word hides behind the spoiler? Don't reveal it yet✋
"œ" and "æ" are examples of a ligature. A ligature occurs where two or more graphemes or letters are joined to form a single character. These were introduced in handwritten scripts and early printing to improve efficiency, aesthetics, and save space. In handwriting, they reduced the number of strokes needed to write certain letter combinations. In typesetting, they helped conserve space in narrow columns. For example, "œ" is used in French words like cœur (heart) and œuvre (work) and "æ" can sometimes be seen in English, as in encyclopædia.
So what is it called when two or more letters are combined into a single character like "œ" and "æ"?
A) Digraph
B) Ligature
C) Umlaut
D) Diphthong
Tap to reveal the correct answer:
These characters are called ligatures
Ligatures (Wikipedia)
List of English words that may be spelled with a ligature
And the other terms from above:
➖A digraph combines two letters for one sound (e.g., "sh")
➖An umlaut (¨) changes vowel sounds (e.g., regular "u" vs. "ü" as in über in German)
➖A diphthong blends two vowel sounds in one syllable (e.g., "ou" in house).
Tap ❤️ if you've learnt something new.
@languagetrivia#theory#term
What do you call it when a phrase or the components of a word get translated literally from one language to another and the original meaning is preserved?
For instance,
English "skyscraper" →
French "gratte-ciel" (“scrape-sky”),
German "Wolkenkratzer" (“cloud scraper”),
Spanish "rascacielos" (“scrape skies”).
Press ❤️
Follow @languagetrivia to learn more about languages
#theory#term
There is a phenomenon where some twins develop a private “language” understood only by them, often using invented words, sounds, or gestures. It usually emerges in early childhood due to their close bond and shared environment and may fade as they learn standard language skills.
What is the name of this phenomenon?
Join 🦫@languagetrivia for more interesting language facts
#theory#term
Did you know that the word apron has an interesting history? Originally, it was napron, derived from the Old French word naperon, meaning a small tablecloth or napkin. Over time, due to the way people spoke, the phrase “a napron” was misinterpreted as “an apron,” and the word changed!
This linguistic shift happens when the boundaries between words are reinterpreted, often influenced by how words are pronounced. Another example is nickname, which came from "an eke name" (meaning an additional name) but was turned into "a nickname."
What is this phenomenon, where words change due to a reinterpretation of their boundaries, called?
A. Rebracketing
B. Metathesis
C. Semantic Change
D. Semantic Broadening
@languagetrivia#etymology#theory#term
With the help of what literary technique is the humorous effect in this meme achieved?
Options:
A) Spoonerism
B) Pun
C) In-joke
D) Malapropism
Take the quiz below to find out
@languagetrivia#meme#term
The ampersand (&) symbol has a rich history intertwined with the evolution of the English alphabet. Originally, it was a ligature of the Latin word “et,” meaning “and.” Over time, this symbol became so integral to writing that it was included as the 27th character in the English alphabet, following ‘Z’. When reciting the alphabet, people would conclude with “X, Y, Z, and per se and,” which translates to “and, by itself, and.” This phrase was eventually slurred together into the single term “ampersand.”
Source
Tap ❤️ if you found this interesting
@languagetrivia#theory#term#symbol#etymology