minor fixes from acq4

This commit is contained in:
Luke Campagnola 2013-02-24 11:32:35 -05:00
parent 194eba1e3a
commit 8e5133c873
4 changed files with 12 additions and 13 deletions

View File

@ -33,12 +33,13 @@ class DockArea(Container, QtGui.QWidget, DockDrop):
def type(self):
return "top"
def addDock(self, dock, position='bottom', relativeTo=None):
def addDock(self, dock=None, position='bottom', relativeTo=None, **kwds):
"""Adds a dock to this area.
=========== =================================================================
Arguments:
dock The new Dock object to add.
dock The new Dock object to add. If None, then a new Dock will be
created.
position 'bottom', 'top', 'left', 'right', 'over', or 'under'
relativeTo If relativeTo is None, then the new Dock is added to fill an
entire edge of the window. If relativeTo is another Dock, then
@ -46,7 +47,12 @@ class DockArea(Container, QtGui.QWidget, DockDrop):
configuration for 'over' and 'under').
=========== =================================================================
All extra keyword arguments are passed to Dock.__init__() if *dock* is
None.
"""
if dock is None:
dock = Dock(**kwds)
## Determine the container to insert this dock into.
## If there is no neighbor, then the container is the top.
@ -100,6 +106,8 @@ class DockArea(Container, QtGui.QWidget, DockDrop):
dock.area = self
self.docks[dock.name()] = dock
return dock
def moveDock(self, dock, position, neighbor):
"""
Move an existing Dock to a new location.

View File

@ -206,17 +206,12 @@ class Flowchart(Node):
item = node.graphicsItem()
item.setZValue(self.nextZVal*2)
self.nextZVal += 1
#item.setParentItem(self.chartGraphicsItem())
self.viewBox.addItem(item)
#item.setPos(pos2.x(), pos2.y())
item.moveBy(*pos)
self._nodes[name] = node
self.widget().addNode(node)
#QtCore.QObject.connect(node, QtCore.SIGNAL('closed'), self.nodeClosed)
node.sigClosed.connect(self.nodeClosed)
#QtCore.QObject.connect(node, QtCore.SIGNAL('renamed'), self.nodeRenamed)
node.sigRenamed.connect(self.nodeRenamed)
#QtCore.QObject.connect(node, QtCore.SIGNAL('outputChanged'), self.nodeOutputChanged)
node.sigOutputChanged.connect(self.nodeOutputChanged)
def removeNode(self, node):
@ -225,17 +220,14 @@ class Flowchart(Node):
def nodeClosed(self, node):
del self._nodes[node.name()]
self.widget().removeNode(node)
#QtCore.QObject.disconnect(node, QtCore.SIGNAL('closed'), self.nodeClosed)
try:
node.sigClosed.disconnect(self.nodeClosed)
except TypeError:
pass
#QtCore.QObject.disconnect(node, QtCore.SIGNAL('renamed'), self.nodeRenamed)
try:
node.sigRenamed.disconnect(self.nodeRenamed)
except TypeError:
pass
#QtCore.QObject.disconnect(node, QtCore.SIGNAL('outputChanged'), self.nodeOutputChanged)
try:
node.sigOutputChanged.disconnect(self.nodeOutputChanged)
except TypeError:

View File

@ -152,7 +152,7 @@ class RegionSelectNode(CtrlNode):
#print " new rgn:", c, region
#self.items[c].setYRange([0., 0.2], relative=True)
if self.selected.isConnected():
if self['selected'].isConnected():
if data is None:
sliced = None
elif (hasattr(data, 'implements') and data.implements('MetaArray')):
@ -219,7 +219,6 @@ class EvalNode(Node):
text = str(self.text.toPlainText())
if text != self.lastText:
self.lastText = text
print("eval node update")
self.update()
return QtGui.QTextEdit.focusOutEvent(self.text, ev)

View File

@ -21,7 +21,7 @@ class PlotWidgetNode(Node):
self.items = {}
def disconnected(self, localTerm, remoteTerm):
if localTerm is self.In and remoteTerm in self.items:
if localTerm is self['In'] and remoteTerm in self.items:
self.plot.removeItem(self.items[remoteTerm])
del self.items[remoteTerm]