~ubuntu-branches/debian/sid/awn-extras-applets/sid

« back to all changes in this revision

Viewing changes to src/calendar/icalendar/interfaces.py

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2010-06-16 21:39:36 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20100616213936-wia5mqfah6zameyo
Tags: 0.4.0-1
* New upstream release.
 - Catch error in weather applet (LP: #359668)
 - Stack applet close on click (LP: #261520)
 - Close cairo-menu after a click (LP: #511256)
 - Fix crash of awn-system-monitor (LP: #545164)
 - Fix crash when removing a volume >1 or adding volume >1 or using prefs
   while > 1 volumes is present (LP: #556175)
 - Fix crash of media-control when Rhythmbox quit (LP: #558463)
 - Fix crash of file-browser-launcher when there is no .gtk-bookmarks
   (LP: #551119)
* Update applets location:
 - Plugger, Filebrowser, Trasher, DesktopManager, Lastfm, Meebo, Digg, Pynot,
   RTM applets removed.
 - Sysmon, Bandwidth-monitor, Dialect, Hardware sensors, YAMA, Slickswitcher
   applets added
 - Separator applet move to Awn package.
 - Trash applet replaced by Garbage applet.
 - Arss applet replaced by Feeds applet.
 - Showdesktop applet move from python-core to c-core.
 - Digital Clock applet move from python-extras to c-extras.
 - Mimenu applet desactived.
* debian/series: disable 01-ftbfs-python-2.6.patch.
* debian/patches/02-shinyswitcher-default-layout.patch refreshed. 
* debian/watch: Update to the new package naming.
* debian/control:
 - Description updated with new applets.
 - Update Depends, Recommends and Suggests for all applets and add comments.
 - Add recommends on python-rsvg and python-wnck on python-core rather
   than python-extras applets. Thanks Mark Lee for the patch (LP: #423598).
 - Bump debhelper build-depends to (>= 7.0.50~) for overrides.
 - Bump build-depends libawn-dev (>= 0.4.0) and valac (>= 0.7.7).
 - Remove libawn-extras and python-awnlib, all merged in python-awn-extras.
 - Replace awn-manager by awn-settings.
 - Drop build-depends on libgnome-desktop-dev, python*-dev, awn-manager,
   libglade2-dev and libgnomeui-dev.
 - Add build-depends on libdesktop-agnostic-bin and vala-awn.
 - Demote gconf-editor to Suggests, it's only needed for very advanced
   settings.
 - Add a debug package for C applets.
 - Add a common package for translations, and make it depends on all applets
   packages.
 - Add proper Conflicts/Replaces for updates of applets location
   (LP: #524559).
* debian/rules
 - Rewrite to use overrides and dh_install --fail-missing.
 - Disable dropper (not finished), mimenu (unstable) vala-test, python-test,
   wobblyzini (only for development purpose) applets.
 - Remove useless call to dh_makeshlibs.
 - Add dh_strip call for awn-applets-c-dbg binary.
 - Make scripts executable.
* debian/awn-applets-c-core.links: dropped, not needed.
* debian/libawn-extras*: Removed, libawn-extras was removed upstream.
* debian/python-awnlib*: Merged with python-awn-extras.
* debian/python-awn-extras.install: Install only py files.
* debian/copyright:
 - Update copyright and licenses.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
try:
2
 
    from zope.interface import Interface, Attribute
3
 
except ImportError:
4
 
    class Interface:
5
 
        """A dummy interface base class"""
6
 
 
7
 
    class Attribute:
8
 
        """A dummy attribute implementation"""
9
 
        def __init__(self, doc):
10
 
            self.doc = doc
11
 
 
12
 
_marker = object()
13
 
 
14
 
class IComponent(Interface):
15
 
    """
16
 
    Component is the base object for calendar, Event and the other
17
 
    components defined in RFC 2445.
18
 
 
19
 
    A component is like a dictionary with extra methods and attributes.
20
 
    """
21
 
 
22
 
    # MANIPULATORS
23
 
 
24
 
    def __setitem__(name, value):
25
 
        """Set a property.
26
 
 
27
 
        name - case insensitive name
28
 
        value - value of the property to set. This can be either a single
29
 
        item or a list.
30
 
 
31
 
        Some iCalendar properties are set INLINE; these properties
32
 
        have multiple values on one property line in the iCalendar
33
 
        representation.  The list can be supplied as a comma separated
34
 
        string to __setitem__. If special iCalendar characters exist in
35
 
        an entry, such as the colon (:) and (,), that comma-separated
36
 
        entry needs to be quoted with double quotes. For example:
37
 
 
38
 
        'foo, bar, "baz:hoi"'
39
 
 
40
 
        See also set_inline() for an easier way to deal with this case.
41
 
        """
42
 
 
43
 
    def set_inline(name, values, encode=1):
44
 
        """Set list of INLINE values for property.
45
 
 
46
 
        Converts a list of values into valid iCalendar comma seperated
47
 
        string and sets value to that.
48
 
 
49
 
        name - case insensitive name of property
50
 
        values - list of values to set
51
 
        encode - if True, encode Python values as iCalendar types first.
52
 
        """
53
 
 
54
 
    def add(name, value):
55
 
        """Add a property. Can be called multiple times to set a list.
56
 
 
57
 
        name - case insensitive name
58
 
        value - value of property to set or add to list for this property.
59
 
        """
60
 
 
61
 
    def add_component(component):
62
 
        """Add a nested subcomponent to this component.
63
 
        """
64
 
 
65
 
    # static method, can be called on class directly
66
 
    def from_string(st, multiple=False):
67
 
        """Populates the component recursively from a iCalendar string.
68
 
 
69
 
        Reads the iCalendar string and constructs components and
70
 
        subcomponents out of it.
71
 
        """
72
 
 
73
 
    # ACCESSORS
74
 
    def __getitem__(name):
75
 
        """Get a property
76
 
 
77
 
        name - case insensitive name
78
 
 
79
 
        Returns an iCalendar property object such as vText.
80
 
        """
81
 
 
82
 
    def decoded(name, default=_marker):
83
 
        """Get a property as a python object.
84
 
 
85
 
        name - case insensitive name
86
 
        default - optional argument. If supplied, will use this if
87
 
        name cannot be found. If not supplied, decoded will raise a
88
 
        KeyError if name cannot be found.
89
 
 
90
 
        Returns python object (such as unicode string, datetime, etc).
91
 
        """
92
 
 
93
 
    def get_inline(name, decode=1):
94
 
        """Get list of INLINE values from property.
95
 
 
96
 
        name - case insensitive name
97
 
        decode - decode to Python objects.
98
 
 
99
 
        Returns list of python objects.
100
 
        """
101
 
 
102
 
    def as_string():
103
 
        """Render the component in the RFC 2445 (iCalendar) format.
104
 
 
105
 
        Returns a string in RFC 2445 format.
106
 
        """
107
 
 
108
 
    subcomponents = Attribute("""
109
 
        A list of all subcomponents of this component,
110
 
        added using add_component()""")
111
 
 
112
 
    name = Attribute("""
113
 
        Name of this component (VEVENT, etc)
114
 
        """)
115
 
 
116
 
    def walk(name=None):
117
 
        """Recursively traverses component and subcomponents.
118
 
 
119
 
        name - optional, if given, only return components with that name
120
 
 
121
 
        Returns sequence of components.
122
 
        """
123
 
 
124
 
    def property_items():
125
 
        """Return properties as (name, value) tuples.
126
 
 
127
 
        Returns all properties in this comopnent and subcomponents as
128
 
        name, value tuples.
129
 
        """
130
 
 
131
 
class IEvent(IComponent):
132
 
    """A component which conforms to an iCalendar VEVENT.
133
 
    """
134
 
 
135
 
class ITodo(IComponent):
136
 
    """A component which conforms to an iCalendar VTODO.
137
 
    """
138
 
 
139
 
class IJournal(IComponent):
140
 
    """A component which conforms to an iCalendar VJOURNAL.
141
 
    """
142
 
 
143
 
class IFreeBusy(IComponent):
144
 
    """A component which conforms to an iCalendar VFREEBUSY.
145
 
    """
146
 
 
147
 
class ITimezone(IComponent):
148
 
    """A component which conforms to an iCalendar VTIMEZONE.
149
 
    """
150
 
 
151
 
class IAlarm(IComponent):
152
 
    """A component which conforms to an iCalendar VALARM.
153
 
    """
154
 
 
155
 
class ICalendar(IComponent):
156
 
    """A component which conforms to an iCalendar VCALENDAR.
157
 
    """
158
 
 
159
 
class IPropertyValue(Interface):
160
 
    """An iCalendar property value.
161
 
    iCalendar properties have strongly typed values.
162
 
 
163
 
    This invariance should always be true:
164
 
 
165
 
    assert x == vDataType.from_ical(vDataType(x).ical())
166
 
    """
167
 
 
168
 
    def ical():
169
 
        """Render property as string, as defined in iCalendar RFC 2445.
170
 
        """
171
 
 
172
 
    # this is a static method
173
 
    def from_ical(ical):
174
 
        """Parse property from iCalendar RFC 2445 text.
175
 
 
176
 
        Inverse of ical().
177
 
        """
178
 
 
179
 
class IBinary(IPropertyValue):
180
 
    """Binary property values are base 64 encoded
181
 
    """
182
 
 
183
 
class IBoolean(IPropertyValue):
184
 
    """Boolean property.
185
 
 
186
 
    Also behaves like a python int.
187
 
    """
188
 
 
189
 
class ICalAddress(IPropertyValue):
190
 
    """Email address.
191
 
 
192
 
    Also behaves like a python str.
193
 
    """
194
 
 
195
 
class IDateTime(IPropertyValue):
196
 
    """Render and generates iCalendar datetime format.
197
 
 
198
 
    Important: if tzinfo is defined it renders itself as 'date with utc time'
199
 
    Meaning that it has a 'Z' appended, and is in absolute time.
200
 
    """
201
 
 
202
 
class IDate(IPropertyValue):
203
 
    """Render and generates iCalendar date format.
204
 
    """
205
 
 
206
 
class IDuration(IPropertyValue):
207
 
    """Render and generates timedelta in iCalendar DURATION format.
208
 
    """
209
 
 
210
 
class IFloat(IPropertyValue):
211
 
    """Render and generate floats in iCalendar format.
212
 
 
213
 
    Also behaves like a python float.
214
 
    """
215
 
 
216
 
class IInt(IPropertyValue):
217
 
    """Render and generate ints in iCalendar format.
218
 
 
219
 
    Also behaves like a python int.
220
 
    """
221
 
 
222
 
class IPeriod(IPropertyValue):
223
 
    """A precise period of time (datetime, datetime).
224
 
    """
225
 
 
226
 
class IWeekDay(IPropertyValue):
227
 
    """Render and generate weekday abbreviation.
228
 
    """
229
 
 
230
 
class IFrequency(IPropertyValue):
231
 
    """Frequency.
232
 
    """
233
 
 
234
 
class IRecur(IPropertyValue):
235
 
    """Render and generate data based on recurrent event representation.
236
 
 
237
 
    This acts like a caseless dictionary.
238
 
    """
239
 
 
240
 
class IText(IPropertyValue):
241
 
    """Unicode text.
242
 
    """
243
 
 
244
 
class ITime(IPropertyValue):
245
 
    """Time.
246
 
    """
247
 
 
248
 
class IUri(IPropertyValue):
249
 
    """URI
250
 
    """
251
 
 
252
 
class IGeo(IPropertyValue):
253
 
    """Geographical location.
254
 
    """
255
 
 
256
 
class IUTCOffset(IPropertyValue):
257
 
    """Offset from UTC.
258
 
    """
259
 
 
260
 
class IInline(IPropertyValue):
261
 
    """Inline list.
262
 
    """