diff --git a/bec_widgets/widgets/buttons/color_button.py b/bec_widgets/widgets/buttons/color_button.py new file mode 100644 index 00000000..0adb1d2b --- /dev/null +++ b/bec_widgets/widgets/buttons/color_button.py @@ -0,0 +1,17 @@ +import pyqtgraph as pg + + +class ColorButton(pg.ColorButton): + """ + A ColorButton that opens a dialog to select a color. Inherits from pyqtgraph.ColorButton. + Patches event loop of the ColorDialog, if opened in another QDialog. + """ + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + def selectColor(self): + self.origColor = self.color() + self.colorDialog.setCurrentColor(self.color()) + self.colorDialog.open() + self.colorDialog.exec()