summaryrefslogtreecommitdiff
path: root/qtdesigner_plugins/plotwidgetplugin.py
diff options
context:
space:
mode:
Diffstat (limited to 'qtdesigner_plugins/plotwidgetplugin.py')
-rw-r--r--qtdesigner_plugins/plotwidgetplugin.py84
1 files changed, 84 insertions, 0 deletions
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"