Statistics
| Revision:

gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / cssutils / stylesheets / stylesheet.py @ 475

History | View | Annotate | Download (5.35 KB)

1
"""StyleSheet implements DOM Level 2 Style Sheets StyleSheet."""
2
__all__ = ['StyleSheet']
3
__docformat__ = 'restructuredtext'
4
__version__ = '$Id$'
5

    
6
import cssutils
7
import urlparse
8

    
9
class StyleSheet(cssutils.util.Base2):
10
    """
11
    The StyleSheet interface is the abstract base interface
12
    for any type of style sheet. It represents a single style
13
    sheet associated with a structured document.
14

15
    In HTML, the StyleSheet interface represents either an
16
    external style sheet, included via the HTML LINK element,
17
    or an inline STYLE element (also an @import stylesheet?).
18

19
    In XML, this interface represents
20
    an external style sheet, included via a style sheet
21
    processing instruction.
22
    """
23
    def __init__(self, type='text/css',
24
                 href=None,
25
                 media=None,
26
                 title=u'',
27
                 ownerNode=None,
28
                 parentStyleSheet=None,
29
                 alternate=False,
30
                 disabled=None,
31
                 validating=True):
32
        """
33
        type
34
            readonly
35
        href: readonly
36
            If the style sheet is a linked style sheet, the value
37
            of this attribute is its location. For inline style
38
            sheets, the value of this attribute is None. See the
39
            href attribute definition for the LINK element in HTML
40
            4.0, and the href pseudo-attribute for the XML style
41
            sheet processing instruction.
42
        media: of type MediaList, readonly
43
            The intended destination media for style information.
44
            The media is often specified in the ownerNode. If no
45
            media has been specified, the MediaList will be empty.
46
            See the media attribute definition for the LINK element
47
            in HTML 4.0, and the media pseudo-attribute for the XML
48
            style sheet processing instruction. Modifying the media
49
            list may cause a change to the attribute disabled.
50
        title: readonly
51
            The advisory title. The title is often specified in
52
            the ownerNode. See the title attribute definition for
53
            the LINK element in HTML 4.0, and the title
54
            pseudo-attribute for the XML style sheet processing
55
            instruction.
56
        disabled: False if the style sheet is applied to the
57
            document. True if it is not. Modifying this attribute
58
            may cause a new resolution of style for the document.
59
            A stylesheet only applies if both an appropriate medium
60
            definition is present and the disabled attribute is False.
61
            So, if the media doesn't apply to the current user agent,
62
            the disabled attribute is ignored.
63
        ownerNode: of type Node, readonly
64
            The node that associates this style sheet with the
65
            document. For HTML, this may be the corresponding LINK
66
            or STYLE element. For XML, it may be the linking
67
            processing instruction. For style sheets that are
68
            included by other style sheets, the value of this
69
            attribute is None.
70
        parentStyleSheet: of type StyleSheet, readonly
71
            a StyleSheet or None
72
        alternate = False
73
            a flag stating if a style sheet is an alternate one or not.
74
            Currently not used in cssutils
75
        validating = True
76
            a flag defining if this sheet should be validate on change. 
77
        
78
        """
79
        super(StyleSheet, self).__init__()
80
        
81
        self.validating = validating
82
        
83
        self._alternate = alternate
84
        self._href = href
85
        self._ownerNode = ownerNode
86
        self._parentStyleSheet = parentStyleSheet 
87
        self._type = type
88

    
89
        self.disabled = bool(disabled)
90
        self.media = media
91
        self.title = title
92
    
93
    alternate = property(lambda self: self._alternate, 
94
                         doc="Not used in cssutils yet.")
95

    
96
    href = property(lambda self: self._href,
97
        doc="If the style sheet is a linked style sheet, the value "
98
            "of this attribute is its location. For inline style "
99
            "sheets, the value of this attribute is None. See the "
100
            "href attribute definition for the LINK element in HTML "
101
            "4.0, and the href pseudo-attribute for the XML style "
102
            "sheet processing instruction.")
103

    
104
    ownerNode = property(lambda self: self._ownerNode, 
105
                         doc="Not used in cssutils yet.")
106
    
107
    parentStyleSheet = property(lambda self: self._parentStyleSheet,
108
        doc="For style sheet languages that support the concept "
109
            "of style sheet inclusion, this attribute represents "
110
            "the including style sheet, if one exists. If the style "
111
            "sheet is a top-level style sheet, or the style sheet "
112
            "language does not support inclusion, the value of this "
113
            "attribute is None.")
114

    
115
    type = property(lambda self: self._type, 
116
        doc="This specifies the style sheet language for this "
117
            "style sheet. The style sheet language is specified "
118
            "as a content type (e.g. ``text/css``). The content "
119
            "type is often specified in the ownerNode. Also see "
120
            "the type attribute definition for the LINK element "
121
            "in HTML 4.0, and the type pseudo-attribute for the "
122
            "XML style sheet processing instruction. "
123
            "For CSS this is always ``text/css``.")