Keep the machine checklist label clear at high DPI
This commit is contained in:
@@ -82,7 +82,7 @@ class MachineDropdown(QPushButton):
|
|||||||
self.setSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed)
|
self.setSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed)
|
||||||
self.setMinimumWidth(145)
|
self.setMinimumWidth(145)
|
||||||
self.setStyleSheet("""
|
self.setStyleSheet("""
|
||||||
QPushButton { text-align: left; padding-left: 8px; padding-right: 20px; }
|
QPushButton { text-align: left; padding: 3px 22px 3px 8px; min-height: 17px; }
|
||||||
QPushButton::menu-indicator { subcontrol-position: center right; right: 5px; }
|
QPushButton::menu-indicator { subcontrol-position: center right; right: 5px; }
|
||||||
""")
|
""")
|
||||||
self.checklist = MachineMenu(dashboard, toggle, self)
|
self.checklist = MachineMenu(dashboard, toggle, self)
|
||||||
@@ -98,6 +98,9 @@ class MachineDropdown(QPushButton):
|
|||||||
label = "All Systems"
|
label = "All Systems"
|
||||||
else:
|
else:
|
||||||
label = f"{len(names)} Systems Selected"
|
label = f"{len(names)} Systems Selected"
|
||||||
|
metrics = self.fontMetrics()
|
||||||
|
label = metrics.elidedText(label, Qt.TextElideMode.ElideRight, 165)
|
||||||
|
self.setMinimumWidth(max(145, metrics.horizontalAdvance(label) + 34))
|
||||||
self.setText(label)
|
self.setText(label)
|
||||||
self.setToolTip("\n".join(names))
|
self.setToolTip("\n".join(names))
|
||||||
self.checklist.sync()
|
self.checklist.sync()
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ class HoverMonitor:
|
|||||||
if self.location is not None and not self.popup.drag.active:
|
if self.location is not None and not self.popup.drag.active:
|
||||||
screen, rect = self.location
|
screen, rect = self.location
|
||||||
area = screen.availableGeometry()
|
area = screen.availableGeometry()
|
||||||
|
self.popup.layout().activate()
|
||||||
position = place_popup(area, rect, self.popup.popup_size())
|
position = place_popup(area, rect, self.popup.popup_size())
|
||||||
menu = self.popup.machine.checklist
|
menu = self.popup.machine.checklist
|
||||||
if menu.isVisible():
|
if menu.isVisible():
|
||||||
|
|||||||
@@ -639,6 +639,7 @@ def verify_machine_display(session, wait_for, results, captures):
|
|||||||
assert hover.single.isVisible() == (len(wanted) == 1)
|
assert hover.single.isVisible() == (len(wanted) == 1)
|
||||||
assert hover.simultaneous.isVisible() == (len(wanted) > 1)
|
assert hover.simultaneous.isVisible() == (len(wanted) > 1)
|
||||||
assert hover.machine.text() == label
|
assert hover.machine.text() == label
|
||||||
|
assert hover.machine.width() >= hover.machine.fontMetrics().horizontalAdvance(label) + 24
|
||||||
if name == "rain":
|
if name == "rain":
|
||||||
observed = history.latest(phantom, TOTAL, "ram.util")
|
observed = history.latest(phantom, TOTAL, "ram.util")
|
||||||
assert observed is not None
|
assert observed is not None
|
||||||
|
|||||||
Reference in New Issue
Block a user