Package cssutils :: Package stylesheets :: Module medialist :: Class MediaList |
[hide private]
[frames] | no frames]

# Class MediaList

source code

    object --+
             |
     util.Base --+
                 |
    object --+   |
             |   |
          list --+
                 |
                MediaList

Provides the abstraction of an ordered collection of media, without defining or constraining how this collection is implemented. An empty list is the same as a list that contains the medium "all".

# Properties

length:
  The number of media in the list.
mediaText: of type DOMString
  The parsable textual representation of this medialist
seq: a list (cssutils)
  All parts of this MediaList including CSSComments
valid:
  if this list is valid

# Format

medium [ COMMA S* medium ]*

Nested Classes | [hide private]
Inherited from `util.Base` (private): `_ttypes`

Instance Methods | [hide private]
__init__(self, mediaText=None, readonly=False) unicodestring of parsable comma separared media | source code
_getLength(self) returns count of media in this list which is not the same as len(MediaListInstance) which also contains CSSComments | source code
_getSeq(self) | source code
_setSeq(self, seq) | source code
_getMediaText(self) returns serialized property mediaText | source code
_setMediaText(self, mediaText) simple value or comma-separated list of media | source code
appendMedium(self, newMedium) (DOM) Adds the medium newMedium to the end of the list. | source code
deleteMedium(self, oldMedium) (DOM) Deletes the medium indicated by oldMedium from the list. | source code
item(self, index) (DOM) Returns the index'th element in the list. | source code
__repr__(self) repr(x) | source code
__str__(self) str(x) | source code
Inherited from `util.Base` (private): `_checkReadonly`, `_tokenize`, `_tokensupto`, `_valuestr` Inherited from `list`: `__add__`, `__contains__`, `__delitem__`, `__delslice__`, `__eq__`, `__ge__`, `__getattribute__`, `__getitem__`, `__getslice__`, `__gt__`, `__hash__`, `__iadd__`, `__imul__`, `__iter__`, `__le__`, `__len__`, `__lt__`, `__mul__`, `__ne__`, `__new__`, `__reversed__`, `__rmul__`, `__setitem__`, `__setslice__`, `append`, `count`, `extend`, `index`, `insert`, `pop`, `remove`, `reverse`, `sort` Inherited from `object`: `__delattr__`, `__reduce__`, `__reduce_ex__`, `__setattr__`

Static Methods | [hide private]
Inherited from `util.Base` (private): `_normalize`

Class Variables | [hide private]
| _MEDIA = ``[``u'``all``'``,` `u'``aural``'``,` `u'``braille``'``,` `u'``embossed``'``,` `u'``handhel``...`` available media types
Inherited from `util.Base` (private): `_log`

Properties | [hide private]
| length (DOM readonly) The number of media in the list.
| seq All parts of this MediaList including CSSComments
| mediaText (DOM) The parsable textual representation of the media list.
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, mediaText=None, readonly=False) (Constructor) | source code
  mediaText unicodestring of parsable comma separared media Returns:
      new list
Overrides: list.__init__

### _setMediaText(self, mediaText) | source code
mediaText simple value or comma-separated list of media DOMException SYNTAX_ERR: (self) Raised if the specified string value has a syntax error and is unparsable. NO_MODIFICATION_ALLOWED_ERR: (self) Raised if this media list is readonly.

### appendMedium(self, newMedium) | source code
(DOM) Adds the medium newMedium to the end of the list. If the newMedium is already used, it is first removed. returns if newMedium is valid DOMException INVALID_CHARACTER_ERR: (self) If the medium contains characters that are invalid in the underlying style language. NO_MODIFICATION_ALLOWED_ERR: (self) Raised if this list is readonly.

### deleteMedium(self, oldMedium) | source code
(DOM) Deletes the medium indicated by oldMedium from the list. DOMException NO_MODIFICATION_ALLOWED_ERR: (self) Raised if this list is readonly. NOT_FOUND_ERR: (self) Raised if oldMedium is not in the list.

### item(self, index) | source code
(DOM) Returns the index'th element in the list. If index is greater than or equal to the number of media in the list, this returns None.

### __repr__(self) (Representation operator) | source code
repr(x) Overrides: list.__repr__ (inherited documentation)

### __str__(self) (Informal representation operator) | source code
str(x) Overrides: object.__str__ (inherited documentation)

Class Variable Details | [hide private]

  ### _MEDIA available media types Value:
      [u'all',
       u'aural',
       u'braille',
       u'embossed',
       u'handheld',
       u'print',
       u'projection',
       u'screen',
      ...

Property Details | [hide private]

  ### length (DOM readonly) The number of media in the list. Get Method: cssutils.stylesheets.medialist.MediaList._getLength(self) - returns count of media in this list which is not the same as len(MediaListInstance) which also contains CSSComments Set Method:
      None
  Delete Method:
      None

  ### seq All parts of this MediaList including CSSComments Get Method: cssutils.stylesheets.medialist.MediaList._getSeq(self) Set Method: cssutils.stylesheets.medialist.MediaList._setSeq(self, seq) Delete Method:
      None

  ### mediaText (DOM) The parsable textual representation of the media list. This is a comma-separated list of media. Get Method: cssutils.stylesheets.medialist.MediaList._getMediaText(self) - returns serialized property mediaText Set Method: cssutils.stylesheets.medialist.MediaList._setMediaText(self, mediaText) - simple value or comma-separated list of media Delete Method:
      None