parameters: (self, groups)
docstring: Tear down and rebuild the main window.
  
      Args:
        groups: the groups of counters to display
docstring_summary: Tear down and rebuild the main window.
docstring_tokens: Tear down and rebuild the main window .
function: def RebuildMainWindow(self, groups):
      """Tear down and rebuild the main window.
  
      Args:
        groups: the groups of counters to display
      """
      # Remove elements in the current ui
      self.ui_counters.clear()
      for child in self.root.children.values():
        child.destroy()
  
      # Build new ui
      index = 0
      sorted_groups = groups.keys()
      sorted_groups.sort()
      for counter_name in sorted_groups:
        counter_objs = groups[counter_name]
        if self.name_filter.match(counter_name):
          name = Tkinter.Label(self.root, width=50, anchor=Tkinter.W,
                               text=counter_name)
          name.grid(row=index, column=0, padx=1, pady=1)
        count = len(counter_objs)
        for i in xrange(count):
          counter = counter_objs[i]
          name = counter.Name()
          var = Tkinter.StringVar()
          if self.name_filter.match(name):
            value = Tkinter.Label(self.root, width=15, anchor=Tkinter.W,
                                  textvariable=var)
            value.grid(row=index, column=(1 + i), padx=1, pady=1)
  
          # If we know how to interpret the prefix of this counter then
          # add an appropriate formatting to the variable
          if (":" in name) and (name[0] in COUNTER_LABELS):
            format = COUNTER_LABELS[name[0]]
          else:
            format = "%i"
          ui_counter = UiCounter(var, format)
          self.ui_counters[name] = ui_counter
          ui_counter.Set(counter.Value())
        index += 1
      self.root.update()
function_tokens: def RebuildMainWindow ( self , groups ) : # Remove elements in the current ui self . ui_counters . clear ( ) for child in self . root . children . values ( ) : child . destroy ( ) # Build new ui index = 0 sorted_groups = groups . keys ( ) sorted_groups . sort ( ) for counter_name in sorted_groups : counter_objs = groups [ counter_name ] if self . name_filter . match ( counter_name ) : name = Tkinter . Label ( self . root , width = 50 , anchor = Tkinter . W , text = counter_name ) name . grid ( row = index , column = 0 , padx = 1 , pady = 1 ) count = len ( counter_objs ) for i in xrange ( count ) : counter = counter_objs [ i ] name = counter . Name ( ) var = Tkinter . StringVar ( ) if self . name_filter . match ( name ) : value = Tkinter . Label ( self . root , width = 15 , anchor = Tkinter . W , textvariable = var ) value . grid ( row = index , column = ( 1 + i ) , padx = 1 , pady = 1 ) # If we know how to interpret the prefix of this counter then # add an appropriate formatting to the variable if ( ":" in name ) and ( name [ 0 ] in COUNTER_LABELS ) : format = COUNTER_LABELS [ name [ 0 ] ] else : format = "%i" ui_counter = UiCounter ( var , format ) self . ui_counters [ name ] = ui_counter ui_counter . Set ( counter . Value ( ) ) index += 1 self . root . update ( )