class_docstr: Container for other widgets.
  
  This widget is designed for internal use only! Its role is to lay out all contained widgets.
class_docstr_tok: ["Container","for","other","widgets",".","This","widget","is","designed","for","internal","use","only","!","Its","role","is","to","lay","out","all","contained","widgets","."]
docstr: Initial rendering stage, done in order to compute widths of all widgets.
docstr_tok: ["Initial","rendering","stage",",","done","in","order","to","compute","widths","of","all","widgets","."]
code: def _compute_widget_sizes(self):
      """Initial rendering stage, done in order to compute widths of all widgets."""
      wl = [0] * len(self._widgets)
      flex_count = 0
  
      # First render all non-flexible widgets
      for i, widget in enumerate(self._widgets):
          if isinstance(widget, ProgressBarFlexibleWidget):
              flex_count += 1
          else:
              wl[i] = widget.render(1, status="init").length
  
      remaining_width = self._width - sum(wl)
      remaining_width -= (
          len(self._widgets) - 1
      )  # account for 1-space interval between widgets
      if remaining_width < 10 * flex_count:
          if self._file_mode:
              remaining_width = 10 * flex_count
          else:
              # The window is too small to accommodate the widget: try to split it into several lines, otherwise
              # switch to "file mode". If we don't do this, then rendering the widget will cause it to wrap, and
              # then when we use \r to go to the beginning of the line, only part of the widget will be overwritten,
              # which means we'll have many (possibly hundreds) of progress bar lines in the end.
              widget0 = self._widgets[0]
              r0 = widget0.render(0, status="init")
              if (
                  isinstance(widget0, PBWString)
                  and remaining_width + r0.length >= 10 * flex_count
              ):
                  remaining_width += r0.length + 1
                  self._to_render = r0.rendered + "\n"
                  self._widgets = self._widgets[1:]
              if remaining_width < 10 * flex_count:
                  self._file_mode = True
                  remaining_width = 10 * flex_count
  
      remaining_width = max(
          remaining_width, 10 * flex_count
      )  # Ensure at least 10 chars per flexible widget
  
      for i, widget in enumerate(self._widgets):
          if isinstance(widget, ProgressBarFlexibleWidget):
              target_length = int(remaining_width / flex_count)
              result = widget.render(
                  1, width=target_length, status="init"
              )
              wl[i] = result.length
              remaining_width -= result.length
              flex_count -= 1
  
      return wl
  
imports: from h2o.utils.compatibility import *
  import math
  import os
  import sys
  import time
  from types import FunctionType, GeneratorType, MethodType
  from h2o.utils.shared_utils import clamp
  from h2o.utils.typechecks import assert_is_type, is_type, numeric
label_desc: Use image node_id 3 for calling the _ProgressBarCompoundWidget obj's underlying member method code with example usage: obj._compute_widget_sizes() and returns: wl