[wxPython-dev] Some info on the ongoing SoC XRCed project
Roman Rolinsky
rolinsky at femagsoft.com
Wed Jul 11 07:20:02 PDT 2007
Hi, Kevin,
On Tue, 2007-07-10 at 10:08 -0700, Kevin Ollivier wrote:
> Hi Roman,
>
> On Jul 9, 2007, at 4:31 PM, Roman Rolinsky wrote:
>
> > On Fri, 2007-07-06 at 21:05 -0700, Kevin Ollivier wrote:
> > [snip]
> >> BTW, I really do like the new tool pane, I think it gives the app a
> >> more modern look and gives the user a better idea of what the
> >> controls will look like in the app. :-)
> >
> > Thanks. The only problem now is to keep the size of the tool pane
> > sane,
> > so it will not get in the way of the test window and others.
> > Unfortunately Toolbook does not provide a means to scroll the toolbar
> > which is used for pane selection buttons, so when the size of the
> > window
> > is not enough to hold all the buttons they are simply clipped away. I
> > think I will need to provide at least some indicator that there are
> > more
> > buttons than meets the eye. The only way to implement scrolling
> > seems to
> > be removing some buttons from the toolbar (maybe hiding will do, I
> > didn't try yet). I also plan to make specific tool panes for wxMAC and
> > wxMSW and make them scalable by selecting a factor from the
> > application's preference dialog.
>
> Have you tried using wx.Listbook and not specifying any labels? This
> seems to at least allow scrolling.
I've tried Listbook first, I don't remember exactly but there were some
problems with it also, maybe it reserves space for the text labels.
I've tried Andrea's LabelBook and it clips buttons in the same way as
the stock control, but maybe it's possible to extend it.
> >> Nice! I'll be looking forward to that, so I can add SizedControls and
> >> wxWebKit in there. (The latter will have to be able to install itself
> >> into XRCed when the user installs the control, I imagine that would
> >> be possible?)
> >
> > You mean to initialize C++ XML handlers? This is possible using ctypes
> > module which can load a function from a shared library. AFAIK only the
> > interface to C functions is portable, so a plugin must provide an
> > extern
> > "C" function without arguments and the name of this function is made
> > known to XRCed when registering the component. The function is called
> > every time the test window is created. It should add XML handlers
> > to the
> > resource object returned by XmlResource::Get(). Another approach is to
> > provide a wrapper module similar to wxPython wrappers. It must be
> > generated using a patched SWIG, and then the module is imported
> > like any
> > other python modules.
> >
> > Defining pure-wxPython component plugins is very easy, once there is a
> > working XmlHandler class. It can be done using a python module
> > imported
> > by XRCed or by using XML manifest file which can be edited using XRCed
> > (this is already working but I need to make some documentation).
> >
> > Normally XmlHandler classes should be in some separate modules, not
> > necessary in XRCed/plugins, just available for importing by component
> > plugin modules.
>
> To be honest, I'm still new to XRC so some of this went a bit over my
> head. ;-) However, from your and Robin's comments, I think I can say
> that what I want to do for now is create a wxPython component using
> the webview.py module API, rather than mucking with things at the C++
> level.
Well if you want WebKit to be usable from XRC in C++ apps and not only
from wxPython, you will need to provide a C++ version of XMLHandler
class. Take a look at the standard handlers, for example
src/xrc/xh_html.cpp, it's rather simple to write one. What I was saying
is that instead of writing a python wrapper for it, it is possible to
include an additional C function in your library which will be called by
XRCed to install the handler:
extern "C"
void AddXmlHandlers()
{
wxXmlResource::Get()->AddHandler(new WebKitXmlHandler);
}
>
> >>> The tool panel is inspired by the OSX Interface Builder, it's just a
> >>> wxToolbook with wxPanels and wxBitmapButtons. I'm planning to try
> >>> to use
> >>> AUI to make all panels docking in the future.
> >>>
> >>> The test window is a little different too, it is 'persistent' for
> >>> non-top-level controls, so should not flicker and steal focus
> >>> from the
> >>> main window. Another new feature is the possibility to test
> >>> individual
> >>> interface elements.
> >>
> >> Also nice! :-) BTW, I was wondering, how hard would it be to drag and
> >> drop controls into the test window? I think it would be a very nice
> >> feature to have.
> >
> > You may check the "Recent Changes" document for wxPython 2.8.4 ;)
>
> Unfortunately, I can't seem to get it to work using the XRCed found
> in the 2.8.4 demo on OS X or on my Windows box... :-/ Can you give me
> a series of steps that should work to make sure I'm not doing
> something wrong?
Hm, strange, the demos package for OSX (and probably Windows also)
contains slightly older version of XRCed than the source package
wxPython-src-2.8.4.0.tar.bz2
(where DnD works).
Roman
More information about the wxpython-dev
mailing list