diff --git a/client/ayon_core/tools/utils/dialogs.py b/client/ayon_core/tools/utils/dialogs.py index 5dd0ddd54e..6dc3cf1d8b 100644 --- a/client/ayon_core/tools/utils/dialogs.py +++ b/client/ayon_core/tools/utils/dialogs.py @@ -41,7 +41,7 @@ class ScrollMessageBox(QtWidgets.QDialog): """ def __init__(self, icon, title, messages, cancelable=False): - super(ScrollMessageBox, self).__init__() + super().__init__() self.setWindowTitle(title) self.icon = icon @@ -49,8 +49,6 @@ class ScrollMessageBox(QtWidgets.QDialog): self.setWindowFlags(QtCore.Qt.WindowTitleHint) - layout = QtWidgets.QVBoxLayout(self) - scroll_widget = QtWidgets.QScrollArea(self) scroll_widget.setWidgetResizable(True) content_widget = QtWidgets.QWidget(self) @@ -63,14 +61,8 @@ class ScrollMessageBox(QtWidgets.QDialog): content_layout.addWidget(label_widget) message_len = max(message_len, len(message)) - # guess size of scrollable area - # WARNING: 'desktop' method probably won't work in PySide6 - desktop = QtWidgets.QApplication.desktop() - max_width = desktop.availableGeometry().width() - scroll_widget.setMinimumWidth( - min(max_width, message_len * 6) - ) - layout.addWidget(scroll_widget) + # Set minimum width + scroll_widget.setMinimumWidth(360) buttons = QtWidgets.QDialogButtonBox.Ok if cancelable: @@ -86,7 +78,9 @@ class ScrollMessageBox(QtWidgets.QDialog): btn.clicked.connect(self._on_copy_click) btn_box.addButton(btn, QtWidgets.QDialogButtonBox.NoRole) - layout.addWidget(btn_box) + main_layout = QtWidgets.QVBoxLayout(self) + main_layout.addWidget(scroll_widget, 1) + main_layout.addWidget(btn_box, 0) def _on_copy_click(self): clipboard = QtWidgets.QApplication.clipboard() @@ -104,7 +98,7 @@ class SimplePopup(QtWidgets.QDialog): on_clicked = QtCore.Signal() def __init__(self, parent=None, *args, **kwargs): - super(SimplePopup, self).__init__(parent=parent, *args, **kwargs) + super().__init__(parent=parent, *args, **kwargs) # Set default title self.setWindowTitle("Popup") @@ -161,7 +155,7 @@ class SimplePopup(QtWidgets.QDialog): geo = self._calculate_window_geometry() self.setGeometry(geo) - return super(SimplePopup, self).showEvent(event) + return super().showEvent(event) def _on_clicked(self): """Callback for when the 'show' button is clicked. @@ -228,9 +222,7 @@ class PopupUpdateKeys(SimplePopup): on_clicked_state = QtCore.Signal(bool) def __init__(self, parent=None, *args, **kwargs): - super(PopupUpdateKeys, self).__init__( - parent=parent, *args, **kwargs - ) + super().__init__(parent=parent, *args, **kwargs) layout = self.layout()