Skip to content

Commit eea32ad

Browse files
committed
Various fixes to let wxpython-cffi run with wxpython-3.0.2 on gtk2.
1 parent a76a7fd commit eea32ad

File tree

7 files changed

+33
-26
lines changed

7 files changed

+33
-26
lines changed

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To get started:
1515
wxPython mailing lists if this does not work for you.
1616

1717
3. Make sure you have the wxWidgets code built in build/wxbld by running
18-
``./builld.py build_wx``.
18+
``./build.py build_wx``.
1919

2020
4. Run the etg scripts: ``./build.py etg --generator=cffi --nodoc``
2121
(``--nodoc`` may not be necessary for you, but I never got the sphinx

etg/cffi/dataobj.py

-15
Original file line numberDiff line numberDiff line change
@@ -430,19 +430,4 @@ def run(module):
430430

431431
#------------------------------------------------------------
432432
c = module.find('wxURLDataObject')
433-
434-
# We need to let the generator know that the pure virtuals in the base
435-
# class have impelmentations here even though they will not be used much
436-
# (if at # all.) Those that are overridden in this class with different
437-
# signatures we'll just mark as private to help avoid confusion.
438-
c.addMethod('size_t', 'GetDataSize', '(const wxDataFormat& format)',
439-
isVirtual=True, isConst=True, protection='private')
440-
c.addMethod('bool', 'GetDataHere', '(const wxDataFormat& format, void* buf)',
441-
isVirtual=True, isConst=True, protection='private')
442-
c.addMethod('bool', 'SetData',
443-
'(const wxDataFormat& format, size_t len, const void* buf)',
444-
isVirtual=True, protection='private')
445-
446433
addGetAllFormats(c)
447-
add_GetDataHere_without_format(c)
448-
add_SetData_without_format(c)

etg/dataobj.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
]
3131

3232

33+
OTHERDEPS = [ 'etg/sip/dataobj.py',
34+
'etg/cffi/dataobj.py',
35+
]
36+
3337
#---------------------------------------------------------------------------
3438

3539
def run():
@@ -128,14 +132,6 @@ def run():
128132
# denominator approach here to be able to work on all platforms.
129133
c.bases = ['wxDataObject']
130134

131-
#c.addItem(etgtools.WigCode(code="""\
132-
# virtual size_t GetFormatCount(Direction dir = Get) const;
133-
# virtual wxDataFormat GetPreferredFormat(Direction dir = Get) const;
134-
# private:
135-
# virtual size_t GetDataSize(const wxDataFormat& format) const;
136-
# virtual bool GetDataHere(const wxDataFormat& format, void* buf) const;
137-
# virtual bool SetData(const wxDataFormat& format, size_t len, const void* buf);
138-
# """))
139135
c.addMethod('size_t', 'GetFormatCount', '(Direction dir = Get)',
140136
isConst=True, isVirtual=True)
141137
c.addMethod('wxDataFormat', 'GetPreferredFormat', '(Direction dir = Get)',

etg/menuitem.py

+25
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ def run():
9999
""")
100100

101101

102+
c.find('GetBitmap').type = 'const wxBitmap*'
103+
c.find('GetBitmap').setCppCode("""\
104+
#ifdef __WXMSW__
105+
return &self->GetBitmap(checked);
106+
#else
107+
return &self->GetBitmap();
108+
#endif
109+
""")
110+
102111
c.find('SetBitmap').setCppCode("""\
103112
#ifdef __WXMSW__
104113
self->SetBitmap(*bmp, checked);
@@ -116,6 +125,22 @@ def run():
116125
""")
117126

118127

128+
c.find('GetDisabledBitmap').type = 'const wxBitmap*'
129+
c.find('GetDisabledBitmap').setCppCode("""\
130+
#ifdef __WXMSW__
131+
return &self->GetDisabledBitmap();
132+
#else
133+
return &wxNullBitmap;
134+
#endif
135+
""")
136+
137+
c.find('SetDisabledBitmap').setCppCode("""\
138+
#ifdef __WXMSW__
139+
self->SetDisabledBitmap(*disabled);
140+
#endif
141+
""")
142+
143+
119144
c.find('GetAccel').factory = True
120145
c.find('GetAccelFromString').ignore() # Not implemented anywere?
121146

etg/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
'wxVersionInfo',
2424
]
2525

26-
OTHERDEPS = [ 'etg/sip/utils.py',
26+
OTHERDEPS = [ # 'etg/sip/utils.py',
2727
'etg/cffi/utils.py',
2828
]
2929
#---------------------------------------------------------------------------

etgtools/cffi/module.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def write_files(self, pyfile, userpyfile, cppfile, hfile, verify_args):
157157
pyfile.write(nci("""\
158158
''')
159159
ffi.cdef(cdefs)
160-
clib = ffi.verify(cdefs, %s)
160+
clib = ffi.verify('#include <stdlib.h>\\n' + cdefs, %s)
161161
del cdefs
162162
163163
wrapper_lib.populate_clib_ptrs(clib)

src/cffi/app_ex.h

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class wxPyApp : public wxApp
2323
virtual void MacOpenURL(const wxString &) {}
2424
virtual void MacPrintFile(const wxString &) {}
2525
virtual void MacReopenApp() {}
26+
virtual bool OSXIsGUIApplication() { return true; }
2627
#endif
2728

2829
#ifdef __WXMAC__

0 commit comments

Comments
 (0)