Version: 8.3.0
gui.CItems.Cell Class Reference
Inheritance diagram for gui.CItems.Cell:
Collaboration diagram for gui.CItems.Cell:

Public Member Functions

def __init__
 
def pynotify
 
def customEvent
 
def moveBy
 
def show
 
def getObj
 
def popup
 
def tooltip
 
def browse
 
def selected
 

Public Attributes

 inports
 
 outports
 
 node
 
 item
 
 label
 
 ingate
 
 outgate
 

Static Public Attributes

dictionary colors
 

Detailed Description

Definition at line 485 of file CItems.py.

Constructor & Destructor Documentation

def gui.CItems.Cell.__init__ (   self,
  node,
  canvas 
)

Definition at line 498 of file CItems.py.

499  def __init__(self,node,canvas):
500  QCanvasRectangle.__init__(self,canvas)
501  pypilot.PyObserver.__init__(self)
502  self.inports=[]
503  self.outports=[]
504  self.setSize(50,50)
505  #node is an instance of YACS::ENGINE::Node
506  self.node=node
507  self.item=Item.adapt(self.node)
508  dispatcher.addObserver(self,node,"status")
509  self.label=TextItem(self,canvas)
510  self.label.setText(self.node.getName())
511  self.label.setFont(QFont("Helvetica",8))
512  rect=self.label.boundingRect()
513  self.label.setZ(self.z()+1)
514  self.label.myMove(self.x()+self.width()/2-rect.width()/2,self.y()+self.height()/2-rect.height()/2)
515  color= self.colors.get(node.getColorState(node.getEffectiveState()),Qt.white)
516  self.setBrush(QBrush(color))
517 
518  dy=6
519  y=0
520  for inport in self.node.getSetOfInputPort():
521  p=InPortItem(self,inport,canvas)
522  y=y+dy
523  p.myMove(0,y)
524  self.inports.append(p)
525 
526  for instream in self.node.getSetOfInputDataStreamPort():
527  p=InStreamItem(self,instream,canvas)
528  y=y+dy
529  p.myMove(0,y)
530  self.inports.append(p)
531 
532  ymax=y
533 
534  dy=6
535  y=0
536  for outport in self.node.getSetOfOutputPort():
537  p=OutPortItem(self,outport,canvas)
538  y=y+dy
539  p.myMove(50,y)
540  self.outports.append(p)
541 
542  for outstream in self.node.getSetOfOutputDataStreamPort():
543  p=OutStreamItem(self,outstream,canvas)
544  y=y+dy
545  p.myMove(50,y)
546  self.outports.append(p)
547 
548  ymax=max(y,ymax)
549 
550  #Control ports
551  y=ymax+dy
552  if y < 44:y=44
553  p=InControlItem(self,self.node.getInGate(),canvas)
554  p.myMove(0,y)
555  self.inports.append(p)
556  self.ingate=p
557  p=OutControlItem(self,self.node.getOutGate(),canvas)
558  p.myMove(44,y)
559  self.outports.append(p)
560  self.outgate=p
561  y=y+dy
562  self.setSize(50,y)
563 

Member Function Documentation

def gui.CItems.Cell.browse (   self)

Definition at line 626 of file CItems.py.

Referenced by gui.GraphViewer.Cell.popup(), and gui.CItems.Cell.popup().

627  def browse(self):
628  print "browse"
def gui.CItems.Cell.customEvent (   self,
  event 
)

Definition at line 583 of file CItems.py.

References gui.cataitems.ItemNode.node, gui.cataitems.ItemComposedNode.node, gui.CItems.ControlItem.node, gui.CItems.PortItem.node, and gui.CItems.Cell.node.

584  def customEvent(self,event):
585  if event.yacsEvent=="status":
586  object=self.node
587  state=object.getEffectiveState()
588  color=object.getColorState(state)
589  color= self.colors.get(color,Qt.white)
590  self.setBrush(QBrush(color))
591  else:
592  print "Unknown custom event type:", event.type()
def gui.CItems.Cell.getObj (   self)

Definition at line 609 of file CItems.py.

610  def getObj(self):
611  return self
def gui.CItems.Cell.moveBy (   self,
  dx,
  dy 
)

Definition at line 593 of file CItems.py.

References gui.CItems.Cell.inports, and gui.CItems.Cell.outports.

594  def moveBy(self,dx,dy):
595  QCanvasRectangle.moveBy(self,dx,dy)
596  self.label.myMove(dx,dy)
597  for p in self.inports:
598  p.myMove(dx,dy)
599  for p in self.outports:
600  p.myMove(dx,dy)
def gui.CItems.Cell.popup (   self,
  canvasView 
)

Definition at line 612 of file CItems.py.

References gui.CItems.Cell.browse().

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

613  def popup(self,canvasView):
614  menu=QPopupMenu()
615  caption = QLabel( "<font color=darkblue><u><b>Node Menu</b></u></font>",menu )
616  caption.setAlignment( Qt.AlignCenter )
617  menu.insertItem( caption )
618  menu.insertItem("Browse", self.browse)
619  return menu
def gui.CItems.Cell.pynotify (   self,
  object,
  event 
)

Definition at line 568 of file CItems.py.

References gui.graph.Graph.canvas, and gui.CItems.LinkItem.canvas.

569  def pynotify(self,object,event):
570  #print "pynotify",event,object
571  try:
572  evType=self.events[event]
573  ev=QCustomEvent(evType)
574  ev.setData(self)
575  ev.yacsEvent=event
576  QApplication.postEvent(self.canvas(), ev)
577  #request immediate processing (deadlock risk ???)
578  #QApplication.sendPostedEvents(self.canvas(), evType)
579  #print "pynotify end"
580  except:
581  #traceback.print_exc()
582  raise
def gui.CItems.Cell.selected (   self)
The canvas item has been selected

Definition at line 629 of file CItems.py.

References gui.cataitems.ItemNode.node, gui.cataitems.ItemComposedNode.node, gui.CItems.ControlItem.node, gui.CItems.PortItem.node, and gui.CItems.Cell.node.

630  def selected(self):
631  """The canvas item has been selected"""
632  #print "node selected"
633  item=Item.adapt(self.node)
634  item.selected()
def gui.CItems.Cell.show (   self)

Definition at line 601 of file CItems.py.

References gui.CItems.Cell.inports, and gui.CItems.Cell.outports.

602  def show(self):
603  QCanvasRectangle.show(self)
604  self.label.show()
605  for p in self.inports:
606  p.show()
607  for p in self.outports:
608  p.show()
def gui.CItems.Cell.tooltip (   self,
  view,
  pos 
)

Definition at line 620 of file CItems.py.

References YACS::HMI::presentationtype_parser.height(), and YACS::HMI::presentationtype_parser.width().

621  def tooltip(self,view,pos):
622  r = QRect(pos.x(), pos.y(), self.width(), self.height())
623  s = QString( "node: " + self.node.getName())
624  view.tip( r, s )
625  #QToolTip(view).tip( r, s )

Member Data Documentation

dictionary gui.CItems.Cell.colors
static
Initial value:
1 = {
2  "pink":Qt.cyan,
3  "green":Qt.green,
4  "magenta":Qt.magenta,
5  "purple":Qt.darkMagenta,
6  "blue":Qt.blue,
7  "red":Qt.red,
8  "orange":Qt.yellow,
9  "grey":Qt.gray,
10  "white":Qt.white,
11  }

Definition at line 486 of file CItems.py.

gui.CItems.Cell.ingate

Definition at line 555 of file CItems.py.

gui.CItems.Cell.inports

Definition at line 501 of file CItems.py.

Referenced by gui.GraphViewer.Cell.moveBy(), gui.CItems.Cell.moveBy(), gui.GraphViewer.Cell.show(), and gui.CItems.Cell.show().

gui.CItems.Cell.item

Definition at line 506 of file CItems.py.

gui.CItems.Cell.label

Definition at line 508 of file CItems.py.

gui.CItems.Cell.node

Definition at line 505 of file CItems.py.

Referenced by gui.CItems.Cell.customEvent(), and gui.CItems.Cell.selected().

gui.CItems.Cell.outgate

Definition at line 559 of file CItems.py.

gui.CItems.Cell.outports

Definition at line 502 of file CItems.py.

Referenced by gui.GraphViewer.Cell.moveBy(), gui.CItems.Cell.moveBy(), gui.GraphViewer.Cell.show(), and gui.CItems.Cell.show().


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