User Panel Example

The following is an example of a simple user panel for simplifying a StaticMixer specification. For clarity, help arguments are omitted.

#===========================================================================
# Define the grouping tab #===========================================================================
def usrTabStaticMixerGroup( item, args ):
      node = ROOT + RS + 'User' + RS + 'Mixing' + RS + 'StaticMixer'
#===========================================================================
# Define the physics tab #===========================================================================
def usrTabStaticMixerPhysics( item, args ):
      node = ROOT + RS + 'User' + RS + 'Mixing' + RS + 'StaticMixer'
#===========================================================================
# Define the Bcs tab #===========================================================================
def usrTabStaticMixerBcs( item, args ):
      node = ROOT + RS + 'User' + RS + 'Mixing' + RS + 'StaticMixer'
#===========================================================================
# Define the open function #===========================================================================
def usrOpenStaticMixer( item, args ):
      node = ROOT + RS + 'User' + RS + 'Mixing' + RS + 'StaticMixer'
      MenuTab( tabs = ( ( 'Group', 'group' ), ( 'Physics', 'physics' ),
                      ( 'BCs', 'Bcs' )),
               node = node,
               par = 'tab',
               redraw = True,
               default = 'group' )
      tab = GetTab( node, 'tab' )
      if tab == 'group':
             usrTabStaticMixerGroup( item, args )
      if tab == 'physics':
             usrTabStaticMixerPhysics( item, args )
      if tab == 'Bcs':
             usrTabStaticMixerBcs( item, args )
#===========================================================================
# Add to the tree item #=========================================================================== TreeItem( parent = UsrMixing,
         name = 'Static Mixer',
         tooltip = 'Simplified Static Mixer Panels',
         whatsthis= 'Open the custom panels to<br>' 'specify a static mixer',
         helpURL = 'static_mixer.html',
         popup = (( 'Open', usrOpenStaticMixer ),),
         click2 = 'Open' )
#===========================================================================
# Initialize the data base values (if not already in the data base) #=========================================================================== node = ROOT + RS + 'User' + RS + 'Mixing' + RS + 'StaticMixer'
PutTab( node, 'tab', 'group', False )