#NEWLINE# def _do_layout( self , dt ) : #NEWLINE# #INDENT# children = self . children #NEWLINE# if children : #NEWLINE# #INDENT# all_collapsed = all ( ( x . collapse for x in children ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# all_collapsed = False #NEWLINE# #UNINDENT# if all_collapsed : #NEWLINE# #INDENT# children [ 0 ] . collapse = False #NEWLINE# #UNINDENT# orientation = self . orientation #NEWLINE# min_space = self . min_space #NEWLINE# min_space_total = ( len ( child ) * self . min_space ) #NEWLINE# ( w , h ) = self . size #NEWLINE# ( x , y ) = self . pos #NEWLINE# if ( orientation == 'horizontal' ) : #NEWLINE# #INDENT# display_space = ( self . width - min_space_total ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# display_space = ( self . height - min_space_total ) #NEWLINE# #UNINDENT# if ( display_space <= 0 ) : #NEWLINE# #INDENT# Logger . warning ( 'Accordion: not enough space for displaying all children' ) #NEWLINE# Logger . warning ( ( 'Accordion: need %dpx, got %dpx' % ( min_space_total , ( min_space_total + display_space ) ) ) ) #NEWLINE# Logger . warning ( 'Accordion: layout aborted.' ) #NEWLINE# return #NEWLINE# #UNINDENT# if ( orientation == 'horizontal' ) : #NEWLINE# #INDENT# children = reversed ( children ) #NEWLINE# #UNINDENT# for child in children : #NEWLINE# #INDENT# child_space = min_space #NEWLINE# child_space += ( display_space * ( 1 - child . collapse_alpha ) ) #NEWLINE# child . _min_space = min_space #NEWLINE# child . x = x #NEWLINE# child . y = y #NEWLINE# child . orientation = self . orientation #NEWLINE# if ( orientation == 'horizontal' ) : #NEWLINE# #INDENT# child . content_size = ( display_space , h ) #NEWLINE# child . width = child_space #NEWLINE# child . height = h #NEWLINE# x += child_space #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# child . content_size = ( w , display_space ) #NEWLINE# child . width = w #NEWLINE# child . height = child_space #NEWLINE# y += child_space