Package ocempgui :: Package widgets :: Module Table :: Class Table
[show private | hide private]
[frames | no frames]

Type Table

 object --+                
          |                
INotifyable --+            
              |            
     BaseObject --+        
                  |        
     object --+   |        
              |   |        
         Sprite --+        
                  |        
         BaseWidget --+    
                      |    
              Container --+
                          |
                         Table


Table (rows, cols) -> Table

A container widget, which packs its children in a table like manner.

The Table class is a layout container, which packs it children in a
regular, table like manner and allows each widget to be aligned
within its table cell. The table uses a 0-based (Null-based)
indexing, which means, that if 4 rows are created, they can be
accessed using a row value ranging from 0 to 3. The same applies to
the columns.

The Table provides read-only 'columns' and 'rows' attributes, which
are the amount of columns and rows within that Table.

totalr = table.rows
totalc = table.columns

To access the children of the Table the 'grid' attribute can be
used. It is a dictionary containing the widgets as values. To access
a widget, a tuple containing the row and column is used as the
dictionary key.

widget = table.grid[(0, 3)]
widget = table.grid[(7, 0)]

The above examples will get the widget located at the first row,
fourth column (0, 3) and the eighth row, first column (7, 0).

The layout for each widget within the table can be set individually
using the set_align() method. Alignments can be combined, which
means, that a ALIGN_TOP | ALIGN_LEFT would align the widget at the
topleft corner of its cell.

However, not every alignment make sense, so a ALIGN_TOP | ALIGN_BOTTOM
would cause the widget to be placed at the top. The priority
order for the alignment follows. The lower the value, the higher the
priority.

Alignment      Priority
-----------------------
ALIGN_TOP         0
ALIGN_BOTTOM      1
ALIGN_LEFT        0
ALIGN_RIGHT       1
ALIGN_NONE        2

Default action (invoked by activate()):
None

Mnemonic action (invoked by activate_mnemonic()):
None

Attributes:
columns  - The column amount of the Table.
rows     - The row amount of the Table.
grid     - Grid to hold the children of the Table.

Method Summary
  __init__(self, rows, cols)
  add_child(self, row, col, widget)
T.add_child (...) -> None
  calculate_size(self)
T.calculate_size () -> int, int
  destroy(self)
T.destroy () -> None
  dispose_widgets(self)
T.dispose_widgets (...) -> None
  draw(self)
T.draw () -> None
  draw_bg(self)
T.draw_bg () -> Surface
  insert_child(self, pos, *children)
C.insert_child (...) -> None
  remove_child(self, widget)
T.remove_widget (...) -> None
  set_align(self, row, col, align)
T.set_align (...) -> None
  set_children(self, children)
T.set_children (...) -> None
  set_column_align(self, col, align)
T.set_column_align (...) -> None
  set_focus(self, focus)
T.set_focus (focus=True) -> None
  set_row_align(self, row, align)
T.set_row_align (...) -> None
    Inherited from Container
  set_depth(self, depth)
C.set_depth (...) -> None
  set_event_manager(self, manager)
C.set_event_manager (...) -> None
  set_indexable(self, indexable)
C.set_indexable (...) -> None
  set_padding(self, padding)
C.set_padding (...) -> None
  set_sensitive(self, sensitive)
C.set_sensitive (...) -> None
  set_spacing(self, spacing)
C.set_spacing (...) -> None
  update(self, **kwargs)
C.update (...) -> None
    Inherited from BaseWidget
  activate(self)
W.activate () -> None
  activate_mnemonic(self, mnemonic)
W.activate_mnemonic (...) -> bool
  check_sizes(self, width, height)
W.check_sizes (...) -> int, int
  create_style(self)
W.create_style () -> WidgetStyle
  debug_update(self)
For debugging usage only
  get_style(self)
W.get_style () -> WidgetStyle
  initclass(cls)
B.initclass () -> None (Class method)
  lock(self)
W.lock () -> None
  notify(self, event)
W.notify (...) -> None
  rect_to_client(self, rect)
W.rect_to_client (...) -> pygame.Rect
  set_dirty(self, dirty, update)
W.set_dirty (...) -> None
  set_entered(self, entered)
W.set_entered (...) -> None
  set_event_area(self, area)
W.set_event_area (...) -> None
  set_index(self, index)
W.set_index (...) -> None
  set_maximum_size(self, width, height)
W.set_maximum_size (...) -> None
  set_minimum_size(self, width, height)
W.set_minimum_size (...) -> None
  set_opacity(self, opacity)
W.set_opacity (...) -> None
  set_position(self, x, y)
W.set_position (...) -> None
  set_size(self, width, height)
W.set_size (...) -> None
  set_state(self, state)
W.set_state (...) -> None
  set_style(self, style)
W.set_style (...) -> None
  set_tooltip(self, tooltip)
W.set_tooltip (...) -> None
  unlock(self)
W.unlock () -> None
    Inherited from BaseObject
  connect_signal(self, signal, callback, *data)
B.connect_signal (...) -> EventCallback
  disconnect_signal(self, event)
B.disconnect_signal (...) -> None
  emit(self, signal, data)
B.emit (...) -> bool
  run_signal_handlers(self, signal, *data)
B.run_signal_handlers (...) -> None
    Inherited from Sprite
  __repr__(self)
  add(self, *groups)
add(group or list of of groups, ...) add a sprite to container
  add_internal(self, group)
  alive(self)
alive() -> bool check to see if the sprite is in any groups
  groups(self)
groups() -> list of groups list used sprite containers
  kill(self)
kill() remove this sprite from all groups
  remove(self, *groups)
remove(group or list of groups, ...) remove a sprite from container
  remove_internal(self, group)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Property Summary
  columns: The column amount of the Table.
  grid: The grid of the Table.
  rows: The row amount of the Table.
    Inherited from Container
  children: List of the children for the Container.
  padding: The additional padding for the Container.
  spacing: The spacing between the children.
    Inherited from BaseWidget
  bottom
  bottomleft
  bottomright
  center
  centerx
  centery
  controls: Widgets associated with the widget.
  depth: The z-axis layer depth of the widget.
  dirty: Indicates, whether the widget need to be redrawn.
  entered: Indicates, whether the widget is entered.
  eventarea: The area, which gets the events.
  focus: The focus of the widget.
  h
  height
  image: The visible surface of the widget.
  index: The tab index position of the widget.
  indexable: The IIndexable, the widget is attached to.
  left
  locked: Indicates, whether the widget is locked.
  maxsize: The maximum size to occupy by the widget.
  midbottom
  midleft
  midright
  midtop
  minsize: The guaranteed size of the widget.
  opacity: The opacity of the widget.
  position: The position of the topleft corner.
  rect: The area occupied by the widget.
  right
  sensitive: The sensitivity of the widget.
  size
  state: The current state of the widget.
  style: The style of the widget.
  tooltip: The tool tip text to display for the widget.
  top
  topleft
  topright
  w
  width
  x
  y
    Inherited from BaseObject
  manager: The event manager to use by the object.

Instance Method Details

add_child(self, row, col, widget)

T.add_child (...) -> None

Adds a widget into the cell located at (row, col) of the Table.

Raises a ValueError, if the passed row and col arguments are not within the cell range of the Table. Raises an Exception, if the cell at the passed row and col coordinates is already occupied.
Overrides:
ocempgui.widgets.Container.Container.add_child

calculate_size(self)

T.calculate_size () -> int, int

Calculates the size needed by the children.

Calculates the size needed by the children and returns the resulting width and height.
Overrides:
ocempgui.widgets.Container.Container.calculate_size

destroy(self)

T.destroy () -> None

Destroys the Table and all its children and shedules them for deletion by the renderer.
Overrides:
ocempgui.widgets.Container.Container.destroy

dispose_widgets(self)

T.dispose_widgets (...) -> None

Sets the children to their correct positions within the Table.
Overrides:
ocempgui.widgets.Container.Container.dispose_widgets

draw(self)

T.draw () -> None

Draws the Table surface and places its children on it.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.draw

draw_bg(self)

T.draw_bg () -> Surface

Draws the background surface of the Table and returns it.

Creates the visible surface of the Table and returns it to the caller.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.draw_bg

insert_child(self, pos, *children)

C.insert_child (...) -> None

Inserts one or more children at the desired position.

Raises a NotImplementedError, as this method cannot be applied to the Table.
Overrides:
ocempgui.widgets.Container.Container.insert_child

remove_child(self, widget)

T.remove_widget (...) -> None

Removes a widget from the Table.
Overrides:
ocempgui.widgets.Container.Container.remove_child

set_align(self, row, col, align=0)

T.set_align (...) -> None

Sets the alignment for a specific cell.

Raises a ValueError, if the passed row and col arguments are not within the rows and columns of the Table. Raises a TypeError, if the passed align argument is not a value from ALIGN_TYPES.

set_children(self, children)

T.set_children (...) -> None

Sets the children of the Table.

When setting the children of the Table, keep in mind, that the children will be added row for row, causing the Table to fill the first row of itself, then the second and so on.

Raises a ValueError, if the passed amount of children exceeds the cell amount of the Table.
Overrides:
ocempgui.widgets.Container.Container.set_children

set_column_align(self, col, align=0)

T.set_column_align (...) -> None

Sets the alignment for a whole column range.

Raises a ValueError, if the passed col argument is not within the column range of the Table. Raises a TypeError, if the passed align argument is not a value from ALIGN_TYPES.

set_focus(self, focus=True)

T.set_focus (focus=True) -> None

Overrides the set_focus() behaviour for the Table.

The Table class is not focusable by default. It is a layout class for other widgets, so it does not need to get the input focus and thus it will return false without doing anything.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.set_focus

set_row_align(self, row, align=0)

T.set_row_align (...) -> None

Sets the alignment for a whole row.

Raises a ValueError, if the passed row argument is not within the row range of the Table. Raises a TypeError, if the passed align argument is not a value from ALIGN_TYPES.

Property Details

columns

The column amount of the Table.
Get Method:
unknown-696664668(...)

grid

The grid of the Table.
Get Method:
unknown-696664780(...)

rows

The row amount of the Table.
Get Method:
unknown-696664724(...)

Generated by Epydoc 2.1 on Thu Jan 10 10:18:42 2008 http://epydoc.sf.net