AccordionView, storing groups in separate modules



  • Next with AV, I'm trying to store separately the several groups to avoid a long long script and make easier maintaining. Is this possible? If yes, I'm doing something wrong. I attach both the launcher script and a module with a group.
    Dank u


  • admin

    you can only add vanilla like objects in an AccordionView, in your example the class aGroup is not a vanilla like object

    use:

    from vanilla import *
    
    class aGroup(Group):
    
        def __init__(self):
            super(aGroup, self).__init__((0, 0, -0, -0))
            self.PopUpButton = PopUpButton((10, 10, -10, -10),
                ['PopUpButton'], sizeStyle='small')
    

    good luck!



  • Still not working with the launcher code :(
    Sorry for worst formatting ever.

    from mojo.UI import AccordionView
    from vanilla import *
    from storegroup import aGroup
    
    class launcher:
    
        def __init__(self):
            self.w = FloatingWindow((200, 600), title='accordionView')
            self.agroup = aGroup()
            descriptions = [
                dict(label="aGroup", view=self.agroup, size=117, collapsed=False, canResize=False)
            ]
            self.w.accordionView = AccordionView((0, 0, -0, -0), descriptions)
            self.w.open()
    
    launcher()
    

    BTW, is there a guide somewhere to correctly format in posts?


  • admin

    euh?

    an AccordionView only takes a vanilla like object, best is to subclass a vanilla.Group and add UI elements in there.

    good luck

    (a working version attached)