From 6fc46a46b8177c57c60fe9dccf00bb8a751d454f Mon Sep 17 00:00:00 2001 From: Ivan Holmes Date: Wed, 27 Apr 2022 00:14:44 +0100 Subject: [PATCH] change style of save warning dialog buttons on Haiku for better integration --- csgui/messageBox.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/csgui/messageBox.py b/csgui/messageBox.py index 73808ff..edf0988 100644 --- a/csgui/messageBox.py +++ b/csgui/messageBox.py @@ -1,4 +1,5 @@ -from PyQt5.QtWidgets import QApplication, QAction, QLabel, QDialogButtonBox, QDialog, QFileDialog, QMessageBox, QPushButton, QLineEdit, QCheckBox, QSpinBox, QDoubleSpinBox, QTableWidgetItem, QTabWidget, QComboBox, QWidget, QScrollArea, QMainWindow, QShortcut +from PyQt5.QtWidgets import QApplication, QAction, QLabel, QDialogButtonBox, QDialog, QFileDialog, QMessageBox, QPushButton, QLineEdit, QCheckBox, QSpinBox, QDoubleSpinBox, QTableWidgetItem, QTabWidget, QComboBox, QWidget, QScrollArea, QMainWindow, QShortcut, QDialogButtonBox +import sys class UnsavedMessageBox(QMessageBox): """ @@ -15,7 +16,12 @@ class UnsavedMessageBox(QMessageBox): self.setStandardButtons( QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel) self.setDefaultButton(QMessageBox.Save) - + + # If we are running on Haiku, use the MacOS button style to fit in more + # with native applications + if sys.platform.startswith("haiku"): + buttonBox = self.findChild(QDialogButtonBox) + buttonBox.setStyleSheet("* { button-layout: 1}") class UnreadableMessageBox(QMessageBox): """