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
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)