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

Type ScrolledList

 object --+                    
          |                    
INotifyable --+                
              |                
     BaseObject --+            
                  |            
     object --+   |            
              |   |            
         Sprite --+            
                  |            
         BaseWidget --+        
                      |        
                    Bin --+    
                          |    
             ScrolledWindow --+
                              |
                             ScrolledList

Known Subclasses:
FileList

ScrolledList (width, height, collection=None) -> ScrolledList

A widget class, that populates elements in a list-style manner.

The ScrolledList displays data in a listed form and allows to browse
through it using horizontal and vertical scrolling. Single or
multiple items of the list can be selected or - dependant on the
ListItem object - be edited, etc.

The ScrolledList's child is a ListViewPort object, which takes care
of drawing the attached list items. You can supply your own
ListViewPort object through the 'child' attribute as described in
the Bin class documentation.

To set or reset an already created collection of items, the 'items'
attribute and set_items() method can be used. The collection to set
needs to be a ListItemCollection object.

myitems = ListItemCollection()
myitems.append (TextListItem ('First')
scrolledlist.items = myitems
scrolledlist.set_items (myitems)

The ScrolledList allows different types of selections by modifying
the 'selectionmode' attribute. Dependant on the set selection mode,
you can then select multiple items at once (SELECTION_MULTIPLE),
only one item at a time (SELECTION_SINGLE) or nothing at all
(SELECTION_NONE). Modifying the selection mode does not have any
effect on a currently made selection. See the selection constants
section in the Constants documentation for more details.

scrolledlist.selectionmode = SELECTION_NONE
scrolledlist.set_selectionmode (SELECTION_SINGLE)

To improve the appearance and selection behaviour of the single list
items, the ScrolledList support additional spacing to place between
them. It can be read and set through the 'spacing' attribute and
set_spacing() method.

scrolledlist.spacing = 4
scrolledlist.set_spacing (0)

Default action (invoked by activate()):
See the ScrolledWindow class.

Mnemonic action (invoked by activate_mnemonic()):
None

Signals:
SIG_SELECTCHANGED - Invoked, when the item selection changed.
SIG_LISTCHANGED   - Invoked, when the underlying item list changed.

Attributes:
items         - Item list of the ScrolledList.
selectionmode - The selection mode for the ScrolledList. Default is
                SELECTION_MULTIPLE.
spacing       - Spacing to place between the list items. Default is 0.
cursor        - The currently focused item.

Method Summary
  __init__(self, width, height, collection)
  deselect(self, *items)
S.deselect (...) -> None
  get_selected(self)
S.get_selected () -> list
  notify(self, event)
S.notify (...) -> None
  select(self, *items)
S.select (...) -> None
  select_all(self)
S.select_all () -> None
  set_cursor(self, item, selected)
S.set_cursor (...) -> None
  set_focus(self, focus)
S.set_focus (...) -> bool
  set_items(self, items)
S.set_items (...) -> None
  set_selectionmode(self, mode)
S.set_selectionmode (...) -> None
  set_spacing(self, spacing)
S.set_spacing (...) -> None
  __deselect(self, *items)
S.__deselect (..:) -> None
  __select(self, *items)
S.__select (...) -> None
  _click(self, position)
S._click (...) -> None
  _cursor_next(self, selected)
S._cursor_next () -> None
  _cursor_prev(self, selected)
S._cursor_prev () -> None
  _item_has_changed(self, item)
S._item_has_changed (...) -> None
  _list_has_changed(self, collection)
S._list_has_changed (...) -> None
  _navigate(self, key, mod)
S._navigate (key) -> None
  _scroll_to_cursor(self)
S._scroll_to_cursor () -> None
    Inherited from ScrolledWindow
  activate(self)
S.activate () -> None
  draw(self)
W.draw () -> None
  draw_bg(self)
S.draw_bg () -> Surface
  set_child(self, child)
B.set_child (...) -> None
  set_scrolling(self, scrolling)
S.set_scrolling (...) -> None
  _scroll_child(self)
S._scroll_child () -> None
  _update_scrollbars(self)
S._update_scrollbars (...) -> bool, bool
    Inherited from Bin
  destroy(self)
B.destroy () -> None
  set_depth(self, depth)
B.set_depth (...) -> None
  set_event_manager(self, manager)
B.set_event_manager (...) -> None
  set_indexable(self, indexable)
B.set_indexable (...) -> None
  set_padding(self, padding)
B.set_padding (...) -> None
  set_sensitive(self, sensitive)
B.set_sensitive (...) -> None
  update(self, **kwargs)
B.update (...) -> None
    Inherited from BaseWidget
  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
  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
  _get_rect(self)
W._get_rect () -> pygame.Rect
  _get_rect_attr(self, attr)
W._get_rect_attr (...) -> var
  _set_rect_attr(self, attr, value)
W._set_rect_attr (...) -> 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
  cursor: The item, which is currently focused.
  items: The item collection of the ScrolledList.
  selectionmode: The selection mode for the ScrolledList.
  spacing: Additional spacing to place between the items.
    Inherited from ScrolledWindow
  hscrollbar: The herizontal scrollbar.
  scrolling: The scrolling behaviour for the ScrolledWindow.
  vscrollbar: The vertical scrollbar.
    Inherited from Bin
  child: The widget hold by the Bin.
  padding: Additional padding between child and borders.
    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

deselect(self, *items)

S.deselect (...) -> None

Deselects the specified items in the ScrolledList.

The method causes the SIG_SELECTCHANGED event to be emitted, when the selection changes.

Raises a LookupError, if the passed argument could not be found in the items attribute.

get_selected(self)

S.get_selected () -> list

Returns a list cotaining the selected items.

notify(self, event)

S.notify (...) -> None

Notifies the ScrolledList about an event.
Overrides:
ocempgui.widgets.ScrolledWindow.ScrolledWindow.notify

select(self, *items)

S.select (...) -> None

Selects one or more specific items of the ScrolledList.

Dependant on the set selection mode selecting an item has specific side effects. If the selection mode is set to SELECTION_SINGLE, selecting an item causes any other item to become deselected. As a counterpart SELECTION_MULTIPLE causes the items to get selected while leaving any other item untouched. The method causes the SIG_SELECTCHANGED event to be emitted, whenever the selection changes.

Raises a LookupError, if the passed argument could not be found in the items attribute.

select_all(self)

S.select_all () -> None

Selects all items of the ScrolledList.

Selects all items of the ScrolledList, if the selection mode is set to SELECTION_MULTIPLE

set_cursor(self, item, selected)

S.set_cursor (...) -> None

Sets the cursor index to the desired item.

set_focus(self, focus=True)

S.set_focus (...) -> bool

Sets the input and action focus of the ScrolledList.

Sets the input and action focus of the ScrolledList and returns True upon success or False, if the focus could not be set.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.set_focus

set_items(self, items)

S.set_items (...) -> None

Sets a collection of items to display.

set_selectionmode(self, mode)

S.set_selectionmode (...) -> None

Sets the selection mode for the ScrolledList.

The selection mode can be one of the SELECTION_TYPES list. SELECTION_NONE disables selecting any list item, SELECTION_SINGLE allows to select only one item from the list and SELECTION_MULTIPLE allows to select multiple items from the list.

Raises a ValueError, if the passed argument is not a value of the SELECTION_TYPES tuple.

set_spacing(self, spacing)

S.set_spacing (...) -> None

Sets the spacing to place between the list items of the ScrolledList.

The spacing value is the amount of pixels to place between the items of the ScrolledList.

Raises a TypeError, if the passed argument is not a positive integer.

__deselect(self, *items)

S.__deselect (..:) -> None

Deselects the specified items in the ScrolledList

__select(self, *items)

S.__select (...) -> None

Selects one or more specific items of the ScrolledList.

_click(self, position)

S._click (...) -> None

Deals with mouse clicks.

_cursor_next(self, selected)

S._cursor_next () -> None

Advances the cursor to the next item in the list.

_cursor_prev(self, selected)

S._cursor_prev () -> None

Advances the cursor to the previous item in the list.

_item_has_changed(self, item)

S._item_has_changed (...) -> None

Update method for item_changed() notifications.

_list_has_changed(self, collection)

S._list_has_changed (...) -> None

Update method for list_changed () notifications.

_navigate(self, key, mod)

S._navigate (key) -> None

Deals with keyboard navigation.

_scroll_to_cursor(self)

S._scroll_to_cursor () -> None

Scrolls the list to the cursor.

Property Details

cursor

The item, which is currently focused.
Get Method:
unknown-696640932(...)

items

The item collection of the ScrolledList.
Get Method:
unknown-696640820(...)
Set Method:
unknown-696640876(...)

selectionmode

The selection mode for the ScrolledList.
Get Method:
unknown-696640596(...)
Set Method:
unknown-696640652(...)

spacing

Additional spacing to place between the items.
Get Method:
unknown-696640708(...)
Set Method:
unknown-696640764(...)

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