A bit of difficulty in Andrea's NotebookCtrl

Howdy all;
I'm using Andrea Gavana's awesome NotebookCtrl and running into an odd
and intermittent problem. It doesn't stop anything from working, but
it throws the exception to stderr, and I'd like to track it down.
Unfortunately I haven't found an event or action that can force it to
happen with any predictability. I instantiate a large number of
notebooks when the app loads, and I believe it happens during that
process - however it's rare, and possibly related to mouse movement.
Again though, I haven't been able to make it happen when desired.
Here's the traceback:

Traceback (most recent call last):
  File "X:\wwwRoot\vcsibeta\client_app\_srcfiles\_python\NotebookCtrl.py", line
2740, in OnMouseMotion
    self._insidetab = self.GetInsideTab(pt)
  File "X:\wwwRoot\vcsibeta\client_app\_srcfiles\_python\NotebookCtrl.py", line
2462, in GetInsideTab
    for tabs in self._tabrect:
AttributeError: 'TabCtrl' object has no attribute '_tabrect'
Traceback (most recent call last):
  File "X:\wwwRoot\vcsibeta\client_app\_srcfiles\_python\NotebookCtrl.py", line
2740, in OnMouseMotion
    self._insidetab = self.GetInsideTab(pt)
  File "X:\wwwRoot\vcsibeta\client_app\_srcfiles\_python\NotebookCtrl.py", line
2462, in GetInsideTab
    for tabs in self._tabrect:
AttributeError: 'TabCtrl' object has no attribute '_tabrect'

Thanks, and any thoughts are appreciated.

···

--
-----------------------------
  e y e p u l p
-----------------------------

Hi EyePulp.

I'm using Andrea Gavana's awesome NotebookCtrl and running into an odd
and intermittent problem. It doesn't stop anything from working, but
it throws the exception to stderr, and I'd like to track it down.
Unfortunately I haven't found an event or action that can force it to
happen with any predictability. I instantiate a large number of
notebooks when the app loads, and I believe it happens during that
process - however it's rare, and possibly related to mouse movement.
Again though, I haven't been able to make it happen when desired.
Here's the traceback:

Traceback (most recent call last):
File "X:\wwwRoot\vcsibeta\client_app\_srcfiles\_python\NotebookCtrl.py", line
2740, in OnMouseMotion
   self._insidetab = self.GetInsideTab(pt)
File "X:\wwwRoot\vcsibeta\client_app\_srcfiles\_python\NotebookCtrl.py", line
2462, in GetInsideTab
   for tabs in self._tabrect:
AttributeError: 'TabCtrl' object has no attribute '_tabrect'
Traceback (most recent call last):
File "X:\wwwRoot\vcsibeta\client_app\_srcfiles\_python\NotebookCtrl.py", line
2740, in OnMouseMotion
   self._insidetab = self.GetInsideTab(pt)
File "X:\wwwRoot\vcsibeta\client_app\_srcfiles\_python\NotebookCtrl.py", line
2462, in GetInsideTab
   for tabs in self._tabrect:
AttributeError: 'TabCtrl' object has no attribute '_tabrect'

Yes, I remember seeing this error few times... the main problem is to
be able to reproduce it, and I had no success till now. I didn't know
there still was someone using NotebookCtrl, as far as I know wxPython
programmers have switched to FlatNotebook or wxAuiNotebook. Both of
them are nicer (in terms of implementation and visual appearance), but
in some cases NotebookCtrl is more powerful (i.e., tabs on the
left/right, page tiling, pages hiding etc...).
It would be tough to fix it without having a runnable sample that
crashes it, so my best suggestion for the moment is to check if
TabCtrl has an attribute called "_tabrect" or not inside
OnMouseMotion:

def OnMouseMotion(self, event):

    # Whatever here
    if not hasattr(self, "_tabrect"):
        event.Skip()
        return
    # Whatever here

Andrea.

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

···

On 1/25/07, EyePulp <eyepulp@eyepulp.net> wrote: