Merge branch 'lidstrom83-editable_dock_titles' into develop

This commit is contained in:
Luke Campagnola 2015-03-17 22:36:26 -04:00
commit 4194fba7b2
3 changed files with 25 additions and 1 deletions

View File

@ -8,6 +8,7 @@ pyqtgraph-0.9.11 [unreleased]
New Features:
- Preliminary PyQt5 support
- Dock titles can be changed
pyqtgraph-0.9.10

View File

@ -12,6 +12,7 @@ class Dock(QtGui.QWidget, DockDrop):
QtGui.QWidget.__init__(self)
DockDrop.__init__(self)
self._container = None
self._name = name
self.area = area
self.label = DockLabel(name, self, closable)
if closable:
@ -127,6 +128,18 @@ class Dock(QtGui.QWidget, DockDrop):
self.labelHidden = False
self.allowedAreas.add('center')
self.updateStyle()
def title(self):
"""
Gets the text displayed in the title bar for this dock.
"""
return asUnicode(self.label.text())
def setTitle(self, text):
"""
Sets the text displayed in title bar for this Dock.
"""
self.label.setText(text)
def setOrientation(self, o='auto', force=False):
"""
@ -171,7 +184,7 @@ class Dock(QtGui.QWidget, DockDrop):
self.resizeOverlay(self.size())
def name(self):
return asUnicode(self.label.text())
return self._name
def container(self):
return self._container

View File

@ -139,6 +139,9 @@ class HistogramLUTItem(GraphicsWidget):
#self.region.setBounds([vr.top(), vr.bottom()])
def setImageItem(self, img):
"""Set an ImageItem to have its levels and LUT automatically controlled
by this HistogramLUTItem.
"""
self.imageItem = weakref.ref(img)
img.sigImageChanged.connect(self.imageChanged)
img.setLookupTable(self.getLookupTable) ## send function pointer, not the result
@ -163,6 +166,9 @@ class HistogramLUTItem(GraphicsWidget):
self.sigLookupTableChanged.emit(self)
def getLookupTable(self, img=None, n=None, alpha=None):
"""Return a lookup table from the color gradient defined by this
HistogramLUTItem.
"""
if n is None:
if img.dtype == np.uint8:
n = 256
@ -199,7 +205,11 @@ class HistogramLUTItem(GraphicsWidget):
profiler('set region')
def getLevels(self):
"""Return the min and max levels.
"""
return self.region.getRegion()
def setLevels(self, mn, mx):
"""Set the min and max levels.
"""
self.region.setRegion([mn, mx])