~ubuntu-branches/ubuntu/maverick/pyclutter/maverick

« back to all changes in this revision

Viewing changes to clutter/__init__.py

  • Committer: Bazaar Package Importer
  • Author(s): Rob Bradford
  • Date: 2008-10-15 15:25:57 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081015152557-qv1xzqtng4iqgwfd
Tags: 0.8.0-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- Mode: Python; py-indent-offset: 4 -*-
2
2
 
 
3
try:
 
4
    import ltihooks
 
5
    ltihooks # pyflakes
 
6
except ImportError:
 
7
    ltihooks = None
 
8
 
3
9
import sys
4
10
 
 
11
# fixes weird linker bugs on nvidia
 
12
try:
 
13
    import dl
 
14
    sys.setdlopenflags(dl.RTLD_LAZY|dl.RTLD_GLOBAL)
 
15
except ImportError:
 
16
    pass
 
17
 
5
18
# For broken embedded programs which forgot to call Sys_SetArgv
6
19
if not hasattr(sys, 'argv'):
7
20
    sys.argv = []
11
24
 
12
25
ver = getattr(_gobject, 'pygobject_version', ())
13
26
if ver < (2, 11, 1):
14
 
    raise ImportError("PyGTK requires PyGObject 2.11.1 or higher, but %s was found" % (ver,))
 
27
    raise ImportError("PyClutter requires PyGObject 2.11.1 or higher, but %s was found" % (ver,))
15
28
 
16
29
if 'clutter._clutter' in sys.modules:
17
30
    _clutter = sys.modules['clutter._clutter']
18
31
else:
19
32
    from clutter import _clutter
20
33
 
 
34
import cogl
 
35
 
 
36
if ltihooks:
 
37
    try:
 
38
        ltihooks.uninstall()
 
39
        del ltihooks
 
40
    except:
 
41
        pass
 
42
 
21
43
# use the pygtk module lazy loading stuff
22
44
from gtk._lazyutils import LazyNamespace, LazyModule
 
45
# and our own for the deprecation warnings
 
46
from clutter.deprecation import _Deprecated, _DeprecatedConstant
 
47
 
 
48
def _init ():
 
49
    import sys
 
50
 
 
51
    try:
 
52
        sys_path = sys.path[:]
 
53
 
 
54
        try:
 
55
            _clutter.init()
 
56
        except RuntimeError, e:
 
57
            import warnings
 
58
            warnings.warn(str(e), _clutter.Warning)
 
59
    finally:
 
60
        if sys.path != sys_path:
 
61
            sys.path[:] = sys_path
23
62
 
24
63
keysyms = LazyModule('keysyms', locals())
25
64
 
26
 
_clutter.init()
27
 
 
28
 
from clutter._clutter import *
 
65
_init()
29
66
 
30
67
__version__ = _clutter.__version__
31
68
MAX_ALPHA = _clutter.MAX_ALPHA
 
69
 
 
70
from clutter._clutter import *
 
71
 
 
72
timeline_new_for_duration = _Deprecated(_clutter, 'Timeline', 'timeline_new_for_duration', 'clutter')
 
73
rectangle_new_with_color =  _Deprecated(_clutter, 'Rectangle', 'rectangle_new_with_color', 'clutter')
 
74
 
 
75
del _Deprecated, _DeprecatedConstant