Commit 4fad8fa3 authored by Luke Campagnola's avatar Luke Campagnola
Browse files

minor fixes to docks and flowchart nodes

parents 412e1d2e 21dff052
...@@ -186,7 +186,6 @@ class Dock(QtGui.QWidget, DockDrop): ...@@ -186,7 +186,6 @@ class Dock(QtGui.QWidget, DockDrop):
def startDrag(self): def startDrag(self):
print('startDrag')
self.drag = QtGui.QDrag(self) self.drag = QtGui.QDrag(self)
mime = QtCore.QMimeData() mime = QtCore.QMimeData()
#mime.setPlainText("asd") #mime.setPlainText("asd")
......
...@@ -33,12 +33,13 @@ class DockArea(Container, QtGui.QWidget, DockDrop): ...@@ -33,12 +33,13 @@ class DockArea(Container, QtGui.QWidget, DockDrop):
def type(self): def type(self):
return "top" 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. """Adds a dock to this area.
=========== ================================================================= =========== =================================================================
Arguments: 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' position 'bottom', 'top', 'left', 'right', 'over', or 'under'
relativeTo If relativeTo is None, then the new Dock is added to fill an 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 entire edge of the window. If relativeTo is another Dock, then
...@@ -46,7 +47,12 @@ class DockArea(Container, QtGui.QWidget, DockDrop): ...@@ -46,7 +47,12 @@ class DockArea(Container, QtGui.QWidget, DockDrop):
configuration for 'over' and 'under'). 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. ## Determine the container to insert this dock into.
## If there is no neighbor, then the container is the top. ## If there is no neighbor, then the container is the top.
...@@ -100,6 +106,8 @@ class DockArea(Container, QtGui.QWidget, DockDrop): ...@@ -100,6 +106,8 @@ class DockArea(Container, QtGui.QWidget, DockDrop):
dock.area = self dock.area = self
self.docks[dock.name()] = dock self.docks[dock.name()] = dock
return dock
def moveDock(self, dock, position, neighbor): def moveDock(self, dock, position, neighbor):
""" """
Move an existing Dock to a new location. Move an existing Dock to a new location.
......
...@@ -206,17 +206,12 @@ class Flowchart(Node): ...@@ -206,17 +206,12 @@ class Flowchart(Node):
item = node.graphicsItem() item = node.graphicsItem()
item.setZValue(self.nextZVal*2) item.setZValue(self.nextZVal*2)
self.nextZVal += 1 self.nextZVal += 1
#item.setParentItem(self.chartGraphicsItem())
self.viewBox.addItem(item) self.viewBox.addItem(item)
#item.setPos(pos2.x(), pos2.y())
item.moveBy(*pos) item.moveBy(*pos)
self._nodes[name] = node self._nodes[name] = node
self.widget().addNode(node) self.widget().addNode(node)
#QtCore.QObject.connect(node, QtCore.SIGNAL('closed'), self.nodeClosed)
node.sigClosed.connect(self.nodeClosed) node.sigClosed.connect(self.nodeClosed)
#QtCore.QObject.connect(node, QtCore.SIGNAL('renamed'), self.nodeRenamed)
node.sigRenamed.connect(self.nodeRenamed) node.sigRenamed.connect(self.nodeRenamed)
#QtCore.QObject.connect(node, QtCore.SIGNAL('outputChanged'), self.nodeOutputChanged)
node.sigOutputChanged.connect(self.nodeOutputChanged) node.sigOutputChanged.connect(self.nodeOutputChanged)
def removeNode(self, node): def removeNode(self, node):
...@@ -225,17 +220,14 @@ class Flowchart(Node): ...@@ -225,17 +220,14 @@ class Flowchart(Node):
def nodeClosed(self, node): def nodeClosed(self, node):
del self._nodes[node.name()] del self._nodes[node.name()]
self.widget().removeNode(node) self.widget().removeNode(node)
#QtCore.QObject.disconnect(node, QtCore.SIGNAL('closed'), self.nodeClosed)
try: try:
node.sigClosed.disconnect(self.nodeClosed) node.sigClosed.disconnect(self.nodeClosed)
except TypeError: except TypeError:
pass pass
#QtCore.QObject.disconnect(node, QtCore.SIGNAL('renamed'), self.nodeRenamed)
try: try:
node.sigRenamed.disconnect(self.nodeRenamed) node.sigRenamed.disconnect(self.nodeRenamed)
except TypeError: except TypeError:
pass pass
#QtCore.QObject.disconnect(node, QtCore.SIGNAL('outputChanged'), self.nodeOutputChanged)
try: try:
node.sigOutputChanged.disconnect(self.nodeOutputChanged) node.sigOutputChanged.disconnect(self.nodeOutputChanged)
except TypeError: except TypeError:
......
...@@ -152,7 +152,7 @@ class RegionSelectNode(CtrlNode): ...@@ -152,7 +152,7 @@ class RegionSelectNode(CtrlNode):
#print " new rgn:", c, region #print " new rgn:", c, region
#self.items[c].setYRange([0., 0.2], relative=True) #self.items[c].setYRange([0., 0.2], relative=True)
if self.selected.isConnected(): if self['selected'].isConnected():
if data is None: if data is None:
sliced = None sliced = None
elif (hasattr(data, 'implements') and data.implements('MetaArray')): elif (hasattr(data, 'implements') and data.implements('MetaArray')):
...@@ -219,7 +219,6 @@ class EvalNode(Node): ...@@ -219,7 +219,6 @@ class EvalNode(Node):
text = str(self.text.toPlainText()) text = str(self.text.toPlainText())
if text != self.lastText: if text != self.lastText:
self.lastText = text self.lastText = text
print("eval node update")
self.update() self.update()
return QtGui.QTextEdit.focusOutEvent(self.text, ev) return QtGui.QTextEdit.focusOutEvent(self.text, ev)
......
...@@ -21,7 +21,7 @@ class PlotWidgetNode(Node): ...@@ -21,7 +21,7 @@ class PlotWidgetNode(Node):
self.items = {} self.items = {}
def disconnected(self, localTerm, remoteTerm): 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]) self.plot.removeItem(self.items[remoteTerm])
del self.items[remoteTerm] del self.items[remoteTerm]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment