CMS 3D CMS Logo

List of all members | Public Member Functions
Vispa.Gui.ConnectableWidgetOwner.ConnectableWidgetOwner Class Reference
Inheritance diagram for Vispa.Gui.ConnectableWidgetOwner.ConnectableWidgetOwner:
Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner Vispa.Gui.WidgetContainer.WidgetContainer Vispa.Gui.ZoomableScrollableWidgetOwner.ZoomableScrollableWidgetOwner Vispa.Views.BoxDecayView.BoxDecayContainer Vispa.Views.LineDecayView.LineDecayContainer Vispa.Views.WidgetView.WidgetView Vispa.Views.BoxDecayView.BoxDecayView Vispa.Views.LineDecayView.LineDecayView Vispa.Plugins.ConfigEditor.ConfigEditorBoxView.ConfigEditorBoxView Vispa.Plugins.EdmBrowser.EdmBrowserBoxView.EdmBrowserBoxView Vispa.Plugins.ConfigEditor.ConfigEditorBoxView.ConnectionStructureView Vispa.Plugins.ConfigEditor.ConfigEditorBoxView.SequenceStructureView

Public Member Functions

def deleteSelectedConnections (self)
 
def getWidgetByName (self, name)
 
def hideMenuWidgets (self)
 
def portConnection (self, port1, port2=None)
 
def propagateEventUnderConnectionWidget (self, connection, event)
 
def updateConnections (self)
 
- Public Member Functions inherited from Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner
def deselectAllWidgets (self, exception=None)
 
def enableMultiSelect (self, multiSelect=True)
 
def initWidgetMovement (self, widget)
 
def keyPressEvent (self, event)
 
def lastMovedWidgets (self)
 
def mouseMoveEvent (self, event)
 
def mousePressEvent (self, event)
 
def mouseReleaseEvent (self, event)
 
def multiSelectEnabled (self)
 
def selectedWidgets (self)
 
def widgetAboutToDelete (self, widget)
 
def widgetDoubleClicked (self, widget)
 
def widgetDragged (self, widget)
 
def widgetSelected (self, widget, multiSelect=False)
 

Detailed Description

Interface for classes containing ConnectableWidgets

Only makes sense if implementing class also inherits QWidget or class inheriting QWidget.

Definition at line 11 of file ConnectableWidgetOwner.py.

Member Function Documentation

def Vispa.Gui.ConnectableWidgetOwner.ConnectableWidgetOwner.deleteSelectedConnections (   self)
def Vispa.Gui.ConnectableWidgetOwner.ConnectableWidgetOwner.getWidgetByName (   self,
  name 
)
Returns module with given name or None if there is no such one.

Definition at line 17 of file ConnectableWidgetOwner.py.

References Vispa.Share.BasicDataAccessor.BasicDataAccessor.children(), Vispa.Plugins.EdmBrowser.EventContentDataAccessor.EventContentDataAccessor.children(), data_sources.node.children(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.children(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor.children(), geometry.Structure.children, Folder.children(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.children(), and Vispa.Views.LineDecayView.LineDecayContainer.children().

17  def getWidgetByName(self, name):
18  """ Returns module with given name or None if there is no such one.
19  """
20  for widget in [child for child in self.children() if hasattr(child, 'title')]:
21  if widget.title() == name:
22  return widget
23  return None
24 
def Vispa.Gui.ConnectableWidgetOwner.ConnectableWidgetOwner.hideMenuWidgets (   self)
def Vispa.Gui.ConnectableWidgetOwner.ConnectableWidgetOwner.portConnection (   self,
  port1,
  port2 = None 
)
Returns the PortConnection if there is a connection in this ConnectableWidgetOwner that is attached to the given port.

Otherwise None will be returned.

Definition at line 42 of file ConnectableWidgetOwner.py.

References Vispa.Share.BasicDataAccessor.BasicDataAccessor.children(), Vispa.Plugins.EdmBrowser.EventContentDataAccessor.EventContentDataAccessor.children(), data_sources.node.children(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.children(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor.children(), geometry.Structure.children, Folder.children(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.children(), and Vispa.Views.LineDecayView.LineDecayContainer.children().

42  def portConnection(self, port1, port2=None):
43  """ Returns the PortConnection if there is a connection in this ConnectableWidgetOwner that is attached to the given port.
44 
45  Otherwise None will be returned.
46  """
47  for connection in [child for child in self.children() if isinstance(child, PortConnection)]:
48  if connection.attachedToPort(port1) and (not port2 or connection.attachedToPort(port2)):
49  return connection
50  return None
51 
def Vispa.Gui.ConnectableWidgetOwner.ConnectableWidgetOwner.propagateEventUnderConnectionWidget (   self,
  connection,
  event 
)
This function propagates an event to one of it's children.

If a connection widget is clicked in an area where it does not draw the connection line, the event should be forwarded to the underlying widget if there is such one.
However the default behavior of Qt is to propagate the event to the connection's parent. This should be an ConnectableWidgetOwner object.
This function is a workaround searching for any child widget at event.pos() which is not the initial connection.
If it finds such a widget a new event with correct position in the new widget's own frame is created and sent to the widget.
This function calls grabMouse() on the found child. The child should make sure releaseMouse() will be called e.g. in mouseReleaseEvent().

Currently supported events: QEvent.MouseButtonPress, QEvent.MouseButtonDblClick.

Definition at line 52 of file ConnectableWidgetOwner.py.

References Vispa.Share.BasicDataAccessor.BasicDataAccessor.children(), Vispa.Plugins.EdmBrowser.EventContentDataAccessor.EventContentDataAccessor.children(), data_sources.node.children(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.children(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor.children(), geometry.Structure.children, Folder.children(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.children(), Vispa.Views.LineDecayView.LineDecayContainer.children(), edm.contains(), and str.

52  def propagateEventUnderConnectionWidget(self, connection, event):
53  """ This function propagates an event to one of it's children.
54 
55  If a connection widget is clicked in an area where it does not draw the connection line, the event should be forwarded to the underlying widget if there is such one.
56  However the default behavior of Qt is to propagate the event to the connection's parent. This should be an ConnectableWidgetOwner object.
57  This function is a workaround searching for any child widget at event.pos() which is not the initial connection.
58  If it finds such a widget a new event with correct position in the new widget's own frame is created and sent to the widget.
59  This function calls grabMouse() on the found child. The child should make sure releaseMouse() will be called e.g. in mouseReleaseEvent().
60 
61  Currently supported events: QEvent.MouseButtonPress, QEvent.MouseButtonDblClick.
62  """
63  logging.debug("%s: propagateEventUnderConnectionWidget() - %s" % (self.__class__.__name__, str(event.type())))
64 
65  workspacePos = connection.mapToParent(event.pos())
66  for child in reversed(self.children()):
67  if not child==connection and isinstance(child,QWidget) and child.geometry().contains(workspacePos):
68  # do not forward event to connections which do not cross the mouse click point, this is important to prevent infinite loop error
69  if isinstance(child,PortConnection) and not child.belongsToRoute(workspacePos):
70  continue
71 # if event.type() == QEvent.MouseButtonDblClick or \
72 # event.type() == QEvent.MouseButtonPress or \
73 # event.type() == QEvent.MouseButtonRelease or \
74 # event.type() == QEvent.MouseMove or \
75 # event.type() == QEvent.DragEnter or \
76 # event.type() == QEvent.Drop:
77 
78  childPos = child.mapFromParent(workspacePos)
79  grandChild = child.childAt(childPos)
80  if grandChild:
81  child = grandChild
82  childPos = child.mapFromParent(childPos)
83  if event.type() == QEvent.MouseButtonPress:
84  child.grabMouse(QCursor(Qt.ClosedHandCursor))
85  child.setFocus()
86  newEvent = QMouseEvent(event.type(), childPos, event.button(), event.buttons(), event.modifiers())
87  QCoreApplication.instance().sendEvent(child, newEvent)
88  return True
89  return False
90 
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:38
#define str(s)
def Vispa.Gui.ConnectableWidgetOwner.ConnectableWidgetOwner.updateConnections (   self)