Empty list or deleting last item in TabularEditor

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Empty list or deleting last item in TabularEditor

Stephan Helma
Hi all,

I have an annoying problem with the TabularEditor. I display a list of
items in a TabularEditor. This list depends on other variables and can
be empty. Whenever I set this list to an empty list the GUI is not updated.

With the code below you can test this behaviour:

- Remove one item ("Remove last item") after another. When only "0 |
zero" is displayed and you remove this last item (ending with an empty
list) the GUI does not reflect this change.

- When you remove all items at once ("Clear the list") the GUI does not
reflect this change.

How can I get the GUI to update accordingly?

I use Python 2.7.2, wxPython 2.8.12.1 and EnthoughtToolSuite-4.0.0.

Thanks for your help.
Stephan

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

items_problem.py (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Empty list or deleting last item in TabularEditor

Robert Kern
On Wed, Nov 23, 2011 at 3:01 PM, Stephan Helma <[hidden email]> wrote:

> Hi all,
>
> I have an annoying problem with the TabularEditor. I display a list of items
> in a TabularEditor. This list depends on other variables and can be empty.
> Whenever I set this list to an empty list the GUI is not updated.
>
> With the code below you can test this behaviour:
>
> - Remove one item ("Remove last item") after another. When only "0 | zero"
> is displayed and you remove this last item (ending with an empty list) the
> GUI does not reflect this change.
>
> - When you remove all items at once ("Clear the list") the GUI does not
> reflect this change.
>
> How can I get the GUI to update accordingly?
>
> I use Python 2.7.2, wxPython 2.8.12.1 and EnthoughtToolSuite-4.0.0.

Hmm. Works fine for me with the git checkouts of ETS on both Qt and wx.

--
Robert Kern
Enthought
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Empty list or deleting last item in TabularEditor

Stephan Helma
In reply to this post by Stephan Helma
On Wed, Nov 23, 2011 at 3:01 PM, Stephan Helma <[hidden email]> wrote:
 >> Hi all,
 >>
 >> I have an annoying problem with the TabularEditor. I display a list
of items
 >> in a TabularEditor. This list depends on other variables and can be
empty.
 >> Whenever I set this list to an empty list the GUI is not updated.
 >>
 >> With the code below you can test this behaviour:
 >>
 >> - Remove one item ("Remove last item") after another. When only "0 |
zero"
 >> is displayed and you remove this last item (ending with an empty
list) the
 >> GUI does not reflect this change.
 >>
 >> - When you remove all items at once ("Clear the list") the GUI does not
 >> reflect this change.
 >
 >> How can I get the GUI to update accordingly?
 >>
 >> I use Python 2.7.2, wxPython 2.8.12.1 and EnthoughtToolSuite-4.0.0.

 > Hmm. Works fine for me with the git checkouts of ETS on both Qt and wx.
 >
 > -- Robert Kern Enthought

Hmm, well. Not for me. I made a quick screencast to show the behaviour I
experience. Do you need more information about the System? I forgot to
mention that I work on Windows XP.

Thanks for your help.

Stephan

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Empty list or deleting last item in TabularEditor

Robert Kern
On Wed, Nov 23, 2011 at 3:34 PM, Stephan Helma <[hidden email]> wrote:

> On Wed, Nov 23, 2011 at 3:01 PM, Stephan Helma <[hidden email]> wrote:
>>> Hi all,
>>>
>>> I have an annoying problem with the TabularEditor. I display a list of
>>> items
>>> in a TabularEditor. This list depends on other variables and can be
>>> empty.
>>> Whenever I set this list to an empty list the GUI is not updated.
>>>
>>> With the code below you can test this behaviour:
>>>
>>> - Remove one item ("Remove last item") after another. When only "0 |
>>> zero"
>>> is displayed and you remove this last item (ending with an empty list)
>>> the
>>> GUI does not reflect this change.
>>>
>>> - When you remove all items at once ("Clear the list") the GUI does not
>>> reflect this change.
>>
>>> How can I get the GUI to update accordingly?
>>>
>>> I use Python 2.7.2, wxPython 2.8.12.1 and EnthoughtToolSuite-4.0.0.
>
>> Hmm. Works fine for me with the git checkouts of ETS on both Qt and wx.
>>
>> -- Robert Kern Enthought
>
> Hmm, well. Not for me. I made a quick screencast to show the behaviour I
> experience. Do you need more information about the System? I forgot to
> mention that I work on Windows XP.

Do you have a link to the screencast? I don't think the OS would be
relevant, but I'm on OS X.

--
Robert Kern
Enthought
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Empty list or deleting last item in TabularEditor

Jonathan March
In reply to this post by Stephan Helma
On Wed, Nov 23, 2011 at 9:34 AM, Stephan Helma <[hidden email]> wrote:

> On Wed, Nov 23, 2011 at 3:01 PM, Stephan Helma <[hidden email]> wrote:
> >> Hi all,
> >>
> >> I have an annoying problem with the TabularEditor. I display a list of
> items
> >> in a TabularEditor. This list depends on other variables and can be
> empty.
> >> Whenever I set this list to an empty list the GUI is not updated.
> >>
> >> With the code below you can test this behaviour:
> >>
> >> - Remove one item ("Remove last item") after another. When only "0 |
> zero"
> >> is displayed and you remove this last item (ending with an empty list)
> the
> >> GUI does not reflect this change.
> >>
> >> - When you remove all items at once ("Clear the list") the GUI does not
> >> reflect this change.
> >
> >> How can I get the GUI to update accordingly?
> >>
> >> I use Python 2.7.2, wxPython 2.8.12.1 and EnthoughtToolSuite-4.0.0.
>
> > Hmm. Works fine for me with the git checkouts of ETS on both Qt and wx.
> >
> > -- Robert Kern Enthought
>
> Hmm, well. Not for me. I made a quick screencast to show the behaviour I
> experience. Do you need more information about the System? I forgot to
> mention that I work on Windows XP.



Another data point:
Works correctly for me on Windows 7 with wx, running either from master
(development) source or from ETS 4.0.0 source.

Jonathan
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Empty list or deleting last item in TabularEditor

Stephan Helma
In reply to this post by Stephan Helma
On 23/11/2011 18:00, [hidden email] wrote:

> On Wed, Nov 23, 2011 at 3:34 PM, Stephan Helma <[hidden email]> wrote:
>> On Wed, Nov 23, 2011 at 3:01 PM, Stephan Helma <[hidden email]> wrote:
>>>> Hi all,
>>>>
>>>> I have an annoying problem with the TabularEditor. I display a list of
>>>> items
>>>> in a TabularEditor. This list depends on other variables and can be
>>>> empty.
>>>> Whenever I set this list to an empty list the GUI is not updated.
>>>>
>>>> With the code below you can test this behaviour:
>>>>
>>>> - Remove one item ("Remove last item") after another. When only "0 |
>>>> zero"
>>>> is displayed and you remove this last item (ending with an empty list)
>>>> the
>>>> GUI does not reflect this change.
>>>>
>>>> - When you remove all items at once ("Clear the list") the GUI does not
>>>> reflect this change.
>>>> How can I get the GUI to update accordingly?
>>>>
>>>> I use Python 2.7.2, wxPython 2.8.12.1 and EnthoughtToolSuite-4.0.0.
>>> Hmm. Works fine for me with the git checkouts of ETS on both Qt and wx.
>>>
>>> -- Robert Kern Enthought
>> Hmm, well. Not for me. I made a quick screencast to show the behaviour I
>> experience. Do you need more information about the System? I forgot to
>> mention that I work on Windows XP.
> Do you have a link to the screencast? I don't think the OS would be
> relevant, but I'm on OS X.

Sorry, I attached the screencast to my email but somehow it did not come
through. You can find it here: http://files.plusplus.at/

Stephan
--
*** IMPORTANT INFORMATION/DISCLAIMER ***
This email is intended for the use of the individual addressee(s)
named  above  and  may  contain information that is confidential,
privileged or unsuitable for overly  sensitive persons  with  low
self-esteem, no  sense of humour or irrational religious beliefs.
If  you  are  not  the  intended  recipient,  any  dissemination,
distribution or copying of  this  email is not authorised (either
explicitly or implicitly) and  constitutes  an irritating  social
faux  pas.  Unless  the  word absquatulation has been used in its
correct context somewhere other than in this warning, it does not
have any legal or grammatical use and may be ignored.  No animals
were  harmed in  the transmission  of  this email,  although  the
yorkshire  terrier  next  door is living on borrowed time, let me
tell you. Those of you with an overwhelming fear  of  the unknown
will  be  gratified  to  learn  that  there is no hidden  message
revealed by reading this  warning  backwards, so just ignore that
Alert  Notice  from  Microsoft:  However,  by  pouring a complete
circle of salt around yourself and your  computer  you can ensure
that no harm befalls you and your pets. If you have received this
email in error, please  add some nutmeg and egg whites  and place
it in a warm oven for 40 minutes.  Whisk briefly and let it stand
for 2 hours before icing.
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Empty list or deleting last item in TabularEditor

Adam Hughes
Are you sure your clear the list button is deleting all the items?  If you
print the value of the trait to the screen, is it an empty list?

On Thu, Nov 24, 2011 at 10:55 AM, Stephan Helma <[hidden email]> wrote:

> On 23/11/2011 18:00, [hidden email] wrote:
>
> > On Wed, Nov 23, 2011 at 3:34 PM, Stephan Helma <[hidden email]>
> wrote:
> >> On Wed, Nov 23, 2011 at 3:01 PM, Stephan Helma <[hidden email]>
> wrote:
> >>>> Hi all,
> >>>>
> >>>> I have an annoying problem with the TabularEditor. I display a list of
> >>>> items
> >>>> in a TabularEditor. This list depends on other variables and can be
> >>>> empty.
> >>>> Whenever I set this list to an empty list the GUI is not updated.
> >>>>
> >>>> With the code below you can test this behaviour:
> >>>>
> >>>> - Remove one item ("Remove last item") after another. When only "0 |
> >>>> zero"
> >>>> is displayed and you remove this last item (ending with an empty list)
> >>>> the
> >>>> GUI does not reflect this change.
> >>>>
> >>>> - When you remove all items at once ("Clear the list") the GUI does
> not
> >>>> reflect this change.
> >>>> How can I get the GUI to update accordingly?
> >>>>
> >>>> I use Python 2.7.2, wxPython 2.8.12.1 and EnthoughtToolSuite-4.0.0.
> >>> Hmm. Works fine for me with the git checkouts of ETS on both Qt and wx.
> >>>
> >>> -- Robert Kern Enthought
> >> Hmm, well. Not for me. I made a quick screencast to show the behaviour I
> >> experience. Do you need more information about the System? I forgot to
> >> mention that I work on Windows XP.
> > Do you have a link to the screencast? I don't think the OS would be
> > relevant, but I'm on OS X.
>
> Sorry, I attached the screencast to my email but somehow it did not come
> through. You can find it here: http://files.plusplus.at/
>
> Stephan
> --
> *** IMPORTANT INFORMATION/DISCLAIMER ***
> This email is intended for the use of the individual addressee(s)
> named  above  and  may  contain information that is confidential,
> privileged or unsuitable for overly  sensitive persons  with  low
> self-esteem, no  sense of humour or irrational religious beliefs.
> If  you  are  not  the  intended  recipient,  any  dissemination,
> distribution or copying of  this  email is not authorised (either
> explicitly or implicitly) and  constitutes  an irritating  social
> faux  pas.  Unless  the  word absquatulation has been used in its
> correct context somewhere other than in this warning, it does not
> have any legal or grammatical use and may be ignored.  No animals
> were  harmed in  the transmission  of  this email,  although  the
> yorkshire  terrier  next  door is living on borrowed time, let me
> tell you. Those of you with an overwhelming fear  of  the unknown
> will  be  gratified  to  learn  that  there is no hidden  message
> revealed by reading this  warning  backwards, so just ignore that
> Alert  Notice  from  Microsoft:  However,  by  pouring a complete
> circle of salt around yourself and your  computer  you can ensure
> that no harm befalls you and your pets. If you have received this
> email in error, please  add some nutmeg and egg whites  and place
> it in a warm oven for 40 minutes.  Whisk briefly and let it stand
> for 2 hours before icing.
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Empty list or deleting last item in TabularEditor

Stephan Helma
In reply to this post by Stephan Helma
On 24/11/2011 18:31, Adam Hughes wrote:

Hi,

> Are you sure your clear the list button is deleting all the items?  If you
> print the value of the trait to the screen, is it an empty list?

Yes, I am quite sure. Just add the following lines to my example and you
will see that the list indeed does get empty:

     @on_trait_change('items,items_item')
     def _items_handler(self):
         """
         Print the list.

         """
         print('CHANGED:', self.items)
         return

Robert, could you download the screencast?

Stephan

> On Thu, Nov 24, 2011 at 10:55 AM, Stephan Helma <[hidden email]> wrote:
>
>> On 23/11/2011 18:00, [hidden email] wrote:
>>
>>> On Wed, Nov 23, 2011 at 3:34 PM, Stephan Helma <[hidden email]>
>> wrote:
>>>> On Wed, Nov 23, 2011 at 3:01 PM, Stephan Helma <[hidden email]>
>> wrote:
>>>>>> Hi all,
>>>>>>
>>>>>> I have an annoying problem with the TabularEditor. I display a list of
>>>>>> items
>>>>>> in a TabularEditor. This list depends on other variables and can be
>>>>>> empty.
>>>>>> Whenever I set this list to an empty list the GUI is not updated.
>>>>>>
>>>>>> With the code below you can test this behaviour:
>>>>>>
>>>>>> - Remove one item ("Remove last item") after another. When only "0 |
>>>>>> zero"
>>>>>> is displayed and you remove this last item (ending with an empty list)
>>>>>> the
>>>>>> GUI does not reflect this change.
>>>>>>
>>>>>> - When you remove all items at once ("Clear the list") the GUI does
>> not
>>>>>> reflect this change.
>>>>>> How can I get the GUI to update accordingly?
>>>>>>
>>>>>> I use Python 2.7.2, wxPython 2.8.12.1 and EnthoughtToolSuite-4.0.0.
>>>>> Hmm. Works fine for me with the git checkouts of ETS on both Qt and wx.
>>>>>
>>>>> -- Robert Kern Enthought
>>>> Hmm, well. Not for me. I made a quick screencast to show the behaviour I
>>>> experience. Do you need more information about the System? I forgot to
>>>> mention that I work on Windows XP.
>>> Do you have a link to the screencast? I don't think the OS would be
>>> relevant, but I'm on OS X.
>> Sorry, I attached the screencast to my email but somehow it did not come
>> through. You can find it here: http://files.plusplus.at/
>>
>> Stephan
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Empty list or deleting last item in TabularEditor

Robert Kern
On Tue, Nov 29, 2011 at 10:18 AM, Stephan Helma <[hidden email]> wrote:

> Robert, could you download the screencast?

Yes. I'm afraid that I don't see that behavior. Can you make the View
resizable, and then change the size of the window after it fails to
update? It is possible that there is a missing request to repaint the
control. I am using wxPython 2.8.10.1 while you are using 2.8.12.1, so
that might be the key difference.

--
Robert Kern
Enthought
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Empty list or deleting last item in TabularEditor

Stephan Helma
In reply to this post by Stephan Helma
On 29/11/2011 10:27, Robert Kern wrote:
> On Tue, Nov 29, 2011 at 10:18 AM, Stephan Helma <[hidden email]> wrote:

Dear Robert,

>> Robert, could you download the screencast?
> Yes. I'm afraid that I don't see that behavior. Can you make the View
> resizable, and then change the size of the window after it fails to
> update? It is possible that there is a missing request to repaint the
> control. I am using wxPython 2.8.10.1 while you are using 2.8.12.1, so
> that might be the key difference.

Yes, that's it! When I resize the window it gets updated and the last
item disappears.

Now the question of a workaround arises:

1. Is it possible to request a redraw from let's say a handler for items
and items_item? This would keep me from fiddling with the source.

2. Where would I have to add the missing request to repaint?

Thanks for your help.
Stephan
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Empty list or deleting last item in TabularEditor

Robert Kern
On Tue, Nov 29, 2011 at 10:48 AM, Stephan Helma <[hidden email]> wrote:

> On 29/11/2011 10:27, Robert Kern wrote:
>> On Tue, Nov 29, 2011 at 10:18 AM, Stephan Helma <[hidden email]> wrote:
>
> Dear Robert,
>
>>> Robert, could you download the screencast?
>> Yes. I'm afraid that I don't see that behavior. Can you make the View
>> resizable, and then change the size of the window after it fails to
>> update? It is possible that there is a missing request to repaint the
>> control. I am using wxPython 2.8.10.1 while you are using 2.8.12.1, so
>> that might be the key difference.
>
> Yes, that's it! When I resize the window it gets updated and the last
> item disappears.
>
> Now the question of a workaround arises:
>
> 1. Is it possible to request a redraw from let's say a handler for items
> and items_item? This would keep me from fiddling with the source.

By the way, it would be 'items_items', not 'items_item'. In any case,
Handlers have access to the actual UI toolkit widgets.


class ItemsProblemHandler(Handler):
    def object_items_changed(self, info):
        self.bug_wx_workaround_refresh(info)
    def object_items_items_changed(self, info):
        self.bug_wx_workaround_refresh(info)
    def bug_wx_workaround_refresh(self, info):
        # wx HACK
        # With some work, you can find the more precise widget to refresh.
        # Here, we just refresh the whole page.
        info.ui.control.Refresh(False)

> 2. Where would I have to add the missing request to repaint?

In traitsui/wx/tabular_editor.py, in the update_editor() method. There
is some suspicious-looking code there:

    def update_editor ( self ):
        """ Updates the editor when the object trait changes externally to the
            editor.
        """
        control = self.control
        n       = self.adapter.len( self.object, self.name )
        top     = control.GetTopItem()
        pn      = control.GetCountPerPage()
        bottom = min(top + pn - 1, n)

        control.SetItemCount( n )

        if self._update_visible:
            control.RefreshItems( 0, n-1 )
            self._update_visible = False


When n==0, this will call control.RefreshItems(0, -1). Perhaps wx
changed the way the ListCtrl handles that case in wx 2.8.12. It's
likely that it just happened to work in previous versions and that we
should do something special when the number of items is 0.

--
Robert Kern
Enthought
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Empty list or deleting last item in TabularEditor

Stephan Helma
In reply to this post by Stephan Helma
On 29/11/2011 13:37, Robert Kern wrote:

> On Tue, Nov 29, 2011 at 10:48 AM, Stephan Helma <[hidden email]> wrote:
>> On 29/11/2011 10:27, Robert Kern wrote:
>>> On Tue, Nov 29, 2011 at 10:18 AM, Stephan Helma <[hidden email]> wrote:
>> Dear Robert,
>>
>> Now the question of a workaround arises:
>>
>> 1. Is it possible to request a redraw from let's say a handler for items
>> and items_item? This would keep me from fiddling with the source.
> By the way, it would be 'items_items', not 'items_item'. In any case,
> Handlers have access to the actual UI toolkit widgets.
>
>
> class ItemsProblemHandler(Handler):
>     def object_items_changed(self, info):
>         self.bug_wx_workaround_refresh(info)
>     def object_items_items_changed(self, info):
>         self.bug_wx_workaround_refresh(info)
>     def bug_wx_workaround_refresh(self, info):
>         # wx HACK
>         # With some work, you can find the more precise widget to refresh.
>         # Here, we just refresh the whole page.
>         info.ui.control.Refresh(False)
>
>> 2. Where would I have to add the missing request to repaint?
> In traitsui/wx/tabular_editor.py, in the update_editor() method. There
> is some suspicious-looking code there:
>
>     def update_editor ( self ):
>         """ Updates the editor when the object trait changes externally to the
>             editor.
>         """
>         control = self.control
>         n       = self.adapter.len( self.object, self.name )
>         top     = control.GetTopItem()
>         pn      = control.GetCountPerPage()
>         bottom = min(top + pn - 1, n)
>
>         control.SetItemCount( n )
>
>         if self._update_visible:
>             control.RefreshItems( 0, n-1 )
>             self._update_visible = False
>
>
> When n==0, this will call control.RefreshItems(0, -1). Perhaps wx
> changed the way the ListCtrl handles that case in wx 2.8.12. It's
> likely that it just happened to work in previous versions and that we
> should do something special when the number of items is 0.

Thanks, Robert. First workaround works for me!

In Traits version before 4 I could get the version of Traits with:
        import enthought.traits.api as Traits
        Traits.__version__

Since version 4 this seems to have vanished. Is there another way to get
the actual version of Traits?

Thanks Stephan
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Empty list or deleting last item in TabularEditor

Robert Kern
On Wed, Nov 30, 2011 at 10:12 AM, Stephan Helma <[hidden email]> wrote:

> On 29/11/2011 13:37, Robert Kern wrote:
>
>> On Tue, Nov 29, 2011 at 10:48 AM, Stephan Helma <[hidden email]> wrote:
>>> On 29/11/2011 10:27, Robert Kern wrote:
>>>> On Tue, Nov 29, 2011 at 10:18 AM, Stephan Helma <[hidden email]> wrote:
>>> Dear Robert,
>>>
>>> Now the question of a workaround arises:
>>>
>>> 1. Is it possible to request a redraw from let's say a handler for items
>>> and items_item? This would keep me from fiddling with the source.
>> By the way, it would be 'items_items', not 'items_item'. In any case,
>> Handlers have access to the actual UI toolkit widgets.
>>
>>
>> class ItemsProblemHandler(Handler):
>>     def object_items_changed(self, info):
>>         self.bug_wx_workaround_refresh(info)
>>     def object_items_items_changed(self, info):
>>         self.bug_wx_workaround_refresh(info)
>>     def bug_wx_workaround_refresh(self, info):
>>         # wx HACK
>>         # With some work, you can find the more precise widget to refresh.
>>         # Here, we just refresh the whole page.
>>         info.ui.control.Refresh(False)
>>
>>> 2. Where would I have to add the missing request to repaint?
>> In traitsui/wx/tabular_editor.py, in the update_editor() method. There
>> is some suspicious-looking code there:
>>
>>     def update_editor ( self ):
>>         """ Updates the editor when the object trait changes externally to the
>>             editor.
>>         """
>>         control = self.control
>>         n       = self.adapter.len( self.object, self.name )
>>         top     = control.GetTopItem()
>>         pn      = control.GetCountPerPage()
>>         bottom = min(top + pn - 1, n)
>>
>>         control.SetItemCount( n )
>>
>>         if self._update_visible:
>>             control.RefreshItems( 0, n-1 )
>>             self._update_visible = False
>>
>>
>> When n==0, this will call control.RefreshItems(0, -1). Perhaps wx
>> changed the way the ListCtrl handles that case in wx 2.8.12. It's
>> likely that it just happened to work in previous versions and that we
>> should do something special when the number of items is 0.
>
> Thanks, Robert. First workaround works for me!
>
> In Traits version before 4 I could get the version of Traits with:
>        import enthought.traits.api as Traits
>        Traits.__version__
>
> Since version 4 this seems to have vanished. Is there another way to get
> the actual version of Traits?

Version 4 refactored the package names. We no longer use the
enthought.* namespace. So now you would do:

   import traits.api as Traits
   print Traits.__version__

We do provide a set of proxy packages that provide these for backwards
compatibility. Unfortunately, they are mostly simple "from real.module
import *", so they miss _underscored names like __version__ until
someone notices and we put in specific imports for them as needed.

--
Robert Kern
Enthought
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

[chaco] QuiverPlot issues...

Fred
Hi all,

I have a question and a bug report, using QuiverPlot.

First, is it possible to map vectors size to data, ie when I zoom
in/out, quiver have constant size. I would prefer their size follows
zooming.

Second, when I zoom in, again & again, using quiver.py example, I get
this backtrace:

Traceback (most recent call last):
   File
"/usr/local/lib/python2.7/dist-packages/enable-4.0.1-py2.7-linux-x86_64.egg/enable/abstract_window.py",
line 413, in _paint
     self.component.draw(gc, view_bounds=(0, 0, size[0], size[1]))
   File
"/usr/local/lib/python2.7/dist-packages/enable-4.0.1-py2.7-linux-x86_64.egg/enable/component.py",
line 427, in draw
     self._draw(gc, view_bounds, mode)
   File
"/usr/local/lib/python2.7/dist-packages/enable-4.0.1-py2.7-linux-x86_64.egg/enable/component.py",
line 757, in _draw
     self._dispatch_draw(layer, gc, view_bounds, mode)
   File
"/usr/local/lib/python2.7/dist-packages/enable-4.0.1-py2.7-linux-x86_64.egg/enable/container.py",
line 327, in _dispatch_draw
     component._dispatch_draw(layer, gc, new_bounds, mode)
   File
"/usr/local/lib/python2.7/dist-packages/enable-4.0.1-py2.7-linux-x86_64.egg/enable/component.py",
line 777, in _dispatch_draw
     handler(gc, view_bounds, mode)
   File
"/usr/local/lib/python2.7/dist-packages/chaco-4.1.0-py2.7-linux-x86_64.egg/chaco/base_xy_plot.py",
line 462, in _draw_plot
     self._draw_component(gc, view_bounds, mode)
   File
"/usr/local/lib/python2.7/dist-packages/chaco-4.1.0-py2.7-linux-x86_64.egg/chaco/base_xy_plot.py",
line 470, in _draw_component
     self._render(gc, pts)
   File
"/usr/local/lib/python2.7/dist-packages/chaco-4.1.0-py2.7-linux-x86_64.egg/chaco/quiverplot.py",
line 80, in _render
     ends = points + self._cached_vector_data
ValueError: shape mismatch: objects cannot be broadcast to a single shape


PS : I use fresh update from ETS repo.



TIA.


Cheers,

--
Fred
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev