Version: 8.3.0
gui.CItems.LinkItem Class Reference
Inheritance diagram for gui.CItems.LinkItem:

Public Member Functions

def __init__
 
def deletePoint
 
def clearPoints
 
def splitline
 
def splitLine
 
def setFromPoint
 
def setToPoint
 
def moveBy
 
def popup
 
def delete
 
def tooltip
 
def selected
 

Public Attributes

 fromPort
 
 toPort
 
 canvas
 
 item
 
 lines
 
 points
 

Detailed Description

Definition at line 175 of file CItems.py.

Constructor & Destructor Documentation

def gui.CItems.LinkItem.__init__ (   self,
  fromPort,
  toPort,
  canvas 
)

Definition at line 176 of file CItems.py.

177  def __init__(self,fromPort, toPort,canvas):
178  self.fromPort=fromPort
179  self.toPort=toPort
180  self.canvas=canvas
181  self.item=None
182  fromPort.addOutLink(self)
183  toPort.addInLink(self)
184  self.lines=[]
185  self.points=[]
186  self.lines.append(LineItem(self,fromPort, toPort,canvas))

Member Function Documentation

def gui.CItems.LinkItem.clearPoints (   self)

Definition at line 203 of file CItems.py.

References gui.CItems.LinkItem.deletePoint(), and gui.CItems.LinkItem.points.

204  def clearPoints(self):
205  #make a copy as deletePoint modify self.points
206  for point in self.points[:]:
207  self.deletePoint(point,0)
def gui.CItems.LinkItem.delete (   self)

Definition at line 248 of file CItems.py.

Referenced by gui.GraphViewer.LinkItem.popup().

249  def delete(self):
250  print "delete link"
def gui.CItems.LinkItem.deletePoint (   self,
  point,
  pos 
)
Delete intermediate point

Definition at line 187 of file CItems.py.

References gui.CItems.LinkItem.points.

Referenced by gui.CItems.LinkItem.clearPoints().

188  def deletePoint(self,point,pos):
189  """Delete intermediate point"""
190  if point not in self.points:
191  return
192  self.points.remove(point)
193  inline=point.inline
194  outline=point.outline
195  inline.toPoint=outline.toPoint
196  inline.setToPoint(outline.toPoint.x(),outline.toPoint.y())
197  self.lines.remove(outline)
198  if inline.toPoint in self.points:
199  inline.toPoint.setInline(inline)
200  #remove from canvas
201  point.clear()
202  outline.clear()
def gui.CItems.LinkItem.moveBy (   self,
  dx,
  dy 
)

Definition at line 237 of file CItems.py.

238  def moveBy(self,dx,dy):
239  pass
def gui.CItems.LinkItem.popup (   self,
  canvasView 
)

Definition at line 240 of file CItems.py.

Referenced by gui.GraphViewer.GraphViewer.contentsMousePressEvent().

241  def popup(self,canvasView):
242  menu=QPopupMenu()
243  caption = QLabel( "<font color=darkblue><u><b>Link Menu</b></u></font>",menu )
244  caption.setAlignment( Qt.AlignCenter )
245  menu.insertItem( caption )
246  menu.insertItem("Delete", self.delete)
247  return menu
def gui.CItems.LinkItem.selected (   self)
The canvas item has been selected

Definition at line 256 of file CItems.py.

257  def selected(self):
258  """The canvas item has been selected"""
def gui.CItems.LinkItem.setFromPoint (   self,
  x,
  y 
)

Definition at line 229 of file CItems.py.

References gui.CItems.LinkItem.lines.

230  def setFromPoint(self,x,y):
231  first=self.lines[0]
232  first.setFromPoint(x,y)
def gui.CItems.LinkItem.setToPoint (   self,
  x,
  y 
)

Definition at line 233 of file CItems.py.

References gui.CItems.LinkItem.lines.

234  def setToPoint(self,x,y):
235  last=self.lines[-1]
236  last.setToPoint(x,y)
def gui.CItems.LinkItem.splitline (   self,
  line,
  pos 
)

Definition at line 208 of file CItems.py.

References gui.CItems.LinkItem.splitLine().

209  def splitline(self,line,pos):
210  self.splitLine(line,pos.x(),pos.y())
def gui.CItems.LinkItem.splitLine (   self,
  line,
  x,
  y 
)
Split line at position x,y

Definition at line 211 of file CItems.py.

References gui.CItems.LinkItem.canvas, and gui.CItems.LinkItem.points.

Referenced by gui.CItems.LinkItem.splitline().

212  def splitLine(self,line,x,y):
213  """Split line at position x,y"""
214  #The new point
215  point=PointItem(self,x,y,self.canvas)
216  self.points.append(point)
217  i=self.lines.index(line)
218 
219  newline=LineItem(self,point,line.toPoint,self.canvas)
220  if line.toPoint in self.points:
221  #line not connected to port : reconnect newline
222  line.toPoint.setInline(newline)
223  self.lines.insert(i+1,newline)
224 
225  line.setToPoint(x,y)
226  line.toPoint=point
227  point.setInline(line)
228  point.setOutline(newline)
def gui.CItems.LinkItem.tooltip (   self,
  view,
  pos 
)

Definition at line 251 of file CItems.py.

252  def tooltip(self,view,pos):
253  r = QRect(pos.x(), pos.y(), pos.x()+10, pos.y()+10)
254  s = QString( "link: "+self.fromPort.port.getNode().getName() +":"+self.fromPort.port.getName()+"->"+self.toPort.port.getNode().getName()+":"+self.toPort.port.getName() )
255  view.tip( r, s )

Member Data Documentation

gui.CItems.LinkItem.canvas

Definition at line 179 of file CItems.py.

Referenced by gui.graph.Graph.addItem(), gui.graph.Graph.addLink(), gui.GraphViewer.GraphViewer.clear(), gui.GraphViewer.GraphViewer.contentsMouseDoubleClickEvent(), gui.GraphViewer.GraphViewer.contentsMouseMoveEvent(), gui.GraphViewer.GraphViewer.contentsMousePressEvent(), gui.GraphViewer.InPortItem.link(), gui.CItems.InControlItem.link(), gui.GraphViewer.OutPortItem.link(), gui.CItems.OutControlItem.link(), gui.CItems.InPortItem.link(), gui.CItems.OutPortItem.link(), gui.CItems.Cell.pynotify(), gui.GraphViewer.GraphViewer.selectItem(), and gui.CItems.LinkItem.splitLine().

gui.CItems.LinkItem.fromPort

Definition at line 177 of file CItems.py.

gui.CItems.LinkItem.item

Definition at line 180 of file CItems.py.

gui.CItems.LinkItem.lines

Definition at line 183 of file CItems.py.

Referenced by gui.CItems.LinkItem.setFromPoint(), and gui.CItems.LinkItem.setToPoint().

gui.CItems.LinkItem.points

Definition at line 184 of file CItems.py.

Referenced by gui.CItems.LinkItem.clearPoints(), gui.CItems.LinkItem.deletePoint(), and gui.CItems.LinkItem.splitLine().

gui.CItems.LinkItem.toPort

Definition at line 178 of file CItems.py.


The documentation for this class was generated from the following file: