not enough space for widgets

821 views
Skip to first unread message

rodri...@gmail.com

unread,
Nov 26, 2014, 9:01:47 AM11/26/14
to npys...@googlegroups.com
Hi Everyone,

I am starting to use the library to create simple text config files for my applications. I just want to collect from the user a series of variables, all of them being simple text.
Therefore I have a bunch of TitleText widgets and used the approach from EXAMPLE-multipage_experimental.py in order to toggle between pages. However, after adding a couple of widgets and using new_page = F.add_page() to switch to the next page, I get the error: NotEnoughSpaceForWidget.

Any clues?

Thanks to everyone and hope i was clear enough,

Rodrigo

Nicholas Cole

unread,
Nov 26, 2014, 9:47:39 AM11/26/14
to npys...@googlegroups.com
That sounds a bit odd. If you want to post the example code here or
else to send it to me I'll take a look.

Nicholas

rodri...@gmail.com

unread,
Nov 27, 2014, 4:09:03 AM11/27/14
to npys...@googlegroups.com
Hi Nicholas, thank you very much for offering your help! This is the code, it seems that it does not 'recognize' I've switched to the other page in therms of space...

Rodrigo


import npyscreen

class MyTestApp(npyscreen.NPSApp):
   
def main(self):
        F
=npyscreen.FormMultiPageActionWithMenus('CREATE A DATA FILE')
        F
.add(npyscreen.TitleFixedText,name='***Time parameters***')
        preloadT
= F.add(npyscreen.TitleText,name='Preload time [s]: ',scroll_exit=True)
        startT
= F.add(npyscreen.TitleText,name='Start time for saving [s]: ',scroll_exit=True)
        period
= F.add(npyscreen.TitleText, name='Period of the input [s]: ',scroll_exit=True)
        initialtime
= F.add(npyscreen.TitleText, name='Start time for simulating (usually -preload) [s]: ',scroll_exit=True)
        timestep
= F.add(npyscreen.TitleText, name='Timestep [s]: ',scroll_exit=True)
        save
= F.add(npyscreen.TitleText,name='Save every how many timesteps?: ',scroll_exit=True)
        F
.add(npyscreen.TitleFixedText,name='***Fluid parameters***')
        density
= F.add(npyscreen.TitleText,name='Density: ',scroll_exit=True)
        viscosity
= F.add(npyscreen.TitleText,name='Viscosity: ',scroll_exit=True)

        new_page_1
=F.add_page()
       
        F
.add(npyscreen.TitleFixedText,name='***Space discretization parameters***')
        meshFile
= F.add(npyscreen.TitleFilenameCombo,name='Mesh File: ',scroll_exit=True)    
        velocityFEspace
= F.add(npyscreen.TitleSelectOne,name='FE space for velocity: ',values=['P1Bubble','P2',],scroll_exit=True)
        pressureFEspace
= F.add(npyscreen.TitleSelectOne,name='FE space for pressure: ',values=['P1',],scroll_exit=True)#THIS IS THE LINE IN WHICH I GET THE ERROR!
        betaSD
= F.add(npyscreen.TitleText,name='Streamline Diffusion coefficient: ',scroll_exit=True)
        stabilizeBackflows
= F.add(npyscreen.TitleText,name='Backflow stabilization coefficient: ',scroll_exit=True)

        F
.switch_page(0)        
        new_page_2
=F.add_page()

        F
.add(npyscreen.TitleFixedText,name='***Ascending aorta***',scroll_exit=True)
       
AAtag = F.add(npyscreen.TitleText,name='Boundary tag: ',scroll_exit=True)
       
AArescale = F.add(npyscreen.TitleText,name='Rescale: ',scroll_exit=True)        
       
AAcorrection = F.add(npyscreen.TitleText,name='Correction: ',scroll_exit=True)
        AASR
= F.add(npyscreen.TitleText,name='Smooth Ratio: ',scroll_exit=True)
        AAPS
= F.add(npyscreen.TitleSelectOne,name='Profile Shape: ', values=['Flat','Parabolic',],scroll_exit=True)
       
AAinput = F.add(npyscreen.TitleText,name='Insert the path for the flow file: ',scroll_exit=True)
        F
.add(npyscreen.TitleFixedText,name='***Brachiocephalic trunk***')
       
BCAtag=F.add(npyscreen,name='Boundary tag: ',scroll_exit=True)
       
BCAtype=F.add(TitleSelectOne,name='Boundary type: ', values=['RCR','Flow profile',],scroll_exit=True)
        F
.add(npyscreen.TitleFixedText,name='***Left common carotid artery***')
       
LCAtag=F.add(TitleText,name='Boundary tag: ',scroll_exit=True)
               
LCAtype=F.add(TitleSelectOne,name='Boundary type: ', values=['RCR','Flow profile',],scroll_exit=True)
        F
.add(npyscreen.TitleFixedText,name='***Left subclavian artery***')
         
LSAtag=F.add(npyscreen.TitleText,name='Boundary tag: ',scroll_exit=True)
               
LSAtype=F.add(TitleSelectOne,name='Boundary type: ', values=['RCR','Flow profile',],scroll_exit=True)
        F
.add(npyscreen.TitleFixedText,name='***Descending aorta***')
       
DAtag=F.add(npyscreen.TitleText,name='Boundary tag: ',scroll_exit=True)
               
DAtype=F.add(TitleSelectOne,name='Boundary type: ', values=['RCR','Flow profile',],scroll_exit=True)
           
        F
.switch_page(1)

       
def on_ok():
            npyscreen
.notify_confirm('succesfully created!')
        F
.on_ok=on_ok
        F
.edit()
       
if __name__ == '__main__':
    TA
= MyTestApp()
    TA
.run()

Nicholas Cole

unread,
Nov 28, 2014, 9:56:33 AM11/28/14
to npys...@googlegroups.com
Sorry for the delay. I've only had a chance to look at this. The
problem is that in the line:

velocityFEspace = F.add(npyscreen.TitleSelectOne,name='FE space for
velocity: ',values=['P1Bubble','P2',],scroll_exit=True)

you don't specify a maximum height, so the widget takes up the rest of
the available space, and there isn't any room when you then write:

pressureFEspace = F.add(npyscreen.TitleSelectOne,name='FE space for
pressure: ',values=['P1',],scroll_exit=True)#THIS IS THE LINE IN WHICH
I GET THE ERROR!

Best wishes,

Nicholas
Reply all
Reply to author
Forward
0 new messages