original_docstring: Initialize the elements and labels based on the context set.
docstring: Initialize the elements and labels based on the context set.
docstring_tokens: Initialize the elements and labels based on the context set .
code: def _start_cb(self, elems: _ElemsType) -> None:
          """Initialize the elements and labels based on the context set."""
          if self._context is None:
              log.hints.debug("In _start_cb without context!")
              return
  
          if not elems:
              message.error("No elements found.")
              return
  
          # Because _start_cb is called asynchronously, it's possible that the
          # user switched to another tab or closed the tab/window. In that case
          # we should not start hinting.
          tabbed_browser = objreg.get('tabbed-browser', default=None,
                                      scope='window', window=self._win_id)
          tab = tabbed_browser.widget.currentWidget()
          if tab.tab_id != self._context.tab.tab_id:
              log.hints.debug(
                  "Current tab changed ({} -> {}) before _start_cb is run."
                  .format(self._context.tab.tab_id, tab.tab_id))
              return
  
          strings = self._hint_strings(elems)
          log.hints.debug("hints: {}".format(', '.join(strings)))
  
          for elem, string in zip(elems, strings):
              label = HintLabel(elem, self._context)
              label.update_text('', string)
              self._context.all_labels.append(label)
              self._context.labels[string] = label
  
          keyparser = self._get_keyparser(usertypes.KeyMode.hint)
          keyparser.update_bindings(strings)
  
          modeman.enter(self._win_id, usertypes.KeyMode.hint,
                        'HintManager.start')
  
          self.set_text.emit(self._get_text())
  
          if self._context.first:
              self._fire(strings[0])
              return
          # to make auto_follow == 'always' work
          self._handle_auto_follow()
code_tokens: def _start_cb ( self , elems : _ElemsType ) -> None : if self . _context is None : log . hints . debug ( "In _start_cb without context!" ) return if not elems : message . error ( "No elements found." ) return tabbed_browser = objreg . get ( 'tabbed-browser' , default = None , scope = 'window' , window = self . _win_id ) tab = tabbed_browser . widget . currentWidget ( ) if tab . tab_id != self . _context . tab . tab_id : log . hints . debug ( "Current tab changed ({} -> {}) before _start_cb is run." . format ( self . _context . tab . tab_id , tab . tab_id ) ) return strings = self . _hint_strings ( elems ) log . hints . debug ( "hints: {}" . format ( ', ' . join ( strings ) ) ) for elem , string in zip ( elems , strings ) : label = HintLabel ( elem , self . _context ) label . update_text ( '' , string ) self . _context . all_labels . append ( label ) self . _context . labels [ string ] = label keyparser = self . _get_keyparser ( usertypes . KeyMode . hint ) keyparser . update_bindings ( strings ) modeman . enter ( self . _win_id , usertypes . KeyMode . hint , 'HintManager.start' ) self . set_text . emit ( self . _get_text ( ) ) if self . _context . first : self . _fire ( strings [ 0 ] ) return self . _handle_auto_follow ( )
short_docstring: Initialize the elements and labels based on the context set.
short_docstring_tokens: Initialize the elements and labels based on the context set .
comment: """Initialize the elements and labels based on the context set."""$SEP$# Because _start_cb is called asynchronously, it's possible that the$SEP$# user switched to another tab or closed the tab/window. In that case$SEP$# we should not start hinting.$SEP$# to make auto_follow == 'always' work