fix: adaptive empty state, escaped button ampersand, no tenant preselection for APs
- Empty states hide icon and text when space is short instead of being squeezed; title and button always stay readable - "Standorte & Mandanten" button no longer shows a mnemonic underscore - The tenant on the access point page is always chosen deliberately Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
ba50527ee5
commit
b402591cdf
2 files changed
+19
-12
No files matched your search
@@ -144,7 +144,7 @@ class AccessPointsPage(Page):
|
|||||||
self.body.addWidget(source)
|
self.body.addWidget(source)
|
||||||
|
|
||||||
result = Card("Abgleich")
|
result = Card("Abgleich")
|
||||||
self.sites_button = result.add_action(button("Standorte & Mandanten …", "globe", on_click=self.map_sites))
|
self.sites_button = result.add_action(button("Standorte && Mandanten …", "globe", on_click=self.map_sites))
|
||||||
self.refresh_button = result.add_action(button("Neu abgleichen", "refresh", on_click=self.compare))
|
self.refresh_button = result.add_action(button("Neu abgleichen", "refresh", on_click=self.compare))
|
||||||
filters = QHBoxLayout()
|
filters = QHBoxLayout()
|
||||||
self.search = SearchField("Name, S/N, MAC, IP, Standort …")
|
self.search = SearchField("Name, S/N, MAC, IP, Standort …")
|
||||||
@@ -269,7 +269,8 @@ class AccessPointsPage(Page):
|
|||||||
def done(result):
|
def done(result):
|
||||||
self.tenants, roles = result
|
self.tenants, roles = result
|
||||||
settings = self._settings()
|
settings = self._settings()
|
||||||
self.tenant.set_items(self.tenants, settings.get("tenant_id"))
|
# The tenant is always chosen deliberately – never preselected.
|
||||||
|
self.tenant.set_items(self.tenants)
|
||||||
role_id = settings.get("role_id") or next(
|
role_id = settings.get("role_id") or next(
|
||||||
(role_id for name, role_id in roles if name.casefold() in ROLE_HINTS
|
(role_id for name, role_id in roles if name.casefold() in ROLE_HINTS
|
||||||
or "access point" in name.casefold()), None)
|
or "access point" in name.casefold()), None)
|
||||||
|
|||||||
+16
-10
@@ -257,20 +257,26 @@ class EmptyState(QWidget):
|
|||||||
layout.addStretch(2)
|
layout.addStretch(2)
|
||||||
layout.setContentsMargins(24, 16, 24, 16)
|
layout.setContentsMargins(24, 16, 24, 16)
|
||||||
|
|
||||||
def minimumSizeHint(self):
|
def _heights(self, width):
|
||||||
# Word-wrapped labels report almost no minimum height, so a small card
|
width = max(width, 320) - 48
|
||||||
# would squeeze icon, title and text on top of each other.
|
core = 32 + self.title_label.heightForWidth(width) + 10
|
||||||
width = max(self.width(), 320) - 48
|
|
||||||
height = 32 + 56 + self.title_label.heightForWidth(width) + self.text_label.heightForWidth(min(width, 520))
|
|
||||||
height += 2 * 10
|
|
||||||
if self.action is not None:
|
if self.action is not None:
|
||||||
height += 16 + self.action.sizeHint().height()
|
core += 16 + self.action.sizeHint().height()
|
||||||
return QSize(260, height)
|
return core, self.text_label.heightForWidth(min(width, 520)) + 10, 56 + 10
|
||||||
|
|
||||||
|
def minimumSizeHint(self):
|
||||||
|
# Title and button always fit; icon and text are dropped when space is short.
|
||||||
|
core, _text, _icon = self._heights(self.width())
|
||||||
|
return QSize(260, core)
|
||||||
|
|
||||||
def resizeEvent(self, event):
|
def resizeEvent(self, event):
|
||||||
super().resizeEvent(event)
|
super().resizeEvent(event)
|
||||||
if event.size().width() != event.oldSize().width():
|
# Word-wrapped labels report almost no minimum height, so a small card
|
||||||
self.updateGeometry()
|
# would squeeze icon, title, text and button on top of each other.
|
||||||
|
core, text, icon_height = self._heights(event.size().width())
|
||||||
|
available = event.size().height()
|
||||||
|
self.text_label.setVisible(available >= core + text)
|
||||||
|
self.icon_label.setVisible(available >= core + text + icon_height)
|
||||||
|
|
||||||
def set_text(self, title=None, text=None):
|
def set_text(self, title=None, text=None):
|
||||||
if title is not None:
|
if title is not None:
|
||||||
|
|||||||
Reference in new issue
Block a user