Files
cthulhu/tests/qt_mumble_table.py
Storm Dragon 3dbd7f2554 Avoid repeating Mumble server labels across columns
Collapse identical full-row labels only for Mumble while preserving mixed column data and repeated values from other providers. Add Qt native coverage and document live saved-server listening confirmation.
2026-11-07 20:12:25 -05:00

35 lines
1.2 KiB
Python

#!/usr/bin/env python3
# Copyright (c) 2026 Storm Dragon
# Authors: Storm Dragon, Angus Kola
# SPDX-License-Identifier: GPL-3.0-or-later
"""Private Qt table reproducing Mumble's repeated accessible column labels."""
import ctypes
import sys
from PySide6 import QtCore, QtWidgets
if ctypes.CDLL(None).prctl(15, sys.argv[1].encode(), 0, 0, 0) != 0:
raise RuntimeError("Cannot set fixture process identity")
application = QtWidgets.QApplication([])
window = QtWidgets.QMainWindow()
window.setWindowTitle("Server table fixture")
table = QtWidgets.QTreeWidget()
table.setAccessibleName("Server list")
table.setHeaderLabels(["Servername", "Ping", "Users"])
for labels in [
["Server Alpha"] * 3,
["Server Beta", "12", "12"],
["Server Gamma, 界"] * 3,
]:
item = QtWidgets.QTreeWidgetItem([labels[0], "12", "12"])
for columnIndex, label in enumerate(labels):
item.setData(columnIndex, QtCore.Qt.ItemDataRole.AccessibleTextRole, label)
table.addTopLevelItem(item)
window.setCentralWidget(table)
window.resize(500, 250)
window.show()
table.setFocus()
QtCore.QTimer.singleShot(0, lambda: print("ready", int(window.winId()), flush=True))
application.exec()