~ubuntu-branches/ubuntu/quantal/wxwidgets2.8/quantal

« back to all changes in this revision

Viewing changes to wxPython/wx/tools/Editra/src/ebmlib/histcache.py

  • Committer: Package Import Robot
  • Author(s): Stéphane Graber
  • Date: 2012-01-07 13:59:25 UTC
  • mfrom: (1.1.9) (5.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20120107135925-2601miy9ullcon9j
Tags: 2.8.12.1-6ubuntu1
* Resync from Debian, changes that were kept:
  - debian/rules: re-enable mediactrl. This allows libwx_gtk2u_media-2.8 to be
    built, as this is required by some applications (LP: #632984)
  - debian/control: Build-dep on libxt-dev for mediactrl.
  - Patches
    + fix-bashism-in-example
* Add conflict on python-wxgtk2.8 (<< 2.8.12.1-6ubuntu1~) to python-wxversion
  to guarantee upgrade ordering when moving from pycentral to dh_python2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
"""
15
15
 
16
16
__author__ = "Cody Precord <cprecord@editra.org>"
17
 
__cvsid__ = "$Id: histcache.py 62950 2009-12-19 23:56:41Z CJP $"
18
 
__revision__ = "$Revision: 62950 $"
 
17
__cvsid__ = "$Id: histcache.py 67123 2011-03-04 00:02:35Z CJP $"
 
18
__revision__ = "$Revision: 67123 $"
19
19
 
20
20
__all__ = [ 'HistoryCache', 'HIST_CACHE_UNLIMITED',
21
21
            'CycleCache']
30
30
#-----------------------------------------------------------------------------#
31
31
 
32
32
class HistoryCache(object):
 
33
    """Data management cache.
 
34
    Maintains a positional list of objects that remembers the last access 
 
35
    position in the cache.
 
36
 
 
37
    """
33
38
    def __init__(self, max_size=HIST_CACHE_UNLIMITED):
34
 
        object.__init__(self)
 
39
        """@param max_size: size of history cache (int)"""
 
40
        super(HistoryCache, self).__init__()
35
41
 
36
42
        # Attributes
37
43
        self._list = list()
70
76
 
71
77
    def GetNextItem(self):
72
78
        """Get the next item in the history cache, moving the
73
 
        current postion towards the end of the cache.
 
79
        current position towards the end of the cache.
74
80
        @return: object or None if at end of list
75
81
 
76
82
        """
82
88
 
83
89
    def GetPreviousItem(self):
84
90
        """Get the previous item in the history cache, moving the
85
 
        current postion towards the begining of the cache.
 
91
        current position towards the beginning of the cache.
86
92
        @return: object or None if at start of list
87
93
 
88
94
        """
115
121
        return more
116
122
 
117
123
    def PeekNext(self):
118
 
        """Return the next item in the cache without modifing the
 
124
        """Return the next item in the cache without modifying the
119
125
        currently managed position.
120
126
        @return: cache object
121
127
 
126
132
            return None
127
133
 
128
134
    def PeekPrevious(self):
129
 
        """Return the previous item in the cache without modifing the
 
135
        """Return the previous item in the cache without modifying the
130
136
        currently managed position.
131
137
        @return: cache object
132
138
 
161
167
class CycleCache(object):
162
168
    """A simple circular cache. All items are added to the end of the cache
163
169
    regardless of the current reference position. As items are accessed from
164
 
    the cache the cache reference pointer is incremeneted, if it passes the
 
170
    the cache the cache reference pointer is incremented, if it passes the
165
171
    end it will go back to the beginning.
166
172
 
167
173
    """
170
176
        @param size: cache size
171
177
 
172
178
        """
173
 
        object.__init__(self)
 
179
        super(CycleCache, self).__init__()
174
180
 
175
181
        # Attributes
176
182
        self._list = list()