Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/vasole/pymca
Browse files Browse the repository at this point in the history
  • Loading branch information
vasole committed Nov 24, 2023
2 parents 773c6ed + 00cd61a commit b27bbeb
Showing 1 changed file with 38 additions and 32 deletions.
70 changes: 38 additions & 32 deletions PyMca5/PyMcaGui/PyMcaQt.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,42 +352,48 @@ def patch_enums(*modules):
QAbstractItemView.AllEditTriggers = QAbstractItemView.EditTrigger.AllEditTriggers

if not hasattr(QPalette, "Normal"):
QPalette.Disabled = QPalette.ColorGroup.Disabled
QPalette.Active = QPalette.ColorGroup.Active
QPalette.Inactive = QPalette.ColorGroup.Inactive
QPalette.Normal = QPalette.ColorGroup.Normal

QPalette.Window = QPalette.ColorRole.Window
QPalette.WindowText = QPalette.ColorRole.WindowText
QPalette.Base = QPalette.ColorRole.Base
QPalette.AlternateBase = QPalette.ColorRole.AlternateBase
QPalette.ToolTipBase = QPalette.ColorRole.ToolTipBase
QPalette.ToolTipText = QPalette.ColorRole.ToolTipText
QPalette.PlaceholderText = QPalette.ColorRole.PlaceholderText
QPalette.Text = QPalette.ColorRole.Text
QPalette.Button = QPalette.ColorRole.Button
QPalette.ButtonText = QPalette.ColorRole.ButtonText
QPalette.BrightText = QPalette.ColorRole.BrightText
if hasattr(QPalette, "Active"):
QPalette.Normal = QPalette.Active
else:
QPalette.Disabled = QPalette.ColorGroup.Disabled
QPalette.Active = QPalette.ColorGroup.Active
QPalette.Inactive = QPalette.ColorGroup.Inactive
QPalette.Normal = QPalette.ColorGroup.Normal

QPalette.Window = QPalette.ColorRole.Window
QPalette.WindowText = QPalette.ColorRole.WindowText
QPalette.Base = QPalette.ColorRole.Base
QPalette.AlternateBase = QPalette.ColorRole.AlternateBase
QPalette.ToolTipBase = QPalette.ColorRole.ToolTipBase
QPalette.ToolTipText = QPalette.ColorRole.ToolTipText
QPalette.PlaceholderText = QPalette.ColorRole.PlaceholderText
QPalette.Text = QPalette.ColorRole.Text
QPalette.Button = QPalette.ColorRole.Button
QPalette.ButtonText = QPalette.ColorRole.ButtonText
QPalette.BrightText = QPalette.ColorRole.BrightText

try:
from silx.gui import qt as SilxQt
if not hasattr(SilxQt.QPalette, "Normal"):
SilxQt.QPalette.Disabled = SilxQt.QPalette.ColorGroup.Disabled
SilxQt.QPalette.Active = SilxQt.QPalette.ColorGroup.Active
SilxQt.QPalette.Inactive = SilxQt.QPalette.ColorGroup.Inactive
SilxQt.QPalette.Normal = SilxQt.QPalette.ColorGroup.Normal

SilxQt.QPalette.Window = SilxQt.QPalette.ColorRole.Window
SilxQt.QPalette.WindowText = SilxQt.QPalette.ColorRole.WindowText
SilxQt.QPalette.Base = SilxQt.QPalette.ColorRole.Base
SilxQt.QPalette.AlternateBase = SilxQt.QPalette.ColorRole.AlternateBase
SilxQt.QPalette.ToolTipBase = SilxQt.QPalette.ColorRole.ToolTipBase
SilxQt.QPalette.ToolTipText = SilxQt.QPalette.ColorRole.ToolTipText
SilxQt.QPalette.PlaceholderText = SilxQt.QPalette.ColorRole.PlaceholderText
SilxQt.QPalette.Text = SilxQt.QPalette.ColorRole.Text
SilxQt.QPalette.Button = SilxQt.QPalette.ColorRole.Button
SilxQt.QPalette.ButtonText = SilxQt.QPalette.ColorRole.ButtonText
SilxQt.QPalette.BrightText = SilxQt.QPalette.ColorRole.BrightText
if hasattr(SilxQt.QPalette, "Active"):
SilxQt.QPalette.Normal = SilxQt.QPalette.Active
else:
SilxQt.QPalette.Disabled = SilxQt.QPalette.ColorGroup.Disabled
SilxQt.QPalette.Active = SilxQt.QPalette.ColorGroup.Active
SilxQt.QPalette.Inactive = SilxQt.QPalette.ColorGroup.Inactive
SilxQt.QPalette.Normal = SilxQt.QPalette.ColorGroup.Normal

SilxQt.QPalette.Window = SilxQt.QPalette.ColorRole.Window
SilxQt.QPalette.WindowText = SilxQt.QPalette.ColorRole.WindowText
SilxQt.QPalette.Base = SilxQt.QPalette.ColorRole.Base
SilxQt.QPalette.AlternateBase = SilxQt.QPalette.ColorRole.AlternateBase
SilxQt.QPalette.ToolTipBase = SilxQt.QPalette.ColorRole.ToolTipBase
SilxQt.QPalette.ToolTipText = SilxQt.QPalette.ColorRole.ToolTipText
SilxQt.QPalette.PlaceholderText = SilxQt.QPalette.ColorRole.PlaceholderText
SilxQt.QPalette.Text = SilxQt.QPalette.ColorRole.Text
SilxQt.QPalette.Button = SilxQt.QPalette.ColorRole.Button
SilxQt.QPalette.ButtonText = SilxQt.QPalette.ColorRole.ButtonText
SilxQt.QPalette.BrightText = SilxQt.QPalette.ColorRole.BrightText
except Exception:
_logger.info("Exception patching silx")
pass
Expand Down

0 comments on commit b27bbeb

Please sign in to comment.