A generic Selector class handling selecting lists in GUIs.
Purpose: Handles the user selecting and deselecting list widgets.
Used by: MainWindow
Uses: None
Attributes: None
SRS Refs: 3.2.1.2, 3.2.1.3, 3.2.1.5, 3.2.1.6, 5.2.1, 5.2.3
Author: mayadm
Date: 11/7/02
|
Methods
|
|
|
|
|
|
__init__
|
__init__ ( self, widget )
Purpose: Creates a new instance of the class Selector, given
the container (widget), raising a CustomError if
the container is not a GtkList. Used by: MainWindow
Uses: gtk, CustomError
Input: widget : GladeXML
Output: New instance of the class Selector
Preconditions: None
Postconditions: None
SRS Refs: 5.2.1
Author: mayadm
Date: 11/7/02
|
Exceptions
|
|
CustomError, "Widget " + str( widget ) + " does not exist or is not a GtkList"
|
|
|
|
changeSelected
|
changeSelected ( self, obj )
Purpose: Changes the currently selected items of Selector,
given an object (GtkContainer).
If the object is not a
GtkContainer, a CustomError is raised. Used by: MainWindow
Uses: gtk, CustomError
Input: obj : GtkList
Output: None
Preconditions: None
Postconditions: None
SRS Refs: 3.2.1.2, 3.2.1.3, 3.2.1.5, 3.2.1.6
Author: mayadm
Date: 11/7/02
|
Exceptions
|
|
CustomError, "Selector: changeSelected(): object is not a" " GtkList"
|
|
|
|
clearSelected
|
clearSelected ( self )
Purpose: Clears the container so that the displayed items
on screen are all unselected. Used by: MainWindow
Uses: None
Input: None
Output: None
Preconditions: None
Postconditions: None
SRS Refs: 3.2.1.2, 3.2.1.3, 3.2.1.5, 3.2.1.6
Author: mayadm
Date: 11/7/02
|
|
|
disable
|
disable ( self )
Purpose: Disables the list of Selector (greys it out) so it
cannot be selected by the user. Used by: MainWindow
Uses: None
Input: None
Output: None
Preconditions: None
Postconditions: None
SRS Refs: 3.2.1.2, 3.2.1.3, 3.2.1.5, 3.2.1.6
Author: mayadm
Date: 11/7/02
|
|
|
disableItem
|
disableItem ( self, item_id )
Purpose: Disables a single list item, given the id of the
item, so it cannot be selected by the user. If
None is given as an argument, the function does
nothing. If the item_id is not found, a CustomError
is raised. Used by: MainWindow
Uses: None
Input: item_id : Integer or None
Output: None
Preconditions: None
Postconditions: None
SRS Refs: 3.2.1.2, 3.2.1.5
Author: mayadm
Date: 23/7/02
|
Exceptions
|
|
CustomError, "List item with id " + str( item_id ) + " not found to grey out"
|
|
|
|
enable
|
enable ( self )
Purpose: Enables the list of Selector so it can be selected
by the user (ungreys it out). Used by: MainWindow
Uses: None
Input: None
Output: None
Preconditions: None
Postconditions: None
SRS Refs: 3.2.1.2, 3.2.1.3, 3.2.1.5, 3.2.1.6
Author: mayadm
Date: 11/7/02
|
|
|
enableItem
|
enableItem ( self, item_id )
Purpose: Enables a single list item, given the id of the
item, so it can be selected by the user. If None is
given as an argument, the function does nothing. If
the item_id is not found, a CustomError is raised. Used by: MainWindow
Uses: None
Input: item_id : Integer or None
Output: None
Preconditions: None
Postconditions: None
SRS Refs: 3.2.1.2, 3.2.1.5
Author: mayadm
Date: 23/7/02
|
Exceptions
|
|
CustomError, "Selector: enableItem(): List item with id " + str( item_id ) + " not found to ungrey"
|
|
|
|
getDisableItemId
|
getDisableItemId ( self )
Purpose: Returns the id of the item (if any) that causes
other items
to be disabled. Returns an integer or None. Used by: MainWindow
Uses: None
Input: None
Output: integer or None
Preconditions: None
Postconditions: None
SRS Refs: 3.2.1.2, 3.2.1.5
Author: mayadm
Date: 23/7/02
|
|
|
getItems
|
getItems ( self )
Purpose: Gets all items contained in this selector.
Used by: MainWindow
Uses: None
Input: None
Output: getItems : list of items in this selector
Preconditions: None
Postconditions: None
SRS Refs: 5.2.3
Author: lljy
Date: 28/10/02
|
|
|
getSelected
|
getSelected ( self )
Purpose: Gets the selected items of Selector.
Used by: MainWindow
Uses: None
Input: None
Output: getSelected : list of selected items
Preconditions: None
Postconditions: None
SRS Refs: 3.2.1.2, 3.2.1.3, 3.2.1.5, 3.2.1.6
Author: mayadm
Date: 11/7/02
|
|
|
refreshItems
|
refreshItems ( self )
Purpose: Refreshes the list of items on screen, given that
the actual real items have not changed, they just
need repainting on screen. First remembers
which items were selected previously, then updates
the list on screen (with possibly new names), then
goes through and selects the items that were
previously selected. In
this class, an item refers to any class that
implements the interface as described in the
Input to updateItems() above. Used by: MainWindow
Uses: gtk
Input: None
Output: None
Preconditions: The number or order of the data (items) has not
changed.
Postconditions: None
SRS Refs: 5.2.3
Author: mayadm
Date: 28/10/02
|
|
|
selectAll
|
selectAll ( self )
Purpose: Selects all the items in the container, so that
the displayed items
on screen are all selected. Used by: MainWindow
Uses: None
Input: None
Output: None
Preconditions: None
Postconditions: None
SRS Refs: 3.2.1.2, 3.2.1.3, 3.2.1.5, 3.2.1.6
Author: mayadm
Date: 11/7/02
|
|
|
updateItems
|
updateItems ( self, list_of_items )
Purpose: Clears the container of any items already there,
then adds in the new list of items and displays
the name associated with the item on screen. In
this class, an item refers to any class that
implements the interface as described in
Input below. Used by: MainWindow
Uses: gtk
Input: list_of_items : list of any type of Item that has
a getName method (returns a string to be displayed
on screen), a getId method (returns an integer, the
id of the item), a canDisableItems method,
(returns 1 if
the item can cause other items to be disabled),
an isSelected (returns 1 if the item is selected
on screen, 0 otherwise) and setSelected (pass it
a 1 if the item is selected, 0 otherwise) methods.
Output: None
Preconditions: None
Postconditions: None
SRS Refs: 3.2.1.2, 3.2.1.3, 3.2.1.5, 3.2.1.6
Author: mayadm
Date: 11/7/02
|
|