File: core.i

package info (click to toggle)
wxpython3.0 3.0.1.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 481,208 kB
  • ctags: 520,541
  • sloc: cpp: 2,126,470; python: 293,214; makefile: 51,927; ansic: 19,032; sh: 3,011; xml: 1,629; perl: 17
file content (187 lines) | stat: -rw-r--r-- 5,848 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/////////////////////////////////////////////////////////////////////////////
// Name:        core.i
// Purpose:     SWIG interface file for the CORE wxPython classes and stuff.
//
// Author:      Robin Dunn
//
// Created:     22-May-1998
// RCS-ID:      $Id$
// Copyright:   (c) 1998 by Total Control Software
// Licence:     wxWindows license
/////////////////////////////////////////////////////////////////////////////

%module(package="wx") _core

%{
#include "wx/wxPython/wxPython_int.h"
#include "wx/wxPython/pyclasses.h"
#include "wx/wxPython/twoitem.h"
%}


//---------------------------------------------------------------------------

#ifndef SWIGXML
%include typemaps.i
%include my_typemaps.i

%include _core_api.i

%native(_wxPySetDictionary)   __wxPySetDictionary;


%pythoncode {
%#//----------------------------------------------------------------------------
%#// These will be reset when the _wxPySetDictionary is called.  Dummy
%#// values are set here for tools that do static source analysis.
Platform = ""
PlatformInfo = ()

%#// Give a reference to the dictionary of this module to the C++ extension
%#// code.
_core_._wxPySetDictionary(vars())

%#// A little trick to make 'wx' be a reference to this module so wx.Names can
%#// be used here.
import sys as _sys
wx = _sys.modules[__name__]

}
#endif


%pythoncode {
%#----------------------------------------------------------------------------
            
import warnings
class wxPyDeprecationWarning(DeprecationWarning):
    pass
warnings.simplefilter('default', wxPyDeprecationWarning)
del warnings

def deprecated(item, msg=''):
    """
    Create a delegating wrapper that raises a deprecation warning.  Can be
    used with callable objects (functions, methods, classes) or with
    properties.
    """
    import warnings
    if isinstance(item, type):
        %# It is a class.  Make a subclass that raises a warning.
        class DeprecatedClassProxy(item):
            def __init__(*args, **kw):
                warnings.warn("Using deprecated class %s. %s" % (item.__name__, msg),
                          wxPyDeprecationWarning, stacklevel=2)
                item.__init__(*args, **kw)
        DeprecatedClassProxy.__name__ = item.__name__
        return DeprecatedClassProxy
    
    elif callable(item):
        %# wrap a new function around the callable
        def deprecated_func(*args, **kw):
            warnings.warn("Call to deprecated item. %s" %  msg,
                          wxPyDeprecationWarning, stacklevel=2)
            return item(*args, **kw)
        deprecated_func.__name__ = item.__name__
        deprecated_func.__doc__ = item.__doc__
        if hasattr(item, '__dict__'):
            deprecated_func.__dict__.update(item.__dict__)
        return deprecated_func
        
    elif hasattr(item, '__get__'):
        %# it should be a property if there is a getter
        class DepGetProp(object):
            def __init__(self,item, msg):
                self.item = item
                self.msg = msg
            def __get__(self, inst, klass):
                warnings.warn("Accessing deprecated property. %s" % msg,
                              wxPyDeprecationWarning, stacklevel=2)
                return self.item.__get__(inst, klass)
        class DepGetSetProp(DepGetProp):
            def __set__(self, inst, val):
                warnings.warn("Accessing deprecated property. %s" % msg,
                              wxPyDeprecationWarning, stacklevel=2)
                return self.item.__set__(inst, val)
        class DepGetSetDelProp(DepGetSetProp):
            def __delete__(self, inst):
                warnings.warn("Accessing deprecated property. %s" % msg,
                              wxPyDeprecationWarning, stacklevel=2)
                return self.item.__delete__(inst)
        
        if hasattr(item, '__set__') and hasattr(item, '__delete__'):
            return DepGetSetDelProp(item, msg)
        elif hasattr(item, '__set__'):
            return DepGetSetProp(item, msg)
        else:
            return DepGetProp(item, msg)
    else:
        raise TypeError, "unsupported type %s" % type(item)
                   
         
                   
%#----------------------------------------------------------------------------
}


//---------------------------------------------------------------------------
// Include all the files that make up the core module

// wxObject, functions and other base stuff
%include _defs.i

MAKE_CONST_WXSTRING(EmptyString);

%include _swigtype.i

%include _obj.i
%include _gdicmn.i
%include _streams.i
%include _filesys.i
%include _image.i


// Events, event handlers, base Windows and such
%include _evthandler.i
%include _keyboardstate.i
%include _mousestate.i
%include _event.i
%include _app.i
%include _evtloop.i
%include _accel.i
%include _window.i
%include _validator.i
%include _menu.i
%include _control.i
%include _withimages.i
%include _bookctrl.i

// Layout
%include _sizers.i
%include _gbsizer.i
%include _constraints.i

// other
%include _headercol.i
%include _versioninfo.i


%pythoncode "_core_ex.py"

//---------------------------------------------------------------------------
// This code gets added to the module initialization function

%init %{
    // Initialize threading, some globals and such
    __wxPyPreStart(d);
    

    // Although these are defined in __version__ they need to be here too so
    // that an assert can be done to ensure that the wxPython and the wxWindows
    // versions match.
    PyDict_SetItemString(d,"MAJOR_VERSION", PyInt_FromLong((long)wxMAJOR_VERSION ));
    PyDict_SetItemString(d,"MINOR_VERSION", PyInt_FromLong((long)wxMINOR_VERSION ));
    PyDict_SetItemString(d,"RELEASE_VERSION", PyInt_FromLong((long)wxRELEASE_NUMBER ));
%}
 
//---------------------------------------------------------------------------