ANN-Revisited: NotebookCtrl For wxPython ;-)

Hello NG,

after the kind requests for bug fixes and features addition to NotebookCtrl made by Stani (the SPE editor author), I have implemented some more nice (for me) features in this control. This is what I have done:
  • Added the tab Drag And Drop Event (Stani’s request);

  • Added the possibility to hide the TabCtrl when only one tab is shown, thus maximizing the corresponding window in the NotebookCtrl (Stani request);

  • Added the possibility to change a tab image into the “Opera” style close button when mouse is hovering on the tab image (Stani request);

  • Popup menus on tabs (every tab can have its own menu, or no menu) (Richard Terry request).

Moreover, I have fixed all the bugs that Stani has found on Mac (I hope, I don’t have Mac so I can’t test it… I hope Stani will do it for me).

So, At the moment, NotebookCtrl features are:

  • Setting Individual Tab Font And Text Colour;
  • Images On Tabs (Line wx.Notebook);
  • Setting Individual Tab Colours;
  • Disabling/Enabling Individual Tabs (Also Visually Effective);
  • Drawing Of A Small Closing “X” At The Right Of Every Tab, That Enable The User
    To Close A Tab With A Mouse Click (Like eMule Tab Style);
  • Enabling Highlighted Tabs On Selection;
  • Drawing Focus Indicator In Each Tab (Like wx.Notebook);
  • Ctrl-Tab Keyboard Navigation Between Pages;
  • Tab With Animated Icons (Animation On Tabs);
  • Drag And Drop Tabs In NotebookCtrl;
  • Drag And Drop Event;
  • ToolTips On Individual Tabs, With Customizable ToolTip Time Popup And ToolTip
    Window Size For Individual Tabs;
  • Possibility To Hide The TabCtrl There Is Only One Tab (Thus Maximizing The
    Corresponding Window);
  • Possibility To Convert The Tab Image Into A Close Button While Mouse Is Hovering
    On The Tab Image;
  • Popup Menus On Tabs (Popup Menus Specific To Each Tab).

I have re-uploaded the new source code and the enhanced demo in the usual place:

http://xoomer.virgilio.it/infinity77/eng/freeware.html#notebookctrl

Or, if you prefer in italian :wink: :

http://xoomer.virgilio.it/infinity77/ita/freeware.html#notebookctrl

If it doesn’t bother anyone, I attach the source code and the demo also to this email.

I really welcome any comments, suggestions and ideas you may have, also reporting other platforms behavior (I’m on Windows 2000/XP, Python 2.4.1 and wxPython 2.6.1.1 prerelease).

Thanks for every comments, and sorry for the long post and for the attachment.

Andrea.

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

NotebookCtrl.zip (38.4 KB)

Thanks heaps, didn't realise you'd taken my request into account, and so
promptly, I'm impressed (as usual) with your efforts.

Regards

Richard Terry

···

On Thursday 08 December 2005 11:18, Andrea Gavana wrote:

Hello NG,

    after the kind requests for bug fixes and features addition to
NotebookCtrl made by Stani (the SPE editor author), I have implemented some
more nice (for me) features in this control. This is what I have done:

- Added the tab Drag And Drop Event (Stani's request);
- Added the possibility to hide the TabCtrl when only one tab is shown,
thus maximizing the corresponding window in the NotebookCtrl (Stani
request); - Added the possibility to change a tab image into the "Opera"
style close button when mouse is hovering on the tab image (Stani request);
- Popup menus on tabs (every tab can have its own menu, or no menu)
(Richard Terry request).

Moreover, I have fixed all the bugs that Stani has found on Mac (I hope, I
don't have Mac so I can't test it... I hope Stani will do it for me).

So, At the moment, NotebookCtrl features are:

- Setting Individual Tab Font And Text Colour;
- Images On Tabs (Line wx.Notebook);
- Setting Individual Tab Colours;
- Disabling/Enabling Individual Tabs (Also Visually Effective);
- Drawing Of A Small Closing "X" At The Right Of Every Tab, That Enable The
User To Close A Tab With A Mouse Click (Like eMule Tab Style);
- Enabling Highlighted Tabs On Selection;
- Drawing Focus Indicator In Each Tab (Like wx.Notebook);
- Ctrl-Tab Keyboard Navigation Between Pages;
- Tab With Animated Icons (Animation On Tabs);
- Drag And Drop Tabs In NotebookCtrl;
- Drag And Drop Event;
- ToolTips On Individual Tabs, With Customizable ToolTip Time Popup And
ToolTip Window Size For Individual Tabs;
- Possibility To Hide The TabCtrl There Is Only One Tab (Thus Maximizing
The Corresponding Window);
- Possibility To Convert The Tab Image Into A Close Button While Mouse Is
Hovering On The Tab Image;
- Popup Menus On Tabs (Popup Menus Specific To Each Tab).

I have re-uploaded the new source code and the enhanced demo in the usual
place:

http://xoomer.virgilio.it/infinity77/eng/freeware.html#notebookctrl

Or, if you prefer in italian :wink: :

http://xoomer.virgilio.it/infinity77/ita/freeware.html#notebookctrl

If it doesn't bother anyone, I attach the source code and the demo also to
this email.

I really welcome any comments, suggestions and ideas you may have, also
reporting other platforms behavior (I'm on Windows 2000/XP, Python 2.4.1
and wxPython 2.6.1.1 prerelease).

Thanks for every comments, and sorry for the long post and for the
attachment.

Andrea.

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

Hi

Oh Andrea is working again :slight_smile: (just joking)
Thanks a lot (really not joking)

- Drag And Drop Tabs In NotebookCtrl;

Is it possible to show an indicator, where the tab will be inserted?

And I've found a bug, when dragging a tab:
---snip---
Traceback (most recent call last):
  File "G:\persoenliches\Programmierung\Python\Web\NBC\NotebookCtrl.py", line 16
64, in OnMouseLeftUp
    newrange.append(pagerange[ii])
IndexError: list index out of range
---snap---

- Possibility To Convert The Tab Image Into A Close Button While Mouse Is Hovering
  On The Tab Image;

Hey that's a really nice feature. What do you think about - showing the
close button, when hovering the tab and not only the tab image?

cu boesi

···

Am 08.12.2005 01:18:41 schrieb Andrea Gavana:
--
No matter where you are.
Everyone is always connected.

Hello Alexander & NG,

Oh Andrea is working again :slight_smile: (just joking)

Yeah, I was in Egypt till tuesday :wink:

Thanks a lot (really not joking)

Thanks to you, for your prompt suggestions and bug reports.

- Drag And Drop Tabs In NotebookCtrl;

Is it possible to show an indicator, where the tab will be inserted?

I am working on it at the moment... I just don't have a clear idea on how to
do it nicely...

And I've found a bug, when dragging a tab:
---snip---
Traceback (most recent call last):
File "G:\persoenliches\Programmierung\Python\Web\NBC\NotebookCtrl.py",

line 16

64, in OnMouseLeftUp
   newrange.append(pagerange[ii])
IndexError: list index out of range
---snap---

Mhm... I am unable to replicate it... do you remember what you have done to
recreate it? However, I found a bad bug on Drag And Drop tabs, now it should
be fixed. I have re-uploaded the source and the demo in:

http://xoomer.virgilio.it/infinity77/eng/freeware.html#notebookctrl

Or, if you prefer in italian :wink: :

http://xoomer.virgilio.it/infinity77/ita/freeware.html#notebookctrl

- Possibility To Convert The Tab Image Into A Close Button While Mouse Is

Hovering

  On The Tab Image;

Hey that's a really nice feature. What do you think about - showing the
close button, when hovering the tab and not only the tab image?

Mhm... that wouldn't be very difficult... even if managing different
options/user customization is becoming hard, I will think about it, however.

Thanks a lot for all your suggestions.

Andrea.

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

Hi

When moving the mouse with the right button pressed, the cursor changes
but the tabs doesn't get dragged.

>And I've found a bug, when dragging a tab:
>---snip---
>Traceback (most recent call last):
> File "G:\persoenliches\Programmierung\Python\Web\NBC\NotebookCtrl.py", line 16
>64, in OnMouseLeftUp
> newrange.append(pagerange[ii])
>IndexError: list index out of range
>---snap---

Mhm... I am unable to replicate it... do you remember what you have done to
recreate it? However, I found a bad bug on Drag And Drop tabs, now it should
be fixed. I have re-uploaded the source and the demo in:

I can't replicate exact this bug, but another one.
When dragging the tabs very fast, I get this error:
---snip---
Traceback (most recent call last):
  File "G:\persoenliches\Programmierung\Python\Web\NBC\NotebookCtrl.py", line 16
18, in OnMouseLeftUp
    text = self.GetPageText(self._tabID)
  File "G:\persoenliches\Programmierung\Python\Web\NBC\NotebookCtrl.py", line 60
2, in GetPageText
    raise "\nERROR: Invalid Notebook Page In GetPageText: (" + str(nPage) + ")"

ERROR: Invalid Notebook Page In GetPageText: (-1)
---snap---

In the old version, there was a bug, when moving a tab to the last
position. But this works now.

cu boesi

···

Am 08.12.2005 11:05:42 schrieb Andrea Gavana:
--

...schlafen ist sowieso ungesund...
           .-==Police Academy I==-.

Hello Alexander & NG,

When moving the mouse with the right button pressed, the cursor changes
but the tabs doesn't get dragged.

Fixed. Now it should work as expected, noting that DnD is allowed only with
left mouse button.

I can't replicate exact this bug, but another one.
When dragging the tabs very fast, I get this error:
---snip---
Traceback (most recent call last):
File "G:\persoenliches\Programmierung\Python\Web\NBC\NotebookCtrl.py",

line 16

18, in OnMouseLeftUp
   text = self.GetPageText(self._tabID)
File "G:\persoenliches\Programmierung\Python\Web\NBC\NotebookCtrl.py",

line 60

2, in GetPageText
   raise "\nERROR: Invalid Notebook Page In GetPageText: (" + str(nPage) +

")"

ERROR: Invalid Notebook Page In GetPageText: (-1)
---snap---

Yes, I think I have fixed also this one.

In the old version, there was a bug, when moving a tab to the last
position. But this works now.

I know :wink: I have noticed it this morning, and I have corrected it. Thanks a
lot for your prompt testing, I really appreciate it.
I have re-uploaded the new version in the usual place:

http://xoomer.virgilio.it/infinity77/eng/freeware.html#notebookctrl

Or, if you prefer in italian :wink: :

http://xoomer.virgilio.it/infinity77/ita/freeware.html#notebookctrl

Thank you a lot.

Andrea.

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

Andrea Gavana wrote:

Hello NG,

Hello Andrea

Or, if you prefer in italian :wink: :

http://xoomer.virgilio.it/infinity77/ita/freeware.html#notebookctrl

Yes, why not :slight_smile:

I found a bug:
open the demo, check the "Animate Tab Image" and check "show image on
tab" and see the error:

Traceback (most recent call last):
   File "U:\wx_text\NotebookCtrl\NotebookCtrl.py", line 1221, in AnimateTab
     myindx = images.index(indx)
ValueError: list.index(x): x not in list

Michele

Hello Michele & NG,

> Or, if you prefer in italian :wink: :
>
> http://xoomer.virgilio.it/infinity77/ita/freeware.html#notebookctrl
>

Yes, why not :slight_smile:

;-))))))))

I found a bug:
open the demo, check the "Animate Tab Image" and check "show image on
tab" and see the error:

Traceback (most recent call last):
   File "U:\wx_text\NotebookCtrl\NotebookCtrl.py", line 1221, in

AnimateTab

     myindx = images.index(indx)
ValueError: list.index(x): x not in list

Yes, this is because you choose "Animate Tabs" before choosing "Show Images
On Tabs". Noting that tab images are taken randomly every time you
check/uncheck the "Show Images On Tabs". It is an "error" in the Demo, not
in NotebookCtrl itself. If you choose:

1) "Show Images On Tabs" *before* checking "Animate Tabs";

*or*

2) "Animate Tabs" without checking "Show Images On Tabs" after

Everything should work fine... I should correct this behavior, but I'm
trying to figure out how to best doing it... and at the moment, I am waiting
for bugs/features regarding NotebookCtrl itself (especially from Stani...
where are you, Stani??? :wink: ). However, thanks for the bug report, is noted
and I will fix it as soon as NotebookCtrl works smoothly.

Thank you a lot.

Andrea.

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

Hi

neu-3.gif

···

Am 08.12.2005 13:43:24 schrieb Andrea Gavana:

[corrected bugs]

One more optical thing
When the style NC_BOTTOM is used, the tabs should "hang" on the panel
and the active tab should open to the top. Mmmh sorry I can't explain it
better, but it should look like the normal Notebook when using NB_BOTTOM.

Well maybe the attached image can explain what I mean.

cu boesi & thanks for your great work
--

...schlafen ist sowieso ungesund...
           .-==Police Academy I==-.