grc.gui.elements.Element.Element Class Reference

List of all members.

Public Member Functions

def __init__
def is_horizontal
def is_vertical
def get_gc
def draw
def rotate
def clear
def set_coordinate
def get_parent
def set_highlighted
def is_highlighted
def get_coordinate
def move
def add_area
def add_line
def what_is_selected
def get_rotation
def set_rotation
def update

Public Attributes

 areas_dict
 lines_dict
 coor
 highlighted
 rotation

Private Attributes

 _gc


Detailed Description

GraphicalElement is the base class for all graphical elements.
It contains an X,Y coordinate, a list of rectangular areas that the element occupies,
and methods to detect selection of those areas.

Definition at line 31 of file Element.py.


Member Function Documentation

def grc.gui.elements.Element.Element.__init__ (   self,
  args,
  kwargs 
)

Make a new list of rectangular areas and lines, and set the coordinate and the rotation.

Definition at line 38 of file Element.py.

def grc.gui.elements.Element.Element.is_horizontal (   self,
  rotation = None 
)

Is this element horizontal? If rotation is None, use this element's rotation.

Parameters:
rotation the optional rotation
Returns:
true if rotation is horizontal

Definition at line 47 of file Element.py.

def grc.gui.elements.Element.Element.is_vertical (   self,
  rotation = None 
)

Is this element vertical? If rotation is None, use this element's rotation.

Parameters:
rotation the optional rotation
Returns:
true if rotation is vertical

Definition at line 57 of file Element.py.

def grc.gui.elements.Element.Element.get_gc (   self  ) 

Definition at line 67 of file Element.py.

def grc.gui.elements.Element.Element.draw (   self,
  window,
  BG_color = Colors.BG_COLOR,
  FG_color = Colors.FG_COLOR 
)

Draw in the given window.

Parameters:
window the gtk window to draw on
BG_color the background color
FG_color the foreground color

Definition at line 69 of file Element.py.

def grc.gui.elements.Element.Element.rotate (   self,
  direction 
)

Rotate all of the areas by 90 degrees.

Parameters:
direction 90 or 270 degrees

Definition at line 90 of file Element.py.

def grc.gui.elements.Element.Element.clear (   self  ) 

Empty the lines and areas.

Definition at line 97 of file Element.py.

def grc.gui.elements.Element.Element.set_coordinate (   self,
  coor 
)

Set the reference coordinate.

Parameters:
coor the coordinate tuple (x,y)

Definition at line 102 of file Element.py.

def grc.gui.elements.Element.Element.get_parent (   self  ) 

Get the parent of this element.

Returns:
the parent

Definition at line 109 of file Element.py.

def grc.gui.elements.Element.Element.set_highlighted (   self,
  highlighted 
)

Set the highlight status.

Parameters:
highlighted true to enable highlighting

Definition at line 116 of file Element.py.

def grc.gui.elements.Element.Element.is_highlighted (   self  ) 

Get the highlight status.

Returns:
true if highlighted

Definition at line 123 of file Element.py.

def grc.gui.elements.Element.Element.get_coordinate (   self  ) 

Get the coordinate.

Returns:
the coordinate tuple (x,y)

Definition at line 130 of file Element.py.

def grc.gui.elements.Element.Element.move (   self,
  delta_coor 
)

Move the element by adding the delta_coor to the current coordinate.

Parameters:
delta_coor (delta_x,delta_y) tuple

Definition at line 136 of file Element.py.

def grc.gui.elements.Element.Element.add_area (   self,
  rel_coor,
  area,
  rotation = None 
)

Add an area to the area list. An area is actually a coordinate relative to the main coordinate with a width/height pair relative to the area coordinate. A positive width is to the right of the coordinate. A positive height is above the coordinate. The area is associated with a rotation. If rotation is not specified, the element's current rotation is used.

Parameters:
rel_coor (x,y) offset from this element's coordinate
area (width,height) tuple
rotation rotation in degrees

Definition at line 145 of file Element.py.

def grc.gui.elements.Element.Element.add_line (   self,
  rel_coor1,
  rel_coor2,
  rotation = None 
)

Add a line to the line list. A line is defined by 2 relative coordinates. Lines must be horizontal or vertical. The line is associated with a rotation. If rotation is not specified, the element's current rotation is used.

Parameters:
rel_coor1 relative (x1,y1) tuple
rel_coor2 relative (x2,y2) tuple
rotation rotation in degrees

Definition at line 160 of file Element.py.

def grc.gui.elements.Element.Element.what_is_selected (   self,
  coor,
  coor_m = None 
)

One coordinate specified: Is this element selected at given coordinate? ie: is the coordinate encompassed by one of the areas or lines? Both coordinates specified: Is this element within the rectangular region defined by both coordinates? ie: do any area corners or line endpoints fall within the region?

Parameters:
coor the selection coordinate, tuple x, y
coor_m an additional selection coordinate.
Returns:
self if one of the areas/lines encompasses coor, else None.

Definition at line 173 of file Element.py.

def grc.gui.elements.Element.Element.get_rotation (   self  ) 

Get the rotation in degrees.

Returns:
the rotation

Definition at line 215 of file Element.py.

def grc.gui.elements.Element.Element.set_rotation (   self,
  rotation 
)

Set the rotation in degrees.

Parameters:
rotation the rotation

Definition at line 222 of file Element.py.

def grc.gui.elements.Element.Element.update (   self  ) 

Do nothing for the update. Dummy method.

Definition at line 230 of file Element.py.


Member Data Documentation

grc.gui.elements.Element.Element._gc [private]

Definition at line 77 of file Element.py.

grc.gui.elements.Element.Element.areas_dict

Definition at line 99 of file Element.py.

grc.gui.elements.Element.Element.lines_dict

Definition at line 100 of file Element.py.

grc.gui.elements.Element.Element.coor

Definition at line 107 of file Element.py.

grc.gui.elements.Element.Element.highlighted

Definition at line 121 of file Element.py.

grc.gui.elements.Element.Element.rotation

Definition at line 228 of file Element.py.


The documentation for this class was generated from the following file:
Generated on Sat Aug 23 02:00:11 2008 for GNU Radio Companion by  doxygen 1.5.4