Skip to content

Commit

Permalink
Merge pull request #1051 from vasole/xanes
Browse files Browse the repository at this point in the history
[GUI] Correct attribute errors
  • Loading branch information
vasole authored Nov 14, 2023
2 parents 684cb1b + 10f952d commit 57bbc1f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion PyMca5/PyMcaGraph/backends/MatplotlibBackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1606,7 +1606,7 @@ def addCurve(self, x, y, legend=None, info=None, replace=False, replot=True,
scatterPlot = True
if scatterPlot:
# scatter plot
if color.dtype not in [numpy.float32, numpy.float]:
if color.dtype not in [numpy.float32, numpy.float64]:
actualColor = color / 255.
else:
actualColor = color
Expand Down
41 changes: 41 additions & 0 deletions PyMca5/PyMcaGui/PyMcaQt.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,47 @@ def patch_enums(*modules):
QAbstractItemView.AnyKeyPressed = QAbstractItemView.EditTrigger.AnyKeyPressed
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

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
except Exception:
_logger.info("Exception patching silx")
pass

# use a (bad) replacement for QDesktopWidget
class QDesktopWidget:
def height(self):
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ build_script:
- "pip freeze"

# Build
- "python -m build --no-isolation --wheel"
- "python -m build --wheel"
- ps: "ls dist"

# Leave build virtualenv
Expand Down

0 comments on commit 57bbc1f

Please sign in to comment.