~ubuntu-branches/ubuntu/precise/wxwidgets2.8/precise-proposed

« back to all changes in this revision

Viewing changes to wxPython/wx/tools/Editra/src/ebmlib/miscutil.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:
7
7
###############################################################################
8
8
 
9
9
"""
10
 
Editra Buisness Model Library: MiscUtil
 
10
Editra Business Model Library: MiscUtil
11
11
 
12
12
Various helper functions
13
13
 
14
14
"""
15
15
 
16
16
__author__ = "Cody Precord <cprecord@editra.org>"
17
 
__cvsid__ = "$Id: miscutil.py 63847 2010-04-03 23:16:28Z CJP $"
18
 
__revision__ = "$Revision: 63847 $"
 
17
__cvsid__ = "$Id: miscutil.py 67329 2011-03-28 23:40:48Z CJP $"
 
18
__revision__ = "$Revision: 67329 $"
19
19
 
20
 
__all__ = [ 'MinMax', ]
 
20
__all__ = [ 'MinMax', 'Singleton']
21
21
 
22
22
#-----------------------------------------------------------------------------#
23
23
# Imports
24
24
 
25
25
#-----------------------------------------------------------------------------#
26
26
 
 
27
class Singleton(type):
 
28
    """Singleton metaclass for creating singleton classes
 
29
    @note: class being applied to must have a SetupWindow method
 
30
 
 
31
    """
 
32
    def __init__(cls, name, bases, dict):
 
33
        super(Singleton, cls).__init__(name, bases, dict)
 
34
        cls.instance = None
 
35
 
 
36
    def __call__(cls, *args, **kw):
 
37
        if not cls.instance:
 
38
            # Not created or has been Destroyed
 
39
            obj = super(Singleton, cls).__call__(*args, **kw)
 
40
            cls.instance = obj
 
41
 
 
42
        return cls.instance
 
43
 
 
44
#-----------------------------------------------------------------------------#
 
45
 
27
46
def MinMax(arg1, arg2):
28
47
    """Return an ordered tuple of the minimum and maximum value
29
48
    of the two args.