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 | |
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.
| 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.
| rotation | the optional rotation |
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.
| rotation | the optional rotation |
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.
| 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.
| direction | 90 or 270 degrees |
Definition at line 90 of file Element.py.
| def grc.gui.elements.Element.Element.clear | ( | self | ) |
| def grc.gui.elements.Element.Element.set_coordinate | ( | self, | ||
| coor | ||||
| ) |
Set the reference coordinate.
| coor | the coordinate tuple (x,y) |
Definition at line 102 of file Element.py.
| def grc.gui.elements.Element.Element.get_parent | ( | self | ) |
| def grc.gui.elements.Element.Element.set_highlighted | ( | self, | ||
| highlighted | ||||
| ) |
Set the highlight status.
| highlighted | true to enable highlighting |
Definition at line 116 of file Element.py.
| def grc.gui.elements.Element.Element.is_highlighted | ( | self | ) |
| def grc.gui.elements.Element.Element.get_coordinate | ( | self | ) |
| def grc.gui.elements.Element.Element.move | ( | self, | ||
| delta_coor | ||||
| ) |
Move the element by adding the delta_coor to the current coordinate.
| 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.
| 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.
| 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?
| coor | the selection coordinate, tuple x, y | |
| coor_m | an additional selection coordinate. |
Definition at line 173 of file Element.py.
| def grc.gui.elements.Element.Element.get_rotation | ( | self | ) |
| def grc.gui.elements.Element.Element.set_rotation | ( | self, | ||
| rotation | ||||
| ) |
Set the rotation in degrees.
| rotation | the rotation |
Definition at line 222 of file Element.py.
| def grc.gui.elements.Element.Element.update | ( | self | ) |
grc.gui.elements.Element.Element._gc [private] |
Definition at line 77 of file Element.py.
Definition at line 99 of file Element.py.
Definition at line 100 of file Element.py.
Definition at line 107 of file Element.py.
Definition at line 121 of file Element.py.
Definition at line 228 of file Element.py.
1.5.4