#NEWLINE# def toolbar( self , action_list ) : #NEWLINE# #INDENT# '\n        This also manages action groups\n        ' #NEWLINE# profile = jsgen . get_user_profile ( ) #NEWLINE# buttons = [ ] #NEWLINE# combo_map = dict ( ) #NEWLINE# for ba in action_list : #NEWLINE# #INDENT# if ( ba . action . show_in_bbar and ba . get_view_permission ( profile ) ) : #NEWLINE# #INDENT# if ( ba . action . combo_group is None ) : #NEWLINE# #INDENT# buttons . append ( self . a2btn ( ba ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# k = ba . action . combo_group #NEWLINE# combo = combo_map . get ( k , None ) #NEWLINE# if ( combo is None ) : #NEWLINE# #INDENT# parent = self . a2btn ( ba ) #NEWLINE# menu = [ parent ] #NEWLINE# combo = AttrDict ( menu = menu ) #NEWLINE# combo . update ( iconCls = parent . get ( 'iconCls' ) ) #NEWLINE# combo . update ( menu_item_text = parent . get ( 'menu_item_text' ) ) #NEWLINE# combo . update ( text = parent . get ( 'text' ) ) #NEWLINE# buttons . append ( combo ) #NEWLINE# combo_map [ k ] = combo #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# combo [ 'menu' ] . append ( self . a2btn ( ba ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# reduced_buttons = [ ] #NEWLINE# for b in buttons : #NEWLINE# #INDENT# menu = b . get ( 'menu' , None ) #NEWLINE# if ( menu is None ) : #NEWLINE# #INDENT# reduced_buttons . append ( b ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( menu ) == 1 ) : #NEWLINE# #INDENT# reduced_buttons . append ( menu [ 0 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# b . update ( xtype = 'splitbutton' ) #NEWLINE# b . update ( panel_btn_handler = menu [ 0 ] [ 'panel_btn_handler' ] ) #NEWLINE# for a in menu : #NEWLINE# #INDENT# a [ 'text' ] = a [ 'menu_item_text' ] #NEWLINE# if ( a . get ( 'iconCls' , 1 ) == b . get ( 'iconCls' , 2 ) ) : #NEWLINE# #INDENT# del a [ 'iconCls' ] #NEWLINE# #UNINDENT# #UNINDENT# reduced_buttons . append ( b ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return reduced_buttons