about wxPython supporting for wxDFB ?

Hi all,

I am very glad to find wxWidgets and wxPython , these are very good
things for GUI development.
Now , we are working in a embeded environment , we don't want to run
X11, because it will waste much precious resources ,and its speed is
very slow.

now , we know , we can alternative choose wxDFB to control graphic
hardware.
but wxDFB will be a c++ library , but our GUI is written by Python.
so I want to use wxPython to be bridge between python and wxDFB.

Now , I have downloaded DirectFB-1.4.2 and wxPython-2.8.10.1 source
code.
I can compile and install DirectFB-1.4.2 successfully .
but when I compiled and install wxPython (with dfb) , I have some
problems.

Through a little modification, I can compile wxPython with dfb
successfully, but when execute "python2.5 setup.py --inplace --
debug" , I have problems.

from your config.py file :

···

====
WXPORT = 'gtk2' # On Linux/Unix there are several ports of
wxWidgets available.
                   # Setting this value lets you select which will be
used for
                   # the wxPython build. Possibilites are 'gtk',
'gtk2' and
                   # 'x11'. Currently only gtk and gtk2 works.

it seems that wxPython has not already supported DFB, only gtk2 and
gtk can work well.

I want to know what is the status of wxPython supporting wxDFB.
Do you have plan to support wxDFB besides gtk2 and gtk ?
On embeded environment , wxDFB is a best choice compared with wxX11
and gtk.

Any feedback will be welcome . thanks in advance .

Bob

it seems that wxPython has not already supported DFB, only gtk2 and
gtk can work well.

Correct.

I want to know what is the status of wxPython supporting wxDFB.
Do you have plan to support wxDFB besides gtk2 and gtk ?

I don't have any need for it myself, and so therefore no plans to implement it. I will however accept patches that implement whatever is needed for it.

Besides changes in setup.py you'll probably also have to make modifications to the *.i files to exclude things that are not implemented in wxDFB, or conditionalize it for things that are have a different API or whatever. That means that you'll also need to run a patched version of SWIG to generate the wxDFB version of the wrapper source files.

···

On 11/3/09 12:55 AM, Bob wrote:

--
Robin Dunn
Software Craftsman

I don't have any need for it myself, and so therefore no plans to
implement it. I will however accept patches that implement whatever is
needed for it.

Besides changes in setup.py you'll probably also have to make
modifications to the *.i files to exclude things that are not
implemented in wxDFB, or conditionalize it for things that are have a
different API or whatever. That means that you'll also need to run a
patched version of SWIG to generate the wxDFB version of the wrapper
source files.

thanks very much for your precious applying.
I tried another day to try to fix this problem, I have has a little
progress. but wxPython still has problems when compiling.

These are my little progress. Maybe it will be helpful for others.

Now , my version is wxWidgets-2.9.0 and wxPython-20091103 .
1, I found that wxPython-src-2.8.10.1 has many problems when compiling
samples and demos, maybe because disable many items when configure. So
I choose 2.9.0 wxWidgets as my experiment. i found that for dfb,
wxWidgets-2.9.0 (configure --with-directfb --with-thems=mono) can be
compiled successfully ,moreover, it defaultlly supported unicode.
but for dems and samples, they will have compiling errors. for some
*.cpp file , we should add __WXDFB__ to include xpm file.
for example:
in demos/life/life.cpp , compiling error:

···

=================================
make: Entering directory
`/home/bob/work/wxWidgets/work/wxWidgets-2.9.0_and_wxPython_20091103/demos/life'
/home/bob/work/wxWidgets/work/wxWidgets-2.9.0_and_wxPython_20091103/bk-deps
g++ -c -o life_life.o -D__WXDFB__ -D__WXUNIVERSAL__ -I.
-DWXUSINGDLL -I./../../samples -Wall -Wundef -Wunused-parameter
-Wno-ctor-dtor-privacy -Woverloaded-virtual -D_FILE_OFFSET_BITS=64
-I/home/bob/work/wxWidgets/work/wxWidgets-2.9.0_and_wxPython_20091103/lib/wx/include/dfbuniv-unicode-release-2.9
-I../../include -D_REENTRANT -I/usr/local/include/directfb
-DWX_PRECOMP -pthread -O2 -fno-strict-aliasing -fvisibility=hidden
-fvisibility-inlines-hidden ./life.cpp
./life.cpp: In constructor ‘LifeFrame::LifeFrame()’:
./life.cpp:189: error: ‘mondrian_xpm’ was not declared in this scope
./life.cpp:241: error: ‘reset_xpm’ was not declared in this scope
./life.cpp:242: error: ‘open_xpm’ was not declared in this scope
./life.cpp:243: error: ‘zoomin_xpm’ was not declared in this scope
./life.cpp:244: error: ‘zoomout_xpm’ was not declared in this scope
./life.cpp:245: error: ‘info_xpm’ was not declared in this scope
./life.cpp:246: error: ‘play_xpm’ was not declared in this scope
./life.cpp:247: error: ‘stop_xpm’ was not declared in this scope
./life.cpp: In constructor ‘LifeNavigator::LifeNavigator(wxWindow*)’:
./life.cpp:620: error: ‘north_xpm’ was not declared in this scope
./life.cpp:621: error: ‘west_xpm’ was not declared in this scope
./life.cpp:622: error: ‘center_xpm’ was not declared in this scope
./life.cpp:623: error: ‘east_xpm’ was not declared in this scope
./life.cpp:624: error: ‘south_xpm’ was not declared in this scope
make: *** [life_life.o] Error 1
make: Leaving directory
`/home/bob/work/wxWidgets/work/wxWidgets-2.9.0_and_wxPython_20091103/demos/life

we only modify the "life.cpp" like this:

diff -Nur wxWidgets-2.9.0/demos/life/life.cpp
wxWidgets-2.9.0_and_wxPython_20091103/demos/life/life.cpp
--- wxWidgets-2.9.0/demos/life/life.cpp 2009-09-04 12:51:46.000000000 +0800
+++ wxWidgets-2.9.0_and_wxPython_20091103/demos/life/life.cpp 2009-11-04
16:13:33.000000000 +0800
@@ -38,7 +38,7 @@
// resources
// --------------------------------------------------------------------------

-#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__)

defined(__WXMGL__) || defined(__WXX11__)

+#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__)

defined(__WXMGL__) || defined(__WXX11__) || defined(__WXDFB__)

     // application icon
     #include "mondrian.xpm"

2, for the problem swig.
yes,yes, you are right. but I quite thanks your config.py . I think
you have considered all posible things.

in config.py , in default, there is no support for dfb.
I can add some macros about dfb, and set "SWIG=1" instead of "SWIG=0"
, IT CAN help me to create many *_i files.

diff -Nur wxPython_20091103-orig/config.py wxPython_20091103/config.py
--- wxPython_20091103-orig/config.py 2009-11-03 11:13:50.000000000 +0800
+++ wxPython_20091103/config.py 2009-11-05 15:11:20.000000000 +0800
@@ -101,7 +101,7 @@

PREP_ONLY = 0 # Only run the prepatory steps, not the actual build.

-USE_SWIG = 0 # Should we actually execute SWIG, or just use the
+USE_SWIG = 1 # Should we actually execute SWIG, or just use the
                    # files already in the distribution?

SWIG = "swig" # The swig executable to use.
@@ -169,7 +169,7 @@
                      # build_options.py, if it is different to that.
The default
                      # is to use the value of WX_CONFIG.

-WXPORT = 'gtk2' # On Linux/Unix there are several ports of
wxWidgets available.
+WXPORT = 'dfb' # On Linux/Unix there are several ports of
wxWidgets available.
                    # Setting this value lets you select which will be used for
                    # the wxPython build. Possibilites are 'gtk', 'gtk2' and
                    # 'x11'. Currently only gtk and gtk2 works.
@@ -834,7 +834,7 @@
if FINAL:
     HYBRID = 0

-if UNICODE and WXPORT not in ['msw', 'gtk2', 'osx_carbon', 'osx_cocoa']:
+if UNICODE and WXPORT not in ['msw', 'gtk2', 'osx_carbon', 'osx_cocoa', 'dfb']:
     raise SystemExit, "UNICODE mode not currently supported on this
WXPORT: "+WXPORT

@@ -1022,6 +1022,10 @@
             WXPLAT = '__WXMSW__'
             GENDIR = 'msw'
             portcfg = ''
+ elif WXPORT == 'dfb':
+ WXPLAT = '__WXDFB__'
+ GENDIR = 'dfb'
+ portcfg = ''
         else:
             raise SystemExit, "Unknown WXPORT value: " + WXPORT

===================
I have modified these parts, but when I execute "python2.5 setup.py
build_ext --inplace --debug" , it still has many problems,
they are like this:

=====================================================================================================================
[root@localhost wxPython_20091103]# pwd
/home/bob/work/wxWidgets/work/wxWidgets-2.9.0_and_wxPython_20091103/wxPython_20091103
[root@localhost wxPython_20091103]# python2.5 setup.py build_ext
--inplace --debug
WARNING: WXWIN not set in environment. Assuming '..'
Found wx-config: /usr/local/bin/wx-config
    Using flags: --toolkit=dfb --unicode=yes --version=2.9
Using SWIG-1.3.33
Preparing CORE...
Preparing STC...
Preparing GLCANVAS...
Preparing GIZMOS...
running build_ext
building '_core_' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fPIC -g
-DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE
-DWXP_USE_THREAD=1 -UNDEBUG -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL
-D__WXUNIVERSAL__ -D__WXDFB__ -Iinclude -Isrc
-I/usr/local/lib/wx/include/dfbuniv-unicode-release-2.9
-I/usr/local/include/wx-2.9 -I/usr/include/python2.5 -c
src/dfb/_core_wrap.cpp -o
build.unicode/temp.linux-i686-2.5/src/dfb/_core_wrap.o -pthread -ggdb
-O0
src/dfb/_core_wrap.cpp: In constructor
‘swig::PyObject_ptr::PyObject_ptr(PyObject*, bool)’:
src/dfb/_core_wrap.cpp:2701: warning: suggest explicit braces to avoid
ambiguous ‘else’
In file included from src/dfb/_core_wrap.cpp:2746:
include/wx/wxPython/pyclasses.h: At global scope:
include/wx/wxPython/pyclasses.h:109: error: expected class-name before ‘{’ token
include/wx/wxPython/pyclasses.h:126: error: ‘wxDragResult’ has not been declared
include/wx/wxPython/pyclasses.h: In constructor
‘wxPyDropSource::wxPyDropSource(wxWindow*, const wxCursor&, const
wxCursor&, const wxCursor&)’:
include/wx/wxPython/pyclasses.h:116: error: class ‘wxPyDropSource’
does not have any field named ‘wxDropSource’
include/wx/wxPython/pyclasses.h: At global scope:
include/wx/wxPython/pyclasses.h:131: error: invalid use of incomplete
type ‘struct wxDropTarget’
/usr/local/include/wx-2.9/wx/window.h:73: error: forward declaration
of ‘struct wxDropTarget’
include/wx/wxPython/pyclasses.h:133: error: expected `)' before ‘*’ token
include/wx/wxPython/pyclasses.h:141: error: ‘wxDragResult’ does not name a type
include/wx/wxPython/pyclasses.h:145: error: ‘wxDragResult’ does not name a type
include/wx/wxPython/pyclasses.h:152: error: ‘wxDragResult’ does not name a type
src/dfb/_core_wrap.cpp: In function ‘PyObject*
_wrap_wxImage_SaveFile(PyObject*, PyObject*, PyObject*)’:
src/dfb/_core_wrap.cpp:19219: warning: ‘bool wxImage::SaveFile(const
wxString&, long int) const’ is deprecated (declared at
/usr/local/include/wx-2.9/wx/image.h:523)
src/dfb/_core_wrap.cpp: In function ‘PyObject*
_wrap_wxImage_SaveStream(PyObject*, PyObject*, PyObject*)’:
src/dfb/_core_wrap.cpp:19350: warning: ‘bool
wxImage::SaveFile(wxOutputStream&, long int) const’ is deprecated
(declared at /usr/local/include/wx-2.9/wx/image.h:508)
src/dfb/_core_wrap.cpp: In function ‘PyObject*
_wrap_wxWindow_SetVirtualSizeHints(PyObject*, PyObject*, PyObject*)’:
src/dfb/_core_wrap.cpp:39909: warning: ‘virtual void
wxWindowBase::SetVirtualSizeHints(int, int, int, int)’ is deprecated
(declared at /usr/local/include/wx-2.9/wx/window.h:447)
src/dfb/_core_wrap.cpp: In function ‘PyObject*
_wrap_wxWindow_SetVirtualSizeHintsSz(PyObject*, PyObject*,
PyObject*)’:
src/dfb/_core_wrap.cpp:39955: warning: ‘void
wxWindowBase::SetVirtualSizeHints(const wxSize&, const wxSize&)’ is
deprecated (declared at /usr/local/include/wx-2.9/wx/window.h:449)
src/dfb/_core_wrap.cpp: In function ‘PyObject*
_wrap_wxWindow_SetHelpTextForId(PyObject*, PyObject*, PyObject*)’:
src/dfb/_core_wrap.cpp:46334: warning: ‘void
wxWindowBase::SetHelpTextForId(const wxString&)’ is deprecated
(declared at /usr/local/include/wx-2.9/wx/window.h:1213)
src/dfb/_core_wrap.cpp: In function ‘PyObject*
_wrap_wxWindow_SetToolTip(PyObject*, PyObject*, PyObject*)’:
src/dfb/_core_wrap.cpp:46517: error: conversion from ‘wxToolTip*’ to
‘const wxString’ is ambiguous
/usr/local/include/wx-2.9/wx/string.h:1245: note: candidates are:
wxString::wxString(wchar_t, size_t) <near match>
/usr/local/include/wx-2.9/wx/string.h:1241: note:
wxString::wxString(char, size_t) <near match>
/usr/local/include/wx-2.9/wx/string.h:477: note:
wxString::wxString(int) <near match>
src/dfb/_core_wrap.cpp: In function ‘PyObject*
_wrap_wxWindow_GetToolTip(PyObject*, PyObject*)’:
src/dfb/_core_wrap.cpp:46572: error: ‘const class wxWindow’ has no
member named ‘GetToolTip’
src/dfb/_core_wrap.cpp:46577: error: cannot convert ‘wxToolTip*’ to
‘wxObject*’ for argument ‘1’ to ‘PyObject*
wxPyMake_wxObject(wxObject*, bool, bool)’
src/dfb/_core_wrap.cpp: In function ‘PyObject*
_wrap_wxWindow_SetDropTarget(PyObject*, PyObject*, PyObject*)’:
src/dfb/_core_wrap.cpp:46610: error: ‘class wxWindow’ has no member
named ‘SetDropTarget’
src/dfb/_core_wrap.cpp: In function ‘PyObject*
_wrap_wxWindow_GetDropTarget(PyObject*, PyObject*)’:
src/dfb/_core_wrap.cpp:46638: error: ‘const class wxWindow’ has no
member named ‘GetDropTarget’
src/dfb/_core_wrap.cpp: In function ‘PyObject*
_wrap_wxWindow_DragAcceptFiles(PyObject*, PyObject*, PyObject*)’:
src/dfb/_core_wrap.cpp:46676: error: ‘class wxWindow’ has no member
named ‘DragAcceptFiles’
src/dfb/_core_wrap.cpp: In function ‘PyObject*
_wrap_wxSizerItem_SetWindow(PyObject*, PyObject*, PyObject*)’:
src/dfb/_core_wrap.cpp:59722: warning: ‘void
wxSizerItem::SetWindow(wxWindow*)’ is deprecated (declared at
/usr/local/include/wx-2.9/wx/sizer.h:1027)
src/dfb/_core_wrap.cpp: In function ‘PyObject*
_wrap_wxSizerItem_SetSizer(PyObject*, PyObject*, PyObject*)’:
src/dfb/_core_wrap.cpp:59758: warning: ‘void
wxSizerItem::SetSizer(wxSizer*)’ is deprecated (declared at
/usr/local/include/wx-2.9/wx/sizer.h:1032)
src/dfb/_core_wrap.cpp: In function ‘PyObject*
_wrap_wxSizerItem_SetSpacer(PyObject*, PyObject*, PyObject*)’:
src/dfb/_core_wrap.cpp:59794: warning: ‘void
wxSizerItem::SetSpacer(const wxSize&)’ is deprecated (declared at
/usr/local/include/wx-2.9/wx/sizer.h:1037)
src/dfb/_core_wrap.cpp: In function ‘PyObject*
_wrap_wxSizer_SetVirtualSizeHints(PyObject*, PyObject*, PyObject*)’:
src/dfb/_core_wrap.cpp:61727: warning: ‘void
wxSizer::SetVirtualSizeHints(wxWindow*)’ is deprecated (declared at
/usr/local/include/wx-2.9/wx/sizer.h:651)
error: command 'gcc' failed with exit status 1
[root@localhost wxPython_20091103]#

================================================================================================================
it seems that dfb didn't implement some related functions just like GTK2.
so next step , we will consider how to implement these functions as GTK2.

Bob

You'll need to edit the *.i files and wrap parts of them in #ifndef __WXDFB__ ... #endif to exclude thw things defined in those files that are different or don't exist in wxDFB.

···

On 11/5/09 10:43 PM, Bob Zhang wrote:

I have modified these parts, but when I execute "python2.5 setup.py
build_ext --inplace --debug" , it still has many problems,
they are like this:

--
Robin Dunn
Software Craftsman