TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #381 · 23 окт.

Установить свойства виджета в PySide можно не только через соответствующие методы и конструктор класса. Можно их изменять с помощью метода setProperty по имени. btn = QPushButton("Click Me") btn.setProperty("flat", True) Это аналогично вызову btn.setFlat(True) Если указать несуществующее свойство, то оно просто создается btn.setProperty("btnType", "super") Получить его значение можно методом .property(name) btn_type = btn.property("btnType") Когда это может быть полезно? ▫️Можно просто хранить какие то данные в виджете и потом их доставать обратно widget = QWidget() widget.setProperty('my_data', 123) print(widget.property('my_data')) ▫️ Назначая эти свойства разным виджетам можно потом отличить виджеты во время итераци по ним. Например, найти все кнопки со свойством my_data="superbtn". Но ведь вместо кастомного свойства можно использовать objectName, будет тот же результат. Да, но y ObjectName есть ограничение - только строки. ▫️ Если нам потребуется не просто поиск а, например, сортировка по числу, то свойства позволяют нам это сделать. Поддерживается любой тип данных widget.setProperty('my_data', {'Key': 'value'}) widget.setProperty('order', 1) all_widgets.sort(key=w: w.property('order')) Но ведь Python позволяет всё вышеперечисленное сделать простым созданием атрибута у объекта widget.order = 1 widget.my_data = 123 Да, но я думаю что не надо объяснять почему не стоит так делать. К тому же, если у виджета нет свойства то метод .property(name) вернет None, а отсутствующий атрибут выбросит исключение. ▫️ Действительно полезное применение кастомным свойствам - контроль стилей. Здесь атрибутами не обойтись, нужны именно свойства. Дело в том, что в селекторах стилей можно указывать конкретные свойства виджетов на которые следует назначать стиль. Просто запустите этот код from PySide2.QtWidgets import * if __name__ == "__main__": app = QApplication([]) widget = QWidget(minimumWidth=300) layout = QVBoxLayout(widget) btn1 = QPushButton("Action 1") btn2 = QPushButton("Action 2") btn3 = QPushButton("Action 3", flat=True) layout.addWidget(btn1) layout.addWidget(btn2) layout.addWidget(btn3) # добавим кастомное свойство одной кнопке btn1.setProperty("btnType", "super") # добавляем стили widget.setStyleSheet( """ QPushButton[btnType="super"] { background-color: yellow; color: red; } QPushButton[flat="true"] { color: yellow; } """ ) widget.show() app.exec_() С помощью селектора мы избирательно назначили стили на конкретные кнопки. Как получить список всех кастомный свойств? Функция получения списка кастомных свойств отличается от получения дефолтных. def print_widget_dyn_properties(widget): for prop_name in widget.dynamicPropertyNames(): property_name = prop_name.data().decode() property_value = widget.property(property_name) print(f"{property_name}: {property_value}") #tricks#qt

Hashtags

Резултати

Пронајдени 1 слични објави

Пребарај: #dabat

当前筛选 #dabat清除筛选
Red Nile

@rednile12 · Post #11017 · 16.02.2026 г., 16:08

📝ANALYSIS: The Unmasking of Addis Standard: Independence or Illusion? ✍🏽By Dhuga Bilisuma | Red Nile Contributor 📅 February 16, 2026 In a detailed piece for RedNile, contributor Dhuga Bilisuma subjects Addis Standard’s recent coverage to rigorous academic scrutiny, questioning whether the outlet’s self-proclaimed “independence” withstands analytical review. Drawing from established media theory — including the framing work of Robert Entman and agenda-setting theory — the article examines three editorial patterns from January–February 2026 that raise concerns about conflict-sensitive reporting standards in Ethiopia’s fragile post-conflict environment. 1️⃣ Territorial Framing: “Wolkait” vs. “Western Tigray” When Prime Minister Abiy Ahmed referred to “Wolkait” during parliamentary remarks, Addis Standard’s headline substituted the term with “Western Tigray.” 📌The Critique: Framing theory suggests such terminology shifts are not neutral. In a contested territorial dispute, choosing nomenclature different from the speaker’s own wording can signal narrative alignment — especially when competing historical and constitutional claims are involved. The report, according to Bilisuma, lacked the contextual clarification recommended by conflict-sensitive journalism standards. 2️⃣ Agenda-Setting: Selective Visibility of Protests In late January, demonstrations reportedly took place in #Telemt, #Humera, #Wofla, #Korem, #Zata, #Dabat, #Debark, and #Dejach_Meda, with protesters calling for full implementation of the 2022 Pretoria Peace Agreement. #AddisStandard reportedly provided no coverage of these protests. 📌The Critique: Agenda-setting theory argues that what media omits can be as influential as what it highlights. For diaspora readers — who rely heavily on English-language reporting — such omissions may shape international perception by rendering certain grievances invisible in global discourse. 3️⃣ Post-Publication Revision: The “Maneuver” Case In reporting remarks from the Tigray Interim Administration, the outlet initially used the military term “maneuvering” to describe troop movements. 📌The Critique: While revisions are common in journalism, Bilisuma points to a pattern of reactive, non-transparent language adjustments. In a post-conflict setting governed by the Pretoria Agreement, terms like “maneuver,” “movement,” or “deployment” carry significant implications regarding compliance or breach. Inconsistent transparency in edits can undermine public trust. 4️⃣ The Broader Pattern: Asymmetrical Context The article argues that detailed historical grievances and counter-arguments are frequently added when framing federal officials. However, similar contextual depth is not consistently applied when reporting on actors associated with #TPLF leadership. 📌The Critique: This uneven distribution of contextual scrutiny may generate cumulative narrative asymmetry — shaping reader perception without explicit editorial positioning. 🧭 The Verdict Bilisuma stops short of alleging intentional bias. Instead, he argues that the cumulative effect of terminology choices, selective coverage, and revision practices constructs a particular political terrain for readers. For diaspora audiences — whose understanding of events often depends on outlets like #AddisStandard — these framing dynamics carry amplified consequences. “Media independence is not established solely through mission statements. It is demonstrated through transparent editorial standards.” ♦️Bottom Line: A must-read for anyone who consumes Ethiopian media critically. In fragile post-conflict societies, framing is never just semantics — it is politics. 📌Read the full article here: The Unmasking of Addis Standard: Independence or Illusion? #Ethiopia#MediaAnalysis#AddisStandard#RedNile#ConflictReporting#Framing