ANN: FlatNotebook Control For wxPython ;-)

Hello NG,

    I would like to "announce" my latest control, called FlatNotebook.

"The FlatNotebook is a full implementation of the wx.Notebook, and
designed to be a drop-in replacement for wx.Notebook. The API
functions are similar so one can expect the function to behave in the
same way.

Some features:
- The buttons are highlighted a la Firefox style
- The scrolling is done for bulks of tabs (so, the scrolling is faster
and better)
- The buttons area is never overdrawn by tabs
- It is a generic control
- Currently there are 4 differnt styles - VC8, VC 71, Standard and Fancy.
- Mouse middle click can be used to close tabs
- A function to add right click menu for tabs (simple as SetRightClickMenu)
- All styles has bottom style as well (they can be drawn in the bottom
of screen)
- An option to hide 'X' button or navigation buttons (separately)
- Gradient coloring of the selected tabs and border
- Support for drag 'n' drop of tabs, both in the same notebook or to
another notebook
- Possibility to have closing button on the active tab directly
- Support for disabled tabs
- Colours for active/inactive tabs, and captions
- Background of tab area can be painted in gradient (VC8 style only)
- Colourful tabs - a random gentle colour is generated for each new
tab (very cool, VC8 style only)

And much more.
"

The source code, demo and epydoc-generated documentation are available
in the usual place:

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

Or, if you prefer in italian:

http://xoomer.alice.it/infinity77/ita/freeware.html#flatnotebook

The widget has been tested on wxPython 2.6.3.3, with Python 2.4 on Windows XP.

A load of thanks goes to Eran that posted the code on wxWidgets forum.
Please let me know about bugs and request of improvements.

Happy wxPythoning!

Andrea.

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

Wow, this is just superb! You can drag around the individual pages like in VC, the demo rocks. I have two little comments about this:

1. If I drag a tab to change the tab order in a peculiar notebook, I always have to drag it straight onto another tab. For example suppose there's Tab1 Tab2 and I want to make it Tab2 Tab1, I could either drag Tab2 on Tab1 or vice versa. It would be nice if you could extend this so that I could drag Tab1 somewhere right of Tab2 (not exactly onto Tab2) to move it to the last position. Or to drag Tab2 before Tab1 (to the left of Tab1, very close to the screen border).

2. Have you thought about combining this with wx.aui? I think VC does the same. Basically you can add new tabs to a notebook by dragging other tabs/windows onto it. Is it perhaps already possible by making a bunch of wx.aui panes, all containing FlatNotebooks? This would definately be one of the coolest things in wxpython and something I really appreciate. It would allow me to make my application work exactly like I wanted it to work.

Just for your information, I am using a lot of the controls you wrote by now. They're extremely useful for designing flexible, powerful and at the same time even good looking applications. I can't think of any more controls that you could write by now, honestly. Your work is basically the icing on the (great) cake that's called wxPython for me. Thanks a lot!

-Matthias

···

Am 03.10.2006, 02:38 Uhr, schrieb Andrea Gavana <andrea.gavana@gmail.com>:

Hello NG,

    I would like to "announce" my latest control, called FlatNotebook.

"The FlatNotebook is a full implementation of the wx.Notebook, and
designed to be a drop-in replacement for wx.Notebook. The API
functions are similar so one can expect the function to behave in the
same way.

Some features:
- The buttons are highlighted a la Firefox style
- The scrolling is done for bulks of tabs (so, the scrolling is faster
and better)
- The buttons area is never overdrawn by tabs
- It is a generic control
- Currently there are 4 differnt styles - VC8, VC 71, Standard and Fancy.
- Mouse middle click can be used to close tabs
- A function to add right click menu for tabs (simple as SetRightClickMenu)
- All styles has bottom style as well (they can be drawn in the bottom
of screen)
- An option to hide 'X' button or navigation buttons (separately)
- Gradient coloring of the selected tabs and border
- Support for drag 'n' drop of tabs, both in the same notebook or to
another notebook
- Possibility to have closing button on the active tab directly
- Support for disabled tabs
- Colours for active/inactive tabs, and captions
- Background of tab area can be painted in gradient (VC8 style only)
- Colourful tabs - a random gentle colour is generated for each new
tab (very cool, VC8 style only)

And much more.
"

The source code, demo and epydoc-generated documentation are available
in the usual place:

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

Or, if you prefer in italian:

http://xoomer.alice.it/infinity77/ita/freeware.html#flatnotebook

The widget has been tested on wxPython 2.6.3.3, with Python 2.4 on Windows XP.

A load of thanks goes to Eran that posted the code on wxWidgets forum.
Please let me know about bugs and request of improvements.

Happy wxPythoning!

Andrea.

Hi Andrea,

Cool, I have been looking forward to seeing this control in wxPython! However, it has problems on Mac. (No, seriously! :wink: Although, it's not with the control itself, it's something to do with the images.

I have to admit I'm baffled by this one - it's the annoying "image height doesn't match image width" assert, but in this case, the height and width of the PNG files do seem to match. So I wonder if for some reason wxMac can't read the PNG files? The assertion I'm getting is:

wx._core.PyAssertionError: C++ assertion "(bitmap.GetWidth() == m_width && bitmap.GetHeight() == m_height) || (m_width == 0 && m_height == 0)" failed in /BUILD/wxPython-src-2.6.3.3/src/mac/carbon/imaglist.cpp(88): invalid bitmap size in wxImageList: this might work on this platform but definitely won't under Windows.

I've never seen this before on Mac when loading an image whose dimensions were equal. Does anyone know what might be causing this?

Thanks,

Kevin

···

On Oct 2, 2006, at 5:38 PM, Andrea Gavana wrote:

Hello NG,

   I would like to "announce" my latest control, called FlatNotebook.

"The FlatNotebook is a full implementation of the wx.Notebook, and
designed to be a drop-in replacement for wx.Notebook. The API
functions are similar so one can expect the function to behave in the
same way.

Some features:
- The buttons are highlighted a la Firefox style
- The scrolling is done for bulks of tabs (so, the scrolling is faster
and better)
- The buttons area is never overdrawn by tabs
- It is a generic control
- Currently there are 4 differnt styles - VC8, VC 71, Standard and Fancy.
- Mouse middle click can be used to close tabs
- A function to add right click menu for tabs (simple as SetRightClickMenu)
- All styles has bottom style as well (they can be drawn in the bottom
of screen)
- An option to hide 'X' button or navigation buttons (separately)
- Gradient coloring of the selected tabs and border
- Support for drag 'n' drop of tabs, both in the same notebook or to
another notebook
- Possibility to have closing button on the active tab directly
- Support for disabled tabs
- Colours for active/inactive tabs, and captions
- Background of tab area can be painted in gradient (VC8 style only)
- Colourful tabs - a random gentle colour is generated for each new
tab (very cool, VC8 style only)

And much more.
"

The source code, demo and epydoc-generated documentation are available
in the usual place:

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

Or, if you prefer in italian:

http://xoomer.alice.it/infinity77/ita/freeware.html#flatnotebook

The widget has been tested on wxPython 2.6.3.3, with Python 2.4 on Windows XP.

A load of thanks goes to Eran that posted the code on wxWidgets forum.
Please let me know about bugs and request of improvements.

Happy wxPythoning!

Andrea.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Kevin Ollivier wrote:

Hi Andrea,

Cool, I have been looking forward to seeing this control in wxPython! However, it has problems on Mac. (No, seriously! :wink: Although, it's not with the control itself, it's something to do with the images.

I have to admit I'm baffled by this one - it's the annoying "image height doesn't match image width" assert, but in this case, the height and width of the PNG files do seem to match. So I wonder if for some reason wxMac can't read the PNG files? The assertion I'm getting is:

wx._core.PyAssertionError: C++ assertion "(bitmap.GetWidth() == m_width && bitmap.GetHeight() == m_height) || (m_width == 0 && m_height == 0)" failed in /BUILD/wxPython-src-2.6.3.3/src/mac/carbon/imaglist.cpp(88): invalid bitmap size in wxImageList: this might work on this platform but definitely won't under Windows.

I've never seen this before on Mac when loading an image whose dimensions were equal. Does anyone know what might be causing this?

It's not checking that the width and height are equal, but that the dimensions of the image matches size specified for the image list.

···

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

Excellent! I like it.

···

On 10/3/06, Andrea Gavana <andrea.gavana@gmail.com> wrote:

Hello NG,

    I would like to "announce" my latest control, called FlatNotebook.

"The FlatNotebook is a full implementation of the wx.Notebook, and
designed to be a drop-in replacement for wx.Notebook. The API
functions are similar so one can expect the function to behave in the
same way.

Some features:
- The buttons are highlighted a la Firefox style
- The scrolling is done for bulks of tabs (so, the scrolling is faster
and better)
- The buttons area is never overdrawn by tabs
- It is a generic control
- Currently there are 4 differnt styles - VC8, VC 71, Standard and Fancy.
- Mouse middle click can be used to close tabs
- A function to add right click menu for tabs (simple as SetRightClickMenu)
- All styles has bottom style as well (they can be drawn in the bottom
of screen)
- An option to hide 'X' button or navigation buttons (separately)
- Gradient coloring of the selected tabs and border
- Support for drag 'n' drop of tabs, both in the same notebook or to
another notebook
- Possibility to have closing button on the active tab directly
- Support for disabled tabs
- Colours for active/inactive tabs, and captions
- Background of tab area can be painted in gradient (VC8 style only)
- Colourful tabs - a random gentle colour is generated for each new
tab (very cool, VC8 style only)

And much more.
"

The source code, demo and epydoc-generated documentation are available
in the usual place:

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

Or, if you prefer in italian:

http://xoomer.alice.it/infinity77/ita/freeware.html#flatnotebook

The widget has been tested on wxPython 2.6.3.3, with Python 2.4 on Windows XP.

A load of thanks goes to Eran that posted the code on wxWidgets forum.
Please let me know about bugs and request of improvements.

Happy wxPythoning!

Andrea.

--
I like python!
UliPad <<The Python Editor>>: UliPad - Woodpecker Wiki for CPUG
My Blog: http://www.donews.net/limodou

bugs report:

FlatNotebook.py 2111 undefined name 'wxEVT_FLATNOTEBOOK_CONTEXT_MENU'
FlatNotebook.py 4011 undefined name 'self'
FlatNotebook.py 4012 undefined name 'self'

···

--
I like python!
UliPad <<The Python Editor>>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou

In the demo for the flat note book, if you select Edit | Use Bottom Tabs immediately after opening the app, you get this exception:

Traceback (most recent call last):
  File "D:\abling\Packages\wxPython\Flatnotebook\FlatNotebookDemo.py", line 378,
in OnStyle
    self.book.SetWindowStyleFlag(style)
  File "D:\abling\Packages\wxPython\Flatnotebook\FlatNotebook.py", line 1337, in
SetWindowStyleFlag
    self.SetSelection(self._pages._iActivePage)
  File "D:\abling\Packages\wxPython\Flatnotebook\FlatNotebook.py", line 1099, in
SetSelection
    if not self._pages.GetEnabled(page) and len(self._windows) > 1 and not self.
_bForceSelection:
  File "D:\abling\Packages\wxPython\Flatnotebook\FlatNotebook.py", line 2987, in
GetEnabled
    return self._pagesInfoVec[page].GetEnabled()
IndexError: list index out of range

Hugh

I'v replaced Notebook with FlatNotebook in UliPad, it's cool. But
sometimes, as I click the nav button, the show is not correct, and
sometime the screen doesnot repaint again. I need to kill the program.

You can try UliPad from the below URL.

···

--
I like python!
UliPad <<The Python Editor>>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou

Well, the imagelist is declared as:

self._ImageList = wx.ImageList(16, 16)
self._ImageList.Add(wx.Bitmap("book_red.png", wx.BITMAP_TYPE_PNG))
self._ImageList.Add(wx.Bitmap("book_green.png", wx.BITMAP_TYPE_PNG))
self._ImageList.Add(wx.Bitmap("book_blue.png", wx.BITMAP_TYPE_PNG))

the three images have the following properties:

Image width: 16
Image height: 16
Horizontal resolution: 71
Vertical resolution: 71
Bit depth: 32
Nnumber of images: 1

So I don't see why Mac should complain about the differences between
the imagelist size and the PNGs size. They are the same.

Curious the error message:

"invalid bitmap size in wxImageList: this might work on this platform
but definitely won't under Windows"

Hahahahahaha, yeah, sure, how comes that it's actually *working* on Windows? :smiley:

Andrea.

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

···

On 10/3/06, Robin Dunn <robin@alldunn.com> wrote:

Kevin Ollivier wrote:
> wx._core.PyAssertionError: C++ assertion "(bitmap.GetWidth() == m_width
> && bitmap.GetHeight() == m_height) || (m_width == 0 && m_height == 0)"
> failed in /BUILD/wxPython-src-2.6.3.3/src/mac/carbon/imaglist.cpp(88):
> invalid bitmap size in wxImageList: this might work on this platform but
> definitely won't under Windows.
>
> I've never seen this before on Mac when loading an image whose
> dimensions were equal. Does anyone know what might be causing this?

It's not checking that the width and height are equal, but that the
dimensions of the image matches size specified for the image list.

Thank you very much Andrea, as usual! that's great.

Just a note I've seen first:
when creating a new page or deleting one the changing and changed events aren't fired

Alessandro

Andrea Gavana wrote:

···

Hello NG,

   I would like to "announce" my latest control, called FlatNotebook.

"The FlatNotebook is a full implementation of the wx.Notebook, and
designed to be a drop-in replacement for wx.Notebook. The API
functions are similar so one can expect the function to behave in the
same way.

Some features:
- The buttons are highlighted a la Firefox style
- The scrolling is done for bulks of tabs (so, the scrolling is faster
and better)
- The buttons area is never overdrawn by tabs
- It is a generic control
- Currently there are 4 differnt styles - VC8, VC 71, Standard and Fancy.
- Mouse middle click can be used to close tabs
- A function to add right click menu for tabs (simple as SetRightClickMenu)
- All styles has bottom style as well (they can be drawn in the bottom
of screen)
- An option to hide 'X' button or navigation buttons (separately)
- Gradient coloring of the selected tabs and border
- Support for drag 'n' drop of tabs, both in the same notebook or to
another notebook
- Possibility to have closing button on the active tab directly
- Support for disabled tabs
- Colours for active/inactive tabs, and captions
- Background of tab area can be painted in gradient (VC8 style only)
- Colourful tabs - a random gentle colour is generated for each new
tab (very cool, VC8 style only)

And much more.
"

The source code, demo and epydoc-generated documentation are available
in the usual place:

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

Or, if you prefer in italian:

http://xoomer.alice.it/infinity77/ita/freeware.html#flatnotebook

The widget has been tested on wxPython 2.6.3.3, with Python 2.4 on Windows XP.

A load of thanks goes to Eran that posted the code on wxWidgets forum.
Please let me know about bugs and request of improvements.

Happy wxPythoning!

Andrea.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Andrea Gavana wrote:

Kevin Ollivier wrote:

the three images have the following properties:

Image width: 16
Image height: 16
Horizontal resolution: 71
Vertical resolution: 71
Bit depth: 32
Nnumber of images: 1

So I don't see why Mac should complain about the differences between
the imagelist size and the PNGs size. They are the same.

Hmm... Maybe it is a problem with the png loader on wxMac and one of the images is getting a wrong size. I'll take a look when I integrate the modules into wx.lib.

Curious the error message:

"invalid bitmap size in wxImageList: this might work on this platform
but definitely won't under Windows"

Hahahahahaha, yeah, sure, how comes that it's actually *working* on Windows? :smiley:

Yeah, I've always thought that message was a crack-up, even when it was true.

···

On 10/3/06, Robin Dunn <robin@alldunn.com> wrote:

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

Hello NG,

    Robin, related to the message Alessandro posted, I see that in the
help about wx.Notebook.AddPage:

"The call to this function may generate the page changing events"

Uhm... how should I interpret that "may generate"? Platform dependent
behavior? May it happen that the notebook does not fire the page
changing event? And should this behavior be expected also for
InsertPage (there are no comments about page changing events in the
doc about InsertPage)?
I'll ask also to wxWidgets forum why FlatNotebook does not send events
for AddPage and DeletePage.

"Imagination Is The Only Weapon In The War Against Reality."

http://xoomer.virgilio.it/infinity77/

Andrea Gavana wrote:

Hello NG,

   Robin, related to the message Alessandro posted, I see that in the
help about wx.Notebook.AddPage:

"The call to this function may generate the page changing events"

Uhm... how should I interpret that "may generate"? Platform dependent
behavior?

Off the top of my head I interpret it as meaning that events will be sent if the current page is actually changed (such as when passing select=True.)

May it happen that the notebook does not fire the page
changing event?

I would expect it only if the page does not change.

And should this behavior be expected also for
InsertPage (there are no comments about page changing events in the
doc about InsertPage)?

I think so.

···

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

Hello NG,

Eran is working on a refactored version of FlatNotebook that will fix
the AddPage and DeletePage event firing problem and will have a nicer
implementation with Renderers instead of one big and 'if'-filled
OnPaint method. So, I would probably wait for his new version to come
out (and some time for me to translate the modifications) before
adding wxPython version of FlatNotebook to wx.lib. Is that ok Robin?

Andrea.

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

Hello Matthias,

Wow, this is just superb! You can drag around the individual pages like in
VC, the demo rocks. I have two little comments about this:

Thanks, I am glad you liked it :smiley:

1. If I drag a tab to change the tab order in a peculiar notebook, I
always have to drag it straight onto another tab. For example suppose
there's Tab1 Tab2 and I want to make it Tab2 Tab1, I could either drag
Tab2 on Tab1 or vice versa. It would be nice if you could extend this so
that I could drag Tab1 somewhere right of Tab2 (not exactly onto Tab2) to
move it to the last position. Or to drag Tab2 before Tab1 (to the left of
Tab1, very close to the screen border).

Try the latest version I just uploaded, it should do what you ask :smiley:

2. Have you thought about combining this with wx.aui? I think VC does the
same. Basically you can add new tabs to a notebook by dragging other
tabs/windows onto it. Is it perhaps already possible by making a bunch of
wx.aui panes, all containing FlatNotebooks? This would definately be one
of the coolest things in wxpython and something I really appreciate. It
would allow me to make my application work exactly like I wanted it to
work.

Well, I can not integrate directly wxAUI with FlatNotebook, but try
the attached file and let me know if you like it :smiley: . It requires
wxPython 2.7 latest pre-release and latest FlatNotebook, which you can
get from:

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

Just for your information, I am using a lot of the controls you wrote by
now. They're extremely useful for designing flexible, powerful and at the
same time even good looking applications. I can't think of any more
controls that you could write by now, honestly. Your work is basically the
icing on the (great) cake that's called wxPython for me. Thanks a lot!

Thanks for your comments, you are too kind :-D. It's a joy for me
coding in wxPython after all that years at work using Matlab GUIs
(Matlab (!!!!)).

Andrea.

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

AUI_FNB.py (3.32 KB)

Hello limodou,

I have fixed the 2 bugs you mentioned in the previous email and fixed
another weird behavior with the navigation buttons. I think that now
FlatNotebook is working Ok. If you want, you can try the latest
release at:

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

Please, let me know if you find anything strange :smiley:

Andrea.

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

Hello Hugh,

In the demo for the flat note book, if you select Edit | Use Bottom Tabs
immediately after opening the app, you get this exception:

Thanks for the report, fixed in the latest release.

Andrea.

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

Andrea Gavana wrote:

Hello NG,

Eran is working on a refactored version of FlatNotebook that will fix
the AddPage and DeletePage event firing problem and will have a nicer
implementation with Renderers instead of one big and 'if'-filled
OnPaint method. So, I would probably wait for his new version to come
out (and some time for me to translate the modifications) before
adding wxPython version of FlatNotebook to wx.lib. Is that ok Robin?

That's okay, do you have any indication of how long it might be? (We've given ourselves a fairly tight schedule to get through 2.7 and to a 2.8 release, so the sooner the better.)

···

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

bug report:

FlatNotebook.py 2305 undefined name "fullrect"

This time the repaint bug seems fixed, but the nav buttons bug is the
same, you can see the screen at the attatchment. The tab is not drawn
very well.

And the FlatNotebook.py is mix dos and unix return character, I think
you could convert them the same.

A suggestion:

the nav buttons seems a bit far, can you adjust them tightly?

···

On 10/4/06, Andrea Gavana <andrea.gavana@gmail.com> wrote:

Hello limodou,

I have fixed the 2 bugs you mentioned in the previous email and fixed
another weird behavior with the navigation buttons. I think that now
FlatNotebook is working Ok. If you want, you can try the latest
release at:

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

Please, let me know if you find anything strange :smiley:

Andrea.

--
I like python!
UliPad <<The Python Editor>>: UliPad - Woodpecker Wiki for CPUG
My Blog: http://www.donews.net/limodou

bug report:

FlatNotebook.py 2305 undefined name "fullrect"

Thanks, fixed.

This time the repaint bug seems fixed, but the nav buttons bug is the
same, you can see the screen at the attatchment. The tab is not drawn
very well.

I found the problem, FlatNotebook was drawing the 'X' button even if
the active tab was not visible...

I just uploaded the latest version, now it should work as expected...

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."

http://xoomer.virgilio.it/infinity77/