Example #1
0
 def _GetProjectAndAccount(self):
     """Returns the current (project, account) tuple."""
     if not self.args.IsSpecified('project'):
         named_configs.ActivePropertiesFile().Invalidate()
     project = properties.VALUES.core.project.Get() or '<NO PROJECT SET>'
     account = properties.VALUES.core.account.Get() or '<NO ACCOUNT SET>'
     return (project, account)
Example #2
0
def GetBottomToolbarTokens(unused_cli):
  # Prevents caching of properties, so we will update the toolbar in response to
  # changes in property status
  named_configs.ActivePropertiesFile().Invalidate()
  project = properties.VALUES.core.project.Get() or '<NO PROJECT SET>'
  account = properties.VALUES.core.account.Get() or '<NO ACCOUNT SET>'
  return [(Token.Toolbar.Account, account),
          (Token.Toolbar.Separator, ' - '),
          (Token.Toolbar.Project, project)]
Example #3
0
    def _GetBottomToolbarTokens(self, _):
        """Returns the bottom toolbar tokens based on the key binding state."""
        named_configs.ActivePropertiesFile().Invalidate()
        project = properties.VALUES.core.project.Get() or '<NO PROJECT SET>'
        account = properties.VALUES.core.account.Get() or '<NO ACCOUNT SET>'
        separator = (Token.Toolbar.Separator, self.BOTTOM_TOOLBAR_SEPARATOR)

        tokens = []
        tokens.append((Token.Toolbar.Account, account))
        tokens.append(separator)
        tokens.append((Token.Toolbar.Project, project))
        for binding in self.key_bindings.bindings:
            tokens.append(separator)
            tokens.append((Token.Toolbar.Help, binding.GetLabel()))
        return tokens
Example #4
0
def GetBottomToolbarTokens(_):
    # Prevents caching of properties, so we will update the toolbar in response to
    # changes in property status
    named_configs.ActivePropertiesFile().Invalidate()
    project = properties.VALUES.core.project.Get() or '<NO PROJECT SET>'
    account = properties.VALUES.core.account.Get() or '<NO ACCOUNT SET>'

    help_status = 'ON' if SHOW_HELP_WINDOW else 'OFF'

    return [
        (Token.Toolbar.Account, account),
        (Token.Toolbar.Separator, ' | '),
        (Token.Toolbar.Project, project),
        (Token.Toolbar.Separator, ' | '),
        (Token.Toolbar.Help, 'ctrl-q: Quit'),
        (Token.Toolbar.Separator, ' | '),
        (Token.Toolbar.Help, 'ctrl-t: Help '),
        (Token.Toolbar.Help, help_status),
    ]