В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
🗓World Press Freedom Day is marked every year on May 3 to remind the international community about the importance of respecting media independence and pluralism and protecting the rights of journalists. The day was established by the UN General Assembly Resolution on December 20, 1993.
❗️ On this important day for the media worldwide, we would like to draw public attention to the dramatic situation with the freedom of expression and access to information in the countries of the collective West. Contrary to their international commitments, the so-called democratic countries continue to suppress any form of dissent. Investigative journalist Julian Assange remains incarcerated in a London prison, and there are also other prisoners of conscience.
We are still waiting for a reaction from the concerned international human rights organisations to the death of Gonzalo Lira, a Chilean-American journalist betrayed by both his native countries, in a Ukrainian prison in January 2024.
We see that the Western governments continue with their arbitrary treatment of Russian media outlets and journalists, who have felt the full effects of the Western neo-liberal mechanism of repression.
Special mention should be made of the dire situation with media freedom in the Baltic states and Moldova, whose governments, acting with the tacit approval of their Western handlers, are harassing Russian-language media under the pretext of fighting against “Russian propaganda.”
Zelensky’s criminal regime has eliminated the last vestiges of the freedom of speech in Ukraine by banning all opposition media outlets and denying access to thousands of online resources. Their overseas masters’ connivance has led, in particular, to savage attacks on Russian journalists. One more name has recently been added to the list of Russian correspondents killed by Ukrainian thugs. Izvestia military correspondent Semyon Yeryomin was deliberately killed in the line of duty in a neo-Nazi drone attack. UNESCO Director-General Audrey Azoulay has not condemned his cold-blooded murder or, for that matter, the murder of other Russian journalists – Darya Dugina (Platonova), Vladlen Tatarsky (Maxim Fomin), Oleg Klokov, Rostislav Zhuravlev and Boris Maksudov.
☝️ Regrettably, World Press Freedom Day, which was intended to be a universal event, is gradually becoming just another insignificant day. This situation will only change if the world takes an honest look at the situation with the freedom of the media and the safety of journalists, a look that is not distorted by Western propaganda.
#FreedomOfSpeech
In Hong Kong, Security Chief Tang's intrusion into press freedom sparks worry as truth-telling writers face warnings to 'tread carefully.' Tang cautions media editors against publishing anti-government pieces, stressing writers' accountability. Ming Pao's chief editor also advises columnists to exercise caution amid hints of looming crises. These events unfolded recently, prompting netizens to draw parallels between these warnings and underworld 'watch your step' advice, reminiscent of gangster-like directives. #HongKong#FreedomOfSpeech#MediaScrutiny
Hong Kong Security Bureau Chief Tang Ping-keung continues to accuse Ted Hui and Chris Patten, but fails to acknowledge that the proposed Article 23 legislation could further undermine freedom in Hong Kong. Despite concerns raised by critics, Tang maintains that the bill is aimed at safeguarding press freedom and freedom of speech. However, many remain skeptical about the potential implications of this legislation on Hong Kong's cherished values of liberty and autonomy.
#Article23#PressFreedom#FreedomOfSpeech#TedHui
❗️ On this day nine years ago, Ukrainian writer and opposition journalist Oles Buzina was assassinated in front of hi️s home in Kiev.
He became one of the many victims of the Kiev criminal regime because he posed a threat to it – he publicly criticised and exposed the true nature of the neo-Nazi forces that had gained power as a result of the bloody coup d'état in Ukraine.
Buzina urged the then Ukrainian leadership to establish a dialogue with the inhabitants of Donbass and spoke about the need to consolidate the rights of the Russian language, which seriously irritated the post-coup officials in Kiev. He also received threats from Ukrainian radicals because his interpretation of Ukraine's historical path did not coincide with the nationalist ideology.
☝️ Such an active and firm civil position of Oles Buzina cost him his life.
A few days before his death, the journalist's personal data, including his home address, appeared on the Myrotrvorets (Peacemaker) extremist website, which contains personal information about all public figures, publicists, reporters, and journalists undesirable to the Kiev regime, a resource created literally as a practical guide for preparing terrorist acts.
Despite the fact that condemnation of the murder, condolences to the victim's family and demands for a comprehensive investigation were voiced by the #UN Secretary General, #OSCE and #US State Department officials and many civil society organisations, the perpetrators of his murder were never identified and the suspects were released.
After almost a decade, it is clear that the situation with freedom of speech in Ukraine has degraded to a critical level.
After almost a decade, it is clear that the situation with freedom of speech in Ukraine has degraded to a critical level. All media outlets in opposition to the Kiev regime are banned, and any manifestations of dissent are brutally suppressed and erased from the information space.
Unwanted journalists, primarily Russian ones, are being hunted down with all possible weapons. In the past two years alone, the Kiev regime has killed journalists Darya Dugina (Platonova), Oleg Klokov, Vladlen Tatarsky (Maxim Fomin), Rostislav Zhuravlyov and Boris Maksudov.
❌ Terrorist methods are being used to implement these criminal plans, while Ukraine's Western handlers and biased human rights organisations continue to turn a blind eye to these evil deeds.
#Ukraine#FreedomOfPress#FreedomOfSpeech
Chef Executive of Hong Kong, John Lee, announces plans to establish a 'Response and Rebuttal Team' in response to online disinformation. This move raises concerns about government control over information. Possible forms of the team include a government 'Ministry of Truth' to determine facts, a dedicated website for countering foreign and local opinions, or a large-scale online army. The implications for freedom of speech and collaboration with national security agencies are worrisome. The naming choice of the team reflects the leadership's questionable thinking and intelligence.
#OnlineArmy#freedomofspeech#23Articles#FakeNewsLaw
#HongKong’s Evolving Boundaries of Expression
Recent headlines spotlight how even symbolic gestures—like attending a U.S. Independence Day event or downloading a mobile game—can now fall under the shadow of Hong Kong’s #NationalSecurityLaw. As boundaries tighten, the space for artistic and ideological expression continues to shrink. The warning about a Taiwan-developed game and the scrutiny of July 4th celebrations suggest a growing sensitivity to perceived foreign influence and political messaging. These developments show how the government increasingly uses the law not just to manage dissent, but to shape and control people’s thinking.
#香港#言論自由 的新界線
近日新聞指出,哪怕只是參加美國獨立日活動,或下載一款台灣開發的手機遊戲,如今都可能觸及香港《#國安法》的紅線。隨著管控收緊,藝術與思想表達的空間不斷縮小。對一款遊戲的警告以及對美國國慶的警覺,顯示出當局對外來影響及政治象徵越來越敏感。這一連串事件顯示,政府不僅是用法律來打壓異見,而是在試圖塑造、甚至控制市民的思想。
#FreeHongKong#Freedomofspeech
在審訊中,黎智英稱自己為政治犯,但法官馮麗冰阻止他這樣說,強調這次審訊並不涉及政治⁽¹⁾。這讓人懷疑法官是否在幫助中共破壞香港的言論自由,成為中國破壞司法制度的政治工具。
#黎智英#政治犯#言論自由
During the trial, Jimmy Lai referred to himself as a political prisoner, but Judge Esther Toh interrupted him, insisting that the trial was not political⁽¹⁾. This raises concerns about whether the judge is aiding the CCP in undermining freedom of speech and serving as a political tool for China to dismantle the judiciary.
#JimmyLai#PoliticalPrisoner#FreedomOfSpeech
The #HK government denied a #Bloomberg reporter from entering Hong Kong. Bloomberg is considered as the most reliable source for investors around the world. I guess #CCP is doing her best to sabotage Hong Kong as financial hub and run full on communist.
#PressFreedom#freedomofspeech#freeHK
2022年10月,香港示威者在中國駐英國曼徹斯特總領事館外遭到攻擊。上周六(28日),一名記者在採訪潑漆事件時,被疑似領館人員阻撓,甚至有人恐嚇他「知你住邊」。這樣的威脅令人擔憂,他們如何知道記者的住處?難道在英國收集記者數據?
如果是這樣,中共在其他國家的行動究竟是什麼?警方調查後強調新聞自由,但該案件因領館不配合而暫時結案。
#中國領事館#新聞自由
In October 2022, Hong Kong protesters were attacked outside the Chinese Consulate in Manchester. Last Saturday (28th), a journalist covering vandalism claims faced obstruction from alleged consulate staff, with one threatening him, saying, "I know where you live." How did they know this? Are they collecting journalists' data in the UK?
If so, what operations is the CCP conducting in other countries? Police emphasized press freedom but closed the case due to the consulate's lack of cooperation.
#CCPInfiltration#ccp#freedomofspeech#pressfreedom
政府於周二(24日)刊憲,保安局局長鄧炳強行使《維護國家安全條例》,對七名涉嫌違反《國安法》的海外人士採取針對措施,包括撤銷特區護照、禁向他們提供資金等。
這是政府第二度依據該條例對潛逃者採取行動。鄧炳強表示,這些人潛逃海外後仍從事危害國家安全的活動,並會議外國官員請求制裁香港官員。這一行動顯示出香港政府對海外港人的威脅,試圖阻止人們發聲,壓制言論自由。
#國安法#香港#言論自由
On Tuesday (24th), the government published a notice, with Secretary for Security Chris Tang invoking the National Security Law to take targeted measures against seven overseas individuals suspected of violating the law, including the revocation of their SAR passports and prohibition of funding.
This marks the second time the government has acted against fugitives under this law. Tang stated that these individuals continued to engage in activities harmful to national security after fleeing overseas, including meeting foreign officials to request sanctions against Hong Kong officials. This action reflects the Hong Kong government's threats to overseas Hongkongers and attempts to silence voices, suppressing freedom of speech.
#NationalSecurity#NSL#HongKong#Government#FreedomOfSpeech
警方通緝黃大仙前區議員 #劉珈汶,並拘捕其家人協助調查。控方指控她鼓吹香港獨立,請求對中港制裁。同時,前立法會議員 #許智峯 透露其家人在港財產被充公。
這顯示港府和警方可無理由以「國安威脅」為由逮捕任何人,侵害言論自由。全球應關注並呼籲保護香港基本自由。
#言論自由#人權#香港
Hong Kong's National Security Department has issued a wanted notice for former Wong Tai Sin District Councillor #KavinLau and detained her family for investigation. She is accused of advocating for Hong Kong's independence and calling for sanctions against China and Hong Kong. Meanwhile, former Legislative Council member #TedHui revealed that his family's assets in Hong Kong have been confiscated.
This demonstrates that the Hong Kong government and police can arbitrarily arrest anyone claiming they are a national security threat, without reason. The global community must pay attention and call for the protection of fundamental freedoms in Hong Kong.
#FreedomOfSpeech#HumanRights#FreeHK
香港民意研究所的創辦人鍾庭耀因協助一名「已在海外潛逃的通緝犯」而遭警方調查。警方聲稱這與鍾的民調結果無關,但這清楚顯示出他們正試圖干預調查結果,對學術自由和言論自由造成嚴重損害。
這一行為進一步削弱了香港的國際地位,令人擔憂未來的民主和自由。自2020年國安法實施以來,香港的社會運動和言論自由受到嚴峻挑戰。我們必須警惕這一趨勢,並捍衛我們的權利!
#國安法#香港#鍾庭耀#言論自由#學術自由
Chung Ting-yao, founder of the Hong Kong Public Opinion Research Institute, is under investigation for assisting a “wanted person who has absconded overseas.” While the police claim this is not about Chung’s poll results, it clearly indicates an attempt to interfere with the outcomes, severely undermining academic freedom and freedom of speech.
This action further damages Hong Kong’s international standing and raises concerns about the future of democracy and freedom in the city. Since the implementation of the National Security Law in 2020, social movements and freedom of expression have faced intense challenges. We must remain vigilant against this trend and defend our rights!
#NSL#HongKong#ChungTingYao#FreedomOfSpeech#AcademicFreedom