wxPython Patches :-D

Hi All,

    I have few patches for some custom wxPython controls and a
(possible) enhancement to the wxPython demo.

1) CustomTreeCtrl

The attached patch fixes the following problems/issues:

a) ZeroDivisionError when using the Vista selection style and calling
SelectItem; for some strange reason, sometimes the item rect is not
initialized and that generates the ZeroDivisionError when painting the
selection rectangle;
b) Added a DeleteWindow method to GenericTreeItem class, for items
that hold a widget next to them;
c) Renamed CustomTreeCtrl method IsEnabled to IsItemEnabled, otherwise
it conflicts with wx.Window.IsEnabled;
d) Now CustomTreeCtrl behaves correctly when the widget attached to an
item is narrower (in height) than the item text;

2) FlatNotebook

The attached patches (for the main class and the demo) implement the
following (quoting Eran Ifrah, the original FlatNotebook author of the
C++ widget):

a) A new style FNB_FF2: my intentions were to make it like Firefox 2,
however it turned out to be an hybrid between wxAUI notebook glose
style & FF2 ...I still think it looks OK. The main purpose for making
it more like wxAUI is to allow applications that uses both to have
same look and feel (or as close as it can get...);
b) Changed the behavior of the left/right rotation arrows to rotate
single tab at a time and not bulk of tabs;
c) Updated the sample program.

3) FlatMenu

A big thanks to Peter Kort that has implemented a fix for tooltips on
toolbar items. You can find the updated sources in the usual place:

http://xoomer.alice.it/infinity77/eng/freeware.html#flatmenu

If someone is using FlatMenu on a platform other than Windows XP, I
would be glad to see a screenshot of it and I will include it in the
FlatMenu web page. Thank you in advance.

4) wxPython Demo

I have been playing with the wxPython demo and I ended up in
facelifting it a bit. It's difficult to improve something that is
already well done and extremely useful, but this is what I did
(screenshots included):

a) The main frame layout is now based on wxAUI:

http://xoomer.alice.it/infinity77/wxPython_1.png

b) as you can see from the previous screenshot, I substituted the left
wx.TreeCtrl with CustomTreeCtrl. You may also have noticed that some
of the tree items have a green icon next to them: those are the demos
for which a modified version (stored in wx.GetHomeDir() +
"/.wxPyDemo/modified") exists. In this way, with a first glance you
already know for which demos a modified version exists;

c) The CustomTreeCtrl in the demo uses also the beautiful TreeMixin
from Frank Niessink: Being a subclass of ExpansionState, the left tree
remembers the tree expansion state (and allows you to restore it using
the menus, see later);

d) The central notebook is now a FlatNotebook: it allows you to
customize the tabs appearance and positioning:

http://xoomer.alice.it/infinity77/wxPython_2.png

In the previous screenshot, I am using bottom tabs with the new
Firefox 2 style. The wxPython demo remembers your settings the next
time you run the demo.

e) It is possible to save the AUI perspectives, and the wxPython demo
remembers all the saved perspectives the next time you open the demo.

f) Menu items have their own icons:

http://xoomer.alice.it/infinity77/wxPython_3.png
http://xoomer.alice.it/infinity77/wxPython_4.png
http://xoomer.alice.it/infinity77/wxPython_5.png

I have used the beautiful Nuvola/Crystal Clear/SilkIcons to build the
menu icons.

g) I fixed an grammar error in an assertion: if you scan the wxPython
demo, you'll see a:

raise AssetionError

But it should be:

raise AssertionError

It's missing an "r".

I think that's all. If there is some interest in the new facelifted
wxPython demo, please let me know. I would be glad to share it with
the wxPython community. Otherwise, it has been a nice game to play
with the wxPython demo :smiley:

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

customtreectrl.py.patch (11 KB)

flatnotebook.py.patch (23.5 KB)

FlatNotebookDemo.py.patch (2.76 KB)

Andrea Gavana wrote:

Hi All,

   I have few patches for some custom wxPython controls and a
(possible) enhancement to the wxPython demo.

Nice, I would love to have the new demo, especially if it includes the fix you talked about awhile ago that does the Freeze/Thaw when typing in the search box (or is that already in there, it kind of looks like it might be?). Anyway, it looks really cool! Now you will have to add one more exclamation to the "wxPython RULES!!!" statusbar message that appears when hovering over About :slight_smile:

And what is this saving perspectives business. Does this work now with AUI?!

- Mike

Hi Mike,

Andrea Gavana wrote:
> Hi All,
>
> I have few patches for some custom wxPython controls and a
> (possible) enhancement to the wxPython demo.
>

Nice, I would love to have the new demo, especially if it includes the
fix you talked about awhile ago that does the Freeze/Thaw when typing in
the search box (or is that already in there, it kind of looks like it
might be?).

It's already there, if you have wxPython 2.8.3. Basically you freeze
the tree control to avoid flickering when repopulating it. BTW, I
forgot to mention that the new demo fixes also the flickering due to
the DeletePage/AddPage actions in the central notebook: the solution
is *not* to Freeze() the notebook but the main frame, Thaw()ing it
when the AddPage/RemovePage has finished. I don't see anymore the
small rectangle on the left of the notebook when a demo is loading.

Anyway, it looks really cool! Now you will have to add one
more exclamation to the "wxPython RULES!!!" statusbar message that
appears when hovering over About :slight_smile:

Hehehehehehe, well, I leave this patch to Robin :smiley:

And what is this saving perspectives business. Does this work now with AUI?!

Well, if we speak about *manager* perspectives, this has always
worked. The new wxPython demo remembers the positions/size/floating
state and whatever of the 2 non-center panes (i.e., the tree control
and the log window). Saving/loading perspectives of the *notebook* is
still not supported in wxAUI, as far as I know, and I doubt it will be
in the near future... However, the new wxPython demo is not using
wx.aui.AuiNotebook, but FlatNotebook: I wanted to use
wx.aui.AuiNotebook, but until the subclassing of wx.aui.PyAuiTabArt is
not working I will leave FlatNotebook (as I want to create a new and
customized wx.aui.PyAuiTabArt).

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

···

On 4/16/07, Mike Rooney wrote:

Hi Mario,

···

On 4/16/07, Mario Lacunza wrote:

El lun, 16-04-2007 a las 21:27 +0200, Andrea Gavana escribió:
> Hi All,

OK! I love the new wxDemo!! :smiley:

I expected then Robin implement soon that :slight_smile:

Andrea:

I attach 3 screenshots from my platform, I send you direct to your
private email.

Thanks for the screenshots! I will include them in my web page for
FlatMenu. It looks like the new wxPython demo is not a big success,
but it doesn't matter, it has been nice to implement it :smiley:

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

Yes, I see the Mr.Penz email and I suposse then he have a little reason, but If we dont test your control never will be going to be a “wx well tested controls…” :smiley: (sorry for may english!)

Maybe two wxDemo version: Native and Deluxe?? :wink:

···

2007/4/17, Andrea Gavana andrea.gavana@gmail.com:

Hi Mario,

On 4/16/07, Mario Lacunza wrote:

El lun, 16-04-2007 a las 21:27 +0200, Andrea Gavana escribió:

Hi All,

OK! I love the new wxDemo!! :smiley:

I expected then Robin implement soon that :slight_smile:

Andrea:

I attach 3 screenshots from my platform, I send you direct to your
private email.

Thanks for the screenshots! I will include them in my web page for
FlatMenu. It looks like the new wxPython demo is not a big success,

but it doesn’t matter, it has been nice to implement it :smiley:

Andrea.


Saludos / Best regards

Mario Lacunza
Desarrollador de Sistemas - Webmaster
Desarrollador 2 Estrellas VS2005

Email: mlacunza [AT] gmail [DOT] com
Website: mlacunzav[DOT]cogia[DOT]net
Blog: http://mlacunza.blogspot.com/
Lima - Peru

Andrea Gavana wrote:

Hi Mario,

> Hi All,

OK! I love the new wxDemo!! :smiley:

I expected then Robin implement soon that :slight_smile:

Andrea:

I attach 3 screenshots from my platform, I send you direct to your
private email.

Thanks for the screenshots! I will include them in my web page for
FlatMenu. It looks like the new wxPython demo is not a big success,
but it doesn't matter, it has been nice to implement it :smiley:

Do you think you might put the source for it on your website? I understand the issues other people were saying with using owner-drawn controls for the public but I personally think it would be cool to replace my demo with this one, if you already have gone to the work of making it.

Also just a note, the date on your CustomTreeCtrl is either out of date, or the page/file itself is. I am pretty sure it has been changed since May of 2006 :slight_smile:

- Mike

···

On 4/16/07, Mario Lacunza wrote:

El lun, 16-04-2007 a las 21:27 +0200, Andrea Gavana escribió:

Hi Mario and All,

> Hi Mike,
>
> >
> > Do you think you might put the source for it on your website? I
> > understand the issues other people were saying with using owner-drawn
> > controls for the public but I personally think it would be cool to
> > replace my demo with this one, if you already have gone to the work of
> > making it.
>
> Yes, I don't have any problem in doing that. The demo is working here
> on Windows XP, Python 2.5, wxPython 2.8.3 . I can't test it with other
> OSs, but I could create a new web page to hold the "alternative"
> wxPython demo.

Please when you upload the new wxDemo, send me an email because I want to
testing in my platform(Ubuntu Edgy, Python 2.4.4 and wxPython 2.8.3)

I'll upload the demo this evening (in few hours) and I will report
back to the mailing list when finished. There might be some caveats on
other OSs: if so, please let me know (and if you have a fix, even
better!). At the moment, on Windows, the only strange thing I can see
is related to the GraphicsContext demo: sometimes, it keeps refreshing
ad infinitum, with the "scale" and "rotate" drawings that are redrawn
without an end. I can't imagine a reason for that...
However, this "alternative" wxPython demo requires the latest patches
for CustomTreeCtrl and FlatNotebook I sent yesterday: I will update my
web page for these 2 controls, please remember to download them and
put them in wx.lib *before* trying to run the alternative wxPython
demo.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

···

On 4/17/07, Mario Lacunza wrote:

2007/4/17, Andrea Gavana <andrea.gavana@gmail.com>:
> On 4/17/07, Mike Rooney wrote:

Andrea Gavana wrote:

Hi All,

   I have few patches for some custom wxPython controls and a
(possible) enhancement to the wxPython demo.

1) CustomTreeCtrl

There was a slight problem with this patch. It looks like I had a version in CVS from April 1, but you made the patch from a version made on March 2. Please double check what I just checked in to CVS to ensure that there were no problems with the merge.

2) FlatNotebook

Patched and checked in.

3) FlatMenu

One of these days I'll get this one added to the wx.lib too...

4) wxPython Demo

I like the enhancements you have done, but agree with others about using native widgets for the main interface of the demo. That said, I think that keeping just the notebook native might be good enough. If you send me a patch with your other changes and enhancements besides the notebook changes then I'll consider it. If nothing else, getting your flicker and other bug fixes would be a good thing.

I have used the beautiful Nuvola/Crystal Clear/SilkIcons to build the
menu icons.

Is the license on these icons compatible with the wxWidgets License?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

I would say, show case wxPython as much as you can do. People are
downloading the demo and it is probably the first thing they will see
when starting wxPython. Why not giving them the O.M.G feeling? (I
wanted to use the word WOW but it is probably patented by M$ by now
:wink:

If the demo looks very slick, more people will see what wxPython is
capable of. If we stick to native controls, it is just another app
showing a bunch of controls.

I would say, use it and let's all be proud of what wxPython can do! :wink:

BTW the demo is a great tool for people just starting. I would add a
suggestion for searching in the code of the demo snippets to see how a
control is used. I found myself scanning demo's to look for a control
which was not the control that was showcased, but it was used in the
demo. And it would have been useful to see a list of files where the
control in question was used in

Regards,
- Jorgen

Hi Robin & All,

Andrea Gavana wrote:

>> BTW the demo is a great tool for people just starting. I would add a
>> suggestion for searching in the code of the demo snippets to see how a
>> control is used. I found myself scanning demo's to look for a control
>> which was not the control that was showcased, but it was used in the
>> demo. And it would have been useful to see a list of files where the
>> control in question was used in
>
> Yes, this is a good idea. I'll see if I can implement it (as a menu
> option, maybe), when I get back from my work trip and provide a patch
> to Robin if there is enough interest about it.

Yes, that's a good idea. Perhaps it could be part of the search control
that is already there. Give it a menu that selects whether the search
applies to the sample name or the sample content.

Just in case there is still interest in this modified wxPython demo, I
have added Jorgen's suggestion to the SearchCtrl. I am attaching the
patch against CVS. This patch includes the use of CustomTreeCtrl and
wxAUI and a bit of refactoring for menus and icons, as the latest
patch I sent 1 week ago. Sorry for the absence, but where I have been
last week the technology is still on the 18th century.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

Main.py.patch (32 KB)

···

On 4/19/07, Robin Dunn wrote:

Hi Robin,

Andrea Gavana wrote:
> Hi Robin & All,
>
>> Andrea Gavana wrote:
>>
>> >> BTW the demo is a great tool for people just starting. I would add a
>> >> suggestion for searching in the code of the demo snippets to see how a
>> >> control is used. I found myself scanning demo's to look for a control
>> >> which was not the control that was showcased, but it was used in the
>> >> demo. And it would have been useful to see a list of files where the
>> >> control in question was used in
>> >
>> > Yes, this is a good idea. I'll see if I can implement it (as a menu
>> > option, maybe), when I get back from my work trip and provide a patch
>> > to Robin if there is enough interest about it.
>>
>> Yes, that's a good idea. Perhaps it could be part of the search control
>> that is already there. Give it a menu that selects whether the search
>> applies to the sample name or the sample content.
>
> Just in case there is still interest in this modified wxPython demo, I
> have added Jorgen's suggestion to the SearchCtrl. I am attaching the
> patch against CVS. This patch includes the use of CustomTreeCtrl and
> wxAUI and a bit of refactoring for menus and icons, as the latest
> patch I sent 1 week ago. Sorry for the absence, but where I have been
> last week the technology is still on the 18th century.

        for png in ["overview", "code", "demo"]:
            imgList.Add(wx.Bitmap(opj("bitmaps/%s.png"%png),
wx.BITMAP_TYPE_PNG))

Did you have some icons to go along with it?

They were attached in a previous email in this same thread. However,
they might be filtered out because of the zipped extension, so I am
uploading them here:

http://xoomer.alice.it/infinity77/bitmaps.zip

You can just take the icons from there and put them inside the folder:

wxPython Docs and Demos/demo/bitmaps

And it should work.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

···

On 5/5/07, Robin Dunn wrote:

> On 4/19/07, Robin Dunn wrote: