本文整理汇总了Python中PyQt4.Qwt5.QwtPlot.setAutoDelete方法的典型用法代码示例。如果您正苦于以下问题:Python QwtPlot.setAutoDelete方法的具体用法?Python QwtPlot.setAutoDelete怎么用?Python QwtPlot.setAutoDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qwt5.QwtPlot
的用法示例。
在下文中一共展示了QwtPlot.setAutoDelete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ImageControlDialog
# 需要导入模块: from PyQt4.Qwt5 import QwtPlot [as 别名]
# 或者: from PyQt4.Qwt5.QwtPlot import setAutoDelete [as 别名]
class ImageControlDialog(QDialog):
def __init__(self, parent, rc, imgman):
"""An ImageControlDialog is initialized with a parent widget, a RenderControl object,
and an ImageManager object"""
QDialog.__init__(self, parent)
image = rc.image
self.setWindowTitle("%s: Colour Controls" % image.name)
self.setWindowIcon(pixmaps.colours.icon())
self.setModal(False)
self.image = image
self._rc = rc
self._imgman = imgman
self._currier = PersistentCurrier()
# init internal state
self._prev_range = self._display_range = None, None
self._hist = None
self._geometry = None
# create layouts
lo0 = QVBoxLayout(self)
# lo0.setContentsMargins(0,0,0,0)
# histogram plot
whide = self.makeButton("Hide", self.hide, width=128)
whide.setShortcut(Qt.Key_F9)
lo0.addWidget(Separator(self, "Histogram and ITF", extra_widgets=[whide]))
lo1 = QHBoxLayout()
lo1.setContentsMargins(0, 0, 0, 0)
self._histplot = QwtPlot(self)
self._histplot.setAutoDelete(False)
lo1.addWidget(self._histplot, 1)
lo2 = QHBoxLayout()
lo2.setContentsMargins(0, 0, 0, 0)
lo2.setSpacing(2)
lo0.addLayout(lo2)
lo0.addLayout(lo1)
self._wautozoom = QCheckBox("autozoom", self)
self._wautozoom.setChecked(True)
self._wautozoom.setToolTip("""<P>If checked, then the histrogram plot will zoom in automatically when
you narrow the current intensity range.</P>""")
self._wlogy = QCheckBox("log Y", self)
self._wlogy.setChecked(True)
self._ylogscale = True
self._wlogy.setToolTip(
"""<P>If checked, a log-scale Y axis is used for the histogram plot instead of a linear one.""")
QObject.connect(self._wlogy, SIGNAL("toggled(bool)"), self._setHistLogScale)
self._whistunzoom = self.makeButton("", self._unzoomHistogram, icon=pixmaps.full_range.icon())
self._whistzoomout = self.makeButton("-", self._currier.curry(self._zoomHistogramByFactor, math.sqrt(.1)))
self._whistzoomin = self.makeButton("+", self._currier.curry(self._zoomHistogramByFactor, math.sqrt(10)))
self._whistzoomin.setToolTip("""<P>Click to zoom into the histogram plot by one step. This does not
change the current intensity range.</P>""")
self._whistzoomout.setToolTip("""<P>Click to zoom out of the histogram plot by one step. This does not
change the current intensity range.</P>""")
self._whistunzoom.setToolTip("""<P>Click to reset the histogram plot back to its full extent.
This does not change the current intensity range.</P>""")
self._whistzoom = QwtWheel(self)
self._whistzoom.setOrientation(Qt.Horizontal)
self._whistzoom.setMaximumWidth(80)
self._whistzoom.setRange(10, 0)
self._whistzoom.setStep(0.1)
self._whistzoom.setTickCnt(30)
self._whistzoom.setTracking(False)
QObject.connect(self._whistzoom, SIGNAL("valueChanged(double)"), self._zoomHistogramFinalize)
QObject.connect(self._whistzoom, SIGNAL("sliderMoved(double)"), self._zoomHistogramPreview)
self._whistzoom.setToolTip("""<P>Use this wheel control to zoom in/out of the histogram plot.
This does not change the current intensity range.
Note that the zoom wheel should also respond to your mouse wheel, if you have one.</P>""")
# This works around a stupid bug in QwtSliders -- when using the mousewheel, only sliderMoved() signals are emitted,
# with no final valueChanged(). If we want to do a fast preview of something on sliderMoved(), and a "slow" final
# step on valueChanged(), we're in trouble. So we start a timer on sliderMoved(), and if the timer expires without
# anything else happening, do a valueChanged().
# Here we use a timer to call zoomHistogramFinalize() w/o an argument.
self._whistzoom_timer = QTimer(self)
self._whistzoom_timer.setSingleShot(True)
self._whistzoom_timer.setInterval(500)
QObject.connect(self._whistzoom_timer, SIGNAL("timeout()"), self._zoomHistogramFinalize)
# set same size for all buttons and controls
width = 24
for w in self._whistunzoom, self._whistzoomin, self._whistzoomout:
w.setMinimumSize(width, width)
w.setMaximumSize(width, width)
self._whistzoom.setMinimumSize(80, width)
self._wlab_histpos_text = "(hover here for help)"
self._wlab_histpos = QLabel(self._wlab_histpos_text, self)
self._wlab_histpos.setToolTip("""
<P>The plot shows a histogram of either the full image or its selected subset
(as per the "Data subset" section below).</P>
<P>The current intensity range is indicated by the grey box
in the plot.</P>
<P>Use the left mouse button to change the low intensity limit, and the right
button (on Macs, use Ctrl-click) to change the high limit.</P>
<P>Use Shift with the left mouse button to zoom into an area of the histogram,
or else use the "zoom wheel" control or the plus/minus toolbuttons above the histogram to zoom in or out.
To zoom back out to the full extent of the histogram, click on the rightmost button above the histogram.</P>
""")
lo2.addWidget(self._wlab_histpos, 1)
lo2.addWidget(self._wautozoom)
lo2.addWidget(self._wlogy, 0)
lo2.addWidget(self._whistzoomin, 0)
#.........这里部分代码省略.........