diff options
Diffstat (limited to 'qtdesigner_plugins')
-rw-r--r-- | qtdesigner_plugins/README.rst | 40 | ||||
-rw-r--r-- | qtdesigner_plugins/plot1dplugin.py | 84 | ||||
-rw-r--r-- | qtdesigner_plugins/plot2dplugin.py | 84 | ||||
-rw-r--r-- | qtdesigner_plugins/plotwidgetplugin.py | 84 | ||||
-rw-r--r-- | qtdesigner_plugins/plotwindowplugin.py | 84 |
5 files changed, 376 insertions, 0 deletions
diff --git a/qtdesigner_plugins/README.rst b/qtdesigner_plugins/README.rst new file mode 100644 index 0000000..d647ea3 --- /dev/null +++ b/qtdesigner_plugins/README.rst @@ -0,0 +1,40 @@ +Using silx widgets in Qt Designer +================================= + +With PyQt_, it is possible to use ``silx.gui`` widgets (and widgets written with PyQt in general) from the `Qt Designer`_. + +The following ``silx.gui`` widgets are available in the Qt Designer: + +- :class:`silx.gui.plot.Plot1D` +- :class:`silx.gui.plot.Plot2D` +- :class:`silx.gui.plot.PlotWidget` +- :class:`silx.gui.plot.PlotWindow` + +Pre-requisite +------------- + +The following software must be installed: + +- Qt_ with the `Qt Designer`_. +- Python_. +- PyQt_ with the designer plugin. +- The ``silx`` Python package and its dependencies. + :mod:`silx.gui.plot` widgets requires matplotlib_. + +Usage +----- + +The **PYQTDESIGNERPATH** environment variable defines the search paths for plugins enabling use of PyQt widgets in the designer. + +To start the Qt Designer with ``silx.gui`` widgets available, on Linux, run the following from the command line:: + + PYQTDESIGNERPATH=<silx_designer_plugin_dir> designer + + +See `Using Qt Designer <http://pyqt.sourceforge.net/Docs/PyQt5/designer.html>`_ in PyQt_ documentation. + +.. _Qt: http://www.qt.io/ +.. _Python: https://www.python.org/ +.. _PyQt: https://riverbankcomputing.com/software/pyqt/intro +.. _Qt Designer: http://doc.qt.io/qt-5/qtdesigner-manual.html +.. _matplotlib: http://matplotlib.org/ diff --git a/qtdesigner_plugins/plot1dplugin.py b/qtdesigner_plugins/plot1dplugin.py new file mode 100644 index 0000000..86982af --- /dev/null +++ b/qtdesigner_plugins/plot1dplugin.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# coding: utf-8 +# /*########################################################################## +# +# Copyright (c) 2016 European Synchrotron Radiation Facility +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# ###########################################################################*/ +"""silx.gui.plot Plot1D Qt designer plugin.""" + +__authors__ = ["T. Vincent"] +__license__ = "MIT" +__date__ = "30/05/2016" + + +from silx.gui import icons, qt + +if qt.BINDING == 'PyQt4': + from PyQt4 import QtDesigner +elif qt.BINDING == 'PyQt5': + from PyQt5 import QtDesigner +else: + raise RuntimeError("Unsupport Qt BINDING: %s" % qt.BINDING) + +from silx.gui.plot import Plot1D + + +class Plot1DPlugin(QtDesigner.QPyDesignerCustomWidgetPlugin): + + def __init__(self, parent=None): + super(Plot1DPlugin, self).__init__(parent) + self.initialized = False + + def initialize(self, core): + if self.initialized: + return + + self.initialized = True + + def isInitialized(self): + return self.initialized + + def createWidget(self, parent): + plot = Plot1D(parent=parent) + plot.setAutoReplot(False) + return plot + + def name(self): + return "Plot1D" + + def group(self): + return "silx" + + def icon(self): + return icons.getQIcon('plot-window') + + def toolTip(self): + return "" + + def whatsThis(self): + return "" + + def isContainer(self): + return False + + def includeFile(self): + return "silx.gui.plot.PlotWindow" diff --git a/qtdesigner_plugins/plot2dplugin.py b/qtdesigner_plugins/plot2dplugin.py new file mode 100644 index 0000000..1a07510 --- /dev/null +++ b/qtdesigner_plugins/plot2dplugin.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# coding: utf-8 +# /*########################################################################## +# +# Copyright (c) 2016 European Synchrotron Radiation Facility +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# ###########################################################################*/ +"""silx.gui.plot Plot2D Qt designer plugin.""" + +__authors__ = ["T. Vincent"] +__license__ = "MIT" +__date__ = "30/05/2016" + + +from silx.gui import icons, qt + +if qt.BINDING == 'PyQt4': + from PyQt4 import QtDesigner +elif qt.BINDING == 'PyQt5': + from PyQt5 import QtDesigner +else: + raise RuntimeError("Unsupport Qt BINDING: %s" % qt.BINDING) + +from silx.gui.plot import Plot2D + + +class Plot2DPlugin(QtDesigner.QPyDesignerCustomWidgetPlugin): + + def __init__(self, parent=None): + super(Plot2DPlugin, self).__init__(parent) + self.initialized = False + + def initialize(self, core): + if self.initialized: + return + + self.initialized = True + + def isInitialized(self): + return self.initialized + + def createWidget(self, parent): + plot = Plot2D(parent=parent) + plot.setAutoReplot(False) + return plot + + def name(self): + return "Plot2D" + + def group(self): + return "silx" + + def icon(self): + return icons.getQIcon('plot-window-image') + + def toolTip(self): + return "" + + def whatsThis(self): + return "" + + def isContainer(self): + return False + + def includeFile(self): + return "silx.gui.plot.PlotWindow" diff --git a/qtdesigner_plugins/plotwidgetplugin.py b/qtdesigner_plugins/plotwidgetplugin.py new file mode 100644 index 0000000..6cc97a5 --- /dev/null +++ b/qtdesigner_plugins/plotwidgetplugin.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# coding: utf-8 +# /*########################################################################## +# +# Copyright (c) 2015-2016 European Synchrotron Radiation Facility +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# ###########################################################################*/ +"""silx.gui.plot PlotWidget Qt designer plugin.""" + +__authors__ = ["T. Vincent"] +__license__ = "MIT" +__date__ = "30/05/2016" + + +from silx.gui import qt, icons + +if qt.BINDING == 'PyQt4': + from PyQt4 import QtDesigner +elif qt.BINDING == 'PyQt5': + from PyQt5 import QtDesigner +else: + raise RuntimeError("Unsupport Qt BINDING: %s" % qt.BINDING) + +from silx.gui.plot import PlotWidget + + +class PlotWidgetPlugin(QtDesigner.QPyDesignerCustomWidgetPlugin): + + def __init__(self, parent=None): + super(PlotWidgetPlugin, self).__init__(parent) + self.initialized = False + + def initialize(self, core): + if self.initialized: + return + + self.initialized = True + + def isInitialized(self): + return self.initialized + + def createWidget(self, parent): + plot = PlotWidget(parent) + plot.setAutoReplot(False) + return plot + + def name(self): + return "PlotWidget" + + def group(self): + return "silx" + + def icon(self): + return icons.getQIcon('plot-widget') + + def toolTip(self): + return "" + + def whatsThis(self): + return "" + + def isContainer(self): + return False + + def includeFile(self): + return "silx.gui.plot.PlotWidget" diff --git a/qtdesigner_plugins/plotwindowplugin.py b/qtdesigner_plugins/plotwindowplugin.py new file mode 100644 index 0000000..b666399 --- /dev/null +++ b/qtdesigner_plugins/plotwindowplugin.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# coding: utf-8 +# /*########################################################################## +# +# Copyright (c) 2015-2016 European Synchrotron Radiation Facility +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# ###########################################################################*/ +"""silx.gui.plot PlotWindow Qt designer plugin.""" + +__authors__ = ["T. Vincent"] +__license__ = "MIT" +__date__ = "30/05/2016" + + +from silx.gui import icons, qt + +if qt.BINDING == 'PyQt4': + from PyQt4 import QtDesigner +elif qt.BINDING == 'PyQt5': + from PyQt5 import QtDesigner +else: + raise RuntimeError("Unsupport Qt BINDING: %s" % qt.BINDING) + +from silx.gui.plot import PlotWindow + + +class PlotWindowPlugin(QtDesigner.QPyDesignerCustomWidgetPlugin): + + def __init__(self, parent=None): + super(PlotWindowPlugin, self).__init__(parent) + self.initialized = False + + def initialize(self, core): + if self.initialized: + return + + self.initialized = True + + def isInitialized(self): + return self.initialized + + def createWidget(self, parent): + plot = PlotWindow(parent) + plot.setAutoReplot(False) + return plot + + def name(self): + return "PlotWindow" + + def group(self): + return "silx" + + def icon(self): + return icons.getQIcon('plot-window') + + def toolTip(self): + return "" + + def whatsThis(self): + return "" + + def isContainer(self): + return False + + def includeFile(self): + return "silx.gui.plot.PlotWindow" |