В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль QtCompat (compatibility). Там не так много функций но они довольно полезны.
Этот модуль содержит унификаци модуля shiboken2, функций loadUi, translate и несколько переименованных функций классов или изменённую сигнатуру аргументов и возвращаемых значений. Это единственное исключение из правила когда вам потребуется где-то изменить свой код кроме импортов и этот код не похож на обычный код PySide2.
Например, в PyQt4 и PySide есть метод
QHeaderView.setResizeMode
Для PyQt5 и PySide2 они были благополучно переименованы в
QHeaderView.setSectionResizeMode
Чтобы применить этот метод следует использовать такой код
from Qt import QtCompath
header = self.horizontalHeader()
QtCompat.QHeaderView.setSectionResizeMode(header, QtWidgets.QHeaderView.Fixed)
Унификация загрузки UI файлов:
# PySide2
from PySide2.QtUiTools import QUiLoader
loader = QUiLoader()
widget = loader.load(ui_file)
# PyQt5
from PyQt5 import uic
widget = uic.loadUi(ui_file)
# Qt.py
from Qt import QtCompat
widget = QtCompat.loadUi(ui_file)
Хорошо что таких моментов не много и их легко запомнить.
Полный список можно посмотреть в таблице.
#qt#tricks
Плагин для QGIS с помощью ChatGPT – Wurman Dots
Создавать точки Вурмана в QGIS теперь можно с помощью плагина Wurman Dots. Пока что инструмент позволяет только визуализировать плотность объектов точечного слоя. Но планируется расширить его возможности и для других сценариев.
Примечательно, что код скрипта, который лёг в основу плагина, полностью был написан ChatGPT. То есть его можно было запустить в консоли Python QGIS.
На эту работу потребовалась несколько вечеров и добрая пара десятков версий кода, который шлифовался промптами. По итогу парочка ошибок осталась, их исправили коллеги из NextGIS и превратили скрипт в полноценный плагин.
Возможно, специалисты Python быстрее бы разработали этот плагин и без AI, но я не программист :)
Wurman Dots уже доступен в QGIS. Узнать больше о плагине можно в материале. Работа продолжается.
#imap
🪐 NASA’s Interstellar Mapping and Acceleration Probe (IMAP), set to launch soon, will study the boundary where the solar wind from our Sun meets interstellar space—the region Voyager 1 and Voyager 2 have just crossed. By learning how particles and energy behave at this distant frontier, IMAP is paving the way for future interstellar journeys, helping scientists prepare for the challenges of sending spacecraft far beyond the influence of the Sun to new worlds around stars like Alpha Centauri. ✨
#interstellar⚡#travel⚡#IMAP⚡#heliosphere⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
#rust#caldav#carddav#imap#jmap#mail#pop3#rust#server#smtp#webdav
Stalwart is a secure, fast, and scalable open-source mail and collaboration server supporting all major email protocols (IMAP, SMTP, JMAP, POP3) plus calendar, contacts, and file sharing. It offers strong built-in spam and phishing protection, advanced message authentication (DMARC, DKIM, SPF), and flexible storage options. Designed for high availability and fault tolerance, it can scale from small setups to thousands of nodes without complex proxies. Its web-based admin interface and automation tools simplify management. Using Stalwart helps you control your email securely, improve collaboration, and reduce reliance on big tech, making your communication more private and reliable.
https://github.com/stalwartlabs/stalwart