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

« back to all changes in this revision

Viewing changes to wxPython/wx/tools/Editra/src/eclib/elistmix.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:
16
16
"""
17
17
 
18
18
__author__ = "Cody Precord <cprecord@editra.org>"
19
 
__svnid__ = "$Id: elistmix.py 63496 2010-02-16 06:47:55Z RD $"
20
 
__revision__ = "$Revision: 63496 $"
 
19
__svnid__ = "$Id: elistmix.py 66204 2010-11-18 14:00:28Z CJP $"
 
20
__revision__ = "$Revision: 66204 $"
21
21
 
22
22
__all__ = ["ListRowHighlighter", "HIGHLIGHT_EVEN", "HIGHLIGHT_ODD"]
23
23
 
24
24
#--------------------------------------------------------------------------#
25
 
# Dependancies
 
25
# Dependencies
26
26
import wx
27
27
 
28
28
#--------------------------------------------------------------------------#
47
47
        self._color = color
48
48
        self._defaultb = wx.SystemSettings.GetColour(wx.SYS_COLOUR_LISTBOX)
49
49
        self._mode = mode
 
50
        self._refresh_timer = wx.Timer(self)
50
51
 
51
52
        # Event Handlers
52
 
        self.Bind(wx.EVT_LIST_INSERT_ITEM, lambda evt: self.RefreshRows())
53
 
        self.Bind(wx.EVT_LIST_DELETE_ITEM, lambda evt: self.RefreshRows())
 
53
        self.Bind(wx.EVT_LIST_INSERT_ITEM, lambda evt: self._RestartTimer())
 
54
        self.Bind(wx.EVT_LIST_DELETE_ITEM, lambda evt: self._RestartTimer())
 
55
        self.Bind(wx.EVT_TIMER,
 
56
                  lambda evt: self.RefreshRows(),
 
57
                  self._refresh_timer)
54
58
 
 
59
    def _RestartTimer(self):
 
60
        if self._refresh_timer.IsRunning():
 
61
            self._refresh_timer.Stop()
 
62
        self._refresh_timer.Start(100, oneShot=True)
 
63
            
55
64
    def RefreshRows(self):
56
65
        """Re-color all the rows"""
57
 
        for row in xrange(self.GetItemCount()):
 
66
        for row in range(self.GetItemCount()):
58
67
            if self._defaultb is None:
59
68
                self._defaultb = self.GetItemBackgroundColour(row)
60
69