HSplit and tabbed groups

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

HSplit and tabbed groups

Brennan Williams
I think this might be a bug or I'm reading the documentation
incorrectly. I've often had a problem with getting HSplit to work when I
have tabbed groups inside the HSplit.
I've attached two images and two bits of code.

And I've had a look at ....

http://code.enthought.com/projects/traits/docs/html/TUIUG/view.html#index-894

where it says that Tabbed is equivalent to
Group(orientation='horizontal',layout='tabbed')

Basically it works with Tabbed, doesn't work with
Group(orientation='horizontal',layout='tabbed')

Brennan


#! /usr/bin/env python
from enthought.pyface.api import GUI
from enthought.traits.api import *
from enthought.traits.ui.api import *

class Foo(HasTraits):
   
    foo1 = Int
    foo2 = Int
    foo3 = Int
    foo4 = Int
    foo5 = Int
    foo6 = Int
   
    view = View(
               HSplit(
                 Tabbed(
                   VGroup(Item('foo1'),
                      label='foo1',),
                   VGroup(Item('foo2'),
                      label='foo2',),
                 ),
                 Tabbed(
            VGroup(Item('foo3'),
                      label='foo3',),
                   VGroup(Item('foo4'),
                      label='foo4',),
                 ),
               ),
               buttons=['OK', 'Cancel'],
               width=650,height=300,
               title='HSplit',
               resizable=True,scrollable=True,kind='live'
           )
   
if __name__ == '__main__':

    f=Foo()
    f.foo1=1
    f.foo2=2
    f.foo3=3
    f.foo4=4
    f.foo5=4
    f.foo6=4
    gui=GUI()
    f.edit_traits()
    gui.start_event_loop()

#! /usr/bin/env python
from enthought.pyface.api import GUI
from enthought.traits.api import *
from enthought.traits.ui.api import *

class Foo(HasTraits):
   
    foo1 = Int
    foo2 = Int
    foo3 = Int
    foo4 = Int
    foo5 = Int
    foo6 = Int
   
    view = View(
               HSplit(
                 Group(
                   VGroup(Item('foo1'),
                      label='foo1',),
                   VGroup(Item('foo2'),
                      label='foo2',),
                   layout='tabbed',
                   orientation='horizontal',
                 ),
                 Group(
            VGroup(Item('foo3'),
                      label='foo3',),
                   VGroup(Item('foo4'),
                      label='foo4',),
                   layout='tabbed',
                   orientation='horizontal',
                 ),
               ),
               buttons=['OK', 'Cancel'],
               width=650,height=300,
               title='HSplit',
               resizable=True,scrollable=True,kind='live'
           )
   
if __name__ == '__main__':

    f=Foo()
    f.foo1=1
    f.foo2=2
    f.foo3=3
    f.foo4=4
    f.foo5=4
    f.foo6=4
    gui=GUI()
    f.edit_traits()
    gui.start_event_loop()

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

grouptabbed.png (20K) Download Attachment
tabbed.png (29K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: HSplit and tabbed groups

Warren Weckesser
Brennan Williams wrote:

> I think this might be a bug or I'm reading the documentation
> incorrectly. I've often had a problem with getting HSplit to work when
> I have tabbed groups inside the HSplit.
> I've attached two images and two bits of code.
>
> And I've had a look at ....
>
> http://code.enthought.com/projects/traits/docs/html/TUIUG/view.html#index-894 
>
>
> where it says that Tabbed is equivalent to
> Group(orientation='horizontal',layout='tabbed')
>
> Basically it works with Tabbed, doesn't work with
> Group(orientation='horizontal',layout='tabbed')
>

Brennan,

Add the keyword argument springy=True to the Groups in split_tabs2.py.  
That will make them use the full width.

Warren

> Brennan
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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: HSplit and tabbed groups

Brennan Williams
Warren Weckesser wrote:

> Brennan Williams wrote:
>  
>> I think this might be a bug or I'm reading the documentation
>> incorrectly. I've often had a problem with getting HSplit to work when
>> I have tabbed groups inside the HSplit.
>> I've attached two images and two bits of code.
>>
>> And I've had a look at ....
>>
>> http://code.enthought.com/projects/traits/docs/html/TUIUG/view.html#index-894 
>>
>>
>> where it says that Tabbed is equivalent to
>> Group(orientation='horizontal',layout='tabbed')
>>
>> Basically it works with Tabbed, doesn't work with
>> Group(orientation='horizontal',layout='tabbed')
>>
>>    
>
> Brennan,
>
> Add the keyword argument springy=True to the Groups in split_tabs2.py.  
> That will make them use the full width.
>
>  
OK I'll give that a go.... ok it worked... so this is a documentation
thing really...

Tabbed is equivalent to

Group(orientation='horizontal',layout='tabbed',springy=True)

rather than

Group(orientation='horizontal',layout='tabbed')

Brennan


>  


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

Re: HSplit and tabbed groups

Warren Weckesser
Brennan Williams wrote:
Warren Weckesser wrote:
  
Brennan Williams wrote:
  
    
I think this might be a bug or I'm reading the documentation 
incorrectly. I've often had a problem with getting HSplit to work when 
I have tabbed groups inside the HSplit.
I've attached two images and two bits of code.

And I've had a look at ....

http://code.enthought.com/projects/traits/docs/html/TUIUG/view.html#index-894 


where it says that Tabbed is equivalent to 
Group(orientation='horizontal',layout='tabbed')

Basically it works with Tabbed, doesn't work with 
Group(orientation='horizontal',layout='tabbed')

    
      
Brennan,

Add the keyword argument springy=True to the Groups in split_tabs2.py.  
That will make them use the full width.

  
    
OK I'll give that a go.... ok it worked... so this is a documentation 
thing really...
  


Looks that way.  I just updated the "Subclasses of Group" documentation in the trunk.

Tabbed is equivalent to

Group(orientation='horizontal',layout='tabbed',springy=True)

rather than

Group(orientation='horizontal',layout='tabbed')

  

Right.   Here's the Tabbed class, from enthought.traits.ui.group.py:


class Tabbed ( Group ):
    """ A group that is shown as a tabbed notebook.
    """

    #---------------------------------------------------------------------------
    #  Trait definitions:
    #---------------------------------------------------------------------------

    # Override standard Group trait defaults to give it tabbed notebook
    # behavior:
    layout  = 'tabbed'
    springy = True



It also appears that, when layout='tabbed', the orientation is moot (at least in the wx backend, which is all I tried).  Changing the orientation to 'vertical' in split_tabs2.py has no effect.  So it looks like the documentation could just say that Tabbed is equivalent to Group(layout='tabbed', springy=True).  With other backends, the orientation might matter, so I didn't take that out of the documentation.  But, since the default value of the `orientation` trait is 'vertical', and the Tabbed group doesn't actually explicitly set the orientation (as far as I could see), I'm not sure it is correct for the doc to say `orientation='horizontal'`.  Or perhaps the doc is correct, and the Tabbed class *should* explicitly set the orientation.

Warren


Brennan


  
  
    


_______________________________________________
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: HSplit and tabbed groups

Brennan Williams
Warren Weckesser wrote:

> Brennan Williams wrote:
>> Warren Weckesser wrote:
>>  
>>> Brennan Williams wrote:
>>>  
>>>    
>>>> I think this might be a bug or I'm reading the documentation
>>>> incorrectly. I've often had a problem with getting HSplit to work when
>>>> I have tabbed groups inside the HSplit.
>>>> I've attached two images and two bits of code.
>>>>
>>>> And I've had a look at ....
>>>>
>>>> http://code.enthought.com/projects/traits/docs/html/TUIUG/view.html#index-894 
>>>>
>>>>
>>>> where it says that Tabbed is equivalent to
>>>> Group(orientation='horizontal',layout='tabbed')
>>>>
>>>> Basically it works with Tabbed, doesn't work with
>>>> Group(orientation='horizontal',layout='tabbed')
>>>>
>>>>    
>>>>      
>>> Brennan,
>>>
>>> Add the keyword argument springy=True to the Groups in split_tabs2.py.  
>>> That will make them use the full width.
>>>
>>>  
>>>    
>> OK I'll give that a go.... ok it worked... so this is a documentation
>> thing really...
>>  
>
>
> Looks that way.  I just updated the "Subclasses of Group"
> documentation in the trunk.
>
>> Tabbed is equivalent to
>>
>> Group(orientation='horizontal',layout='tabbed',springy=True)
>>
>> rather than
>>
>> Group(orientation='horizontal',layout='tabbed')
>>
>>  
>
> Right.   Here's the Tabbed class, from enthought.traits.ui.group.py:
>
>
> class Tabbed ( Group ):
>     """ A group that is shown as a tabbed notebook.
>     """
>
>    
> #---------------------------------------------------------------------------
>     #  Trait definitions:
>    
> #---------------------------------------------------------------------------
>
>     # Override standard Group trait defaults to give it tabbed notebook
>     # behavior:
>     layout  = 'tabbed'
>     springy = True
>
>
> It also appears that, when layout='tabbed', the orientation is moot
> (at least in the wx backend, which is all I tried).  Changing the
> orientation to 'vertical' in split_tabs2.py has no effect.  So it
> looks like the documentation could just say that Tabbed is equivalent
> to Group(layout='tabbed', springy=True).  With other backends, the
> orientation might matter, so I didn't take that out of the
> documentation.  But, since the default value of the `orientation`
> trait is 'vertical', and the Tabbed group doesn't actually explicitly
> set the orientation (as far as I could see), I'm not sure it is
> correct for the doc to say `orientation='horizontal'`.  Or perhaps the
> doc is correct, and the Tabbed class *should* explicitly set the
> orientation.
>
Yes I have actually tried orientation='vertical' before and noticed that
it had no effect. But I am always using wx and not Qt. I wouldn't mind a
vertical orientation to the tabs under wx actually.

I'm hoping that springy=True will sort out a few problems in my gui.
I've always used VGroup,HGroup,VSplit,HSplit but didn't realise there
was a Tabbed. Is this relatively new or had I just not noticed it?

Thanks for the help.

Brennan


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

Re: HSplit and tabbed groups

Warren Weckesser
Brennan Williams wrote:

> Warren Weckesser wrote:
>  
>> Brennan Williams wrote:
>>    
>>> Warren Weckesser wrote:
>>>  
>>>      
>>>> Brennan Williams wrote:
>>>>  
>>>>    
>>>>        
>>>>> I think this might be a bug or I'm reading the documentation
>>>>> incorrectly. I've often had a problem with getting HSplit to work when
>>>>> I have tabbed groups inside the HSplit.
>>>>> I've attached two images and two bits of code.
>>>>>
>>>>> And I've had a look at ....
>>>>>
>>>>> http://code.enthought.com/projects/traits/docs/html/TUIUG/view.html#index-894 
>>>>>
>>>>>
>>>>> where it says that Tabbed is equivalent to
>>>>> Group(orientation='horizontal',layout='tabbed')
>>>>>
>>>>> Basically it works with Tabbed, doesn't work with
>>>>> Group(orientation='horizontal',layout='tabbed')
>>>>>
>>>>>    
>>>>>      
>>>>>          
>>>> Brennan,
>>>>
>>>> Add the keyword argument springy=True to the Groups in split_tabs2.py.  
>>>> That will make them use the full width.
>>>>
>>>>  
>>>>    
>>>>        
>>> OK I'll give that a go.... ok it worked... so this is a documentation
>>> thing really...
>>>  
>>>      
>> Looks that way.  I just updated the "Subclasses of Group"
>> documentation in the trunk.
>>
>>    
>>> Tabbed is equivalent to
>>>
>>> Group(orientation='horizontal',layout='tabbed',springy=True)
>>>
>>> rather than
>>>
>>> Group(orientation='horizontal',layout='tabbed')
>>>
>>>  
>>>      
>> Right.   Here's the Tabbed class, from enthought.traits.ui.group.py:
>>
>>
>> class Tabbed ( Group ):
>>     """ A group that is shown as a tabbed notebook.
>>     """
>>
>>    
>> #---------------------------------------------------------------------------
>>     #  Trait definitions:
>>    
>> #---------------------------------------------------------------------------
>>
>>     # Override standard Group trait defaults to give it tabbed notebook
>>     # behavior:
>>     layout  = 'tabbed'
>>     springy = True
>>
>>
>> It also appears that, when layout='tabbed', the orientation is moot
>> (at least in the wx backend, which is all I tried).  Changing the
>> orientation to 'vertical' in split_tabs2.py has no effect.  So it
>> looks like the documentation could just say that Tabbed is equivalent
>> to Group(layout='tabbed', springy=True).  With other backends, the
>> orientation might matter, so I didn't take that out of the
>> documentation.  But, since the default value of the `orientation`
>> trait is 'vertical', and the Tabbed group doesn't actually explicitly
>> set the orientation (as far as I could see), I'm not sure it is
>> correct for the doc to say `orientation='horizontal'`.  Or perhaps the
>> doc is correct, and the Tabbed class *should* explicitly set the
>> orientation.
>>
>>    
> Yes I have actually tried orientation='vertical' before and noticed that
> it had no effect. But I am always using wx and not Qt. I wouldn't mind a
> vertical orientation to the tabs under wx actually.
>
> I'm hoping that springy=True will sort out a few problems in my gui.
> I've always used VGroup,HGroup,VSplit,HSplit but didn't realise there
> was a Tabbed. Is this relatively new or had I just not noticed it?
>  


It has been there for several years.  The override of the `springy`
keyword was added in 2008.

Warren

> Thanks for the help.
>
> Brennan
>
>
> _______________________________________________
> 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