diff options
author | Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr> | 2019-12-23 13:45:09 +0100 |
---|---|---|
committer | Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr> | 2019-12-23 13:45:09 +0100 |
commit | 5d647cf9a6159afd2933da594b9c79ad93d3cd9b (patch) | |
tree | 2571025a602f68fc8933b01104dc712d41f84034 /examples/simplewidget.py | |
parent | 654a6ac93513c3cc1ef97cacd782ff674c6f4559 (diff) |
New upstream version 0.12.0~b0+dfsg
Diffstat (limited to 'examples/simplewidget.py')
-rwxr-xr-x | examples/simplewidget.py | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/examples/simplewidget.py b/examples/simplewidget.py index e952dc6..88977b7 100755 --- a/examples/simplewidget.py +++ b/examples/simplewidget.py @@ -44,6 +44,7 @@ from silx.gui.colors import Colormap from silx.gui.widgets.WaitingPushButton import WaitingPushButton from silx.gui.widgets.ThreadPoolPushButton import ThreadPoolPushButton from silx.gui.widgets.RangeSlider import RangeSlider +from silx.gui.widgets.LegendIconWidget import LegendIconWidget class SimpleWidgetExample(qt.QMainWindow): @@ -69,6 +70,10 @@ class SimpleWidgetExample(qt.QMainWindow): layout.addWidget(self.createRangeSlider()) layout.addWidget(self.createRangeSliderWithBackground()) + panel = self.createLegendIconPanel(self) + layout.addWidget(qt.QLabel("LegendIconWidget")) + layout.addWidget(panel) + self.setCentralWidget(main_panel) def createWaitingPushButton(self): @@ -122,6 +127,65 @@ class SimpleWidgetExample(qt.QMainWindow): widget.setGroovePixmapFromProfile(background, colormap) return widget + def createLegendIconPanel(self, parent): + panel = qt.QWidget(parent) + layout = qt.QVBoxLayout(panel) + + # Empty + legend = LegendIconWidget(panel) + layout.addWidget(legend) + + # Line + legend = LegendIconWidget(panel) + legend.setLineStyle("-") + legend.setLineColor("blue") + legend.setLineWidth(2) + layout.addWidget(legend) + + # Symbol + legend = LegendIconWidget(panel) + legend.setSymbol("o") + legend.setSymbolColor("red") + layout.addWidget(legend) + + # Line and symbol + legend = LegendIconWidget(panel) + legend.setLineStyle(":") + legend.setLineColor("green") + legend.setLineWidth(2) + legend.setSymbol("x") + legend.setSymbolColor("violet") + layout.addWidget(legend) + + # Colormap + legend = LegendIconWidget(panel) + legend.setColormap("viridis") + layout.addWidget(legend) + + # Symbol and colormap + legend = LegendIconWidget(panel) + legend.setSymbol("o") + legend.setSymbolColormap("viridis") + layout.addWidget(legend) + + # Symbol (without surface) and colormap + legend = LegendIconWidget(panel) + legend.setSymbol("+") + legend.setSymbolColormap("plasma") + layout.addWidget(legend) + + # Colormap + Line + Symbol + legend = LegendIconWidget(panel) + legend.setColormap("gray") + legend.setLineStyle("-") + legend.setLineColor("white") + legend.setLineWidth(3) + legend.setSymbol(".") + legend.setSymbolColormap("red") + layout.addWidget(legend) + + return panel + def main(): """ |