From 0b385a11e0431865729641d3d427034a2b079bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Silkeb=C3=A6kken?= Date: Mon, 21 Jan 2013 10:48:14 +0100 Subject: [PATCH] Rename "terminal" extension to "shell" Refs #84. --- .../{terminal => shell}/default.json | 0 powerline/config_files/config.json | 2 +- .../themes/{terminal => shell}/default.json | 0 powerline/renderers/{terminal.py => shell.py} | 18 +++--------------- 4 files changed, 4 insertions(+), 16 deletions(-) rename powerline/config_files/colorschemes/{terminal => shell}/default.json (100%) rename powerline/config_files/themes/{terminal => shell}/default.json (100%) rename powerline/renderers/{terminal.py => shell.py} (59%) diff --git a/powerline/config_files/colorschemes/terminal/default.json b/powerline/config_files/colorschemes/shell/default.json similarity index 100% rename from powerline/config_files/colorschemes/terminal/default.json rename to powerline/config_files/colorschemes/shell/default.json diff --git a/powerline/config_files/config.json b/powerline/config_files/config.json index 70c85d46..35b5bb16 100644 --- a/powerline/config_files/config.json +++ b/powerline/config_files/config.json @@ -12,7 +12,7 @@ } }, "ext": { - "terminal": { + "shell": { "colorscheme": "default", "theme": "default" }, diff --git a/powerline/config_files/themes/terminal/default.json b/powerline/config_files/themes/shell/default.json similarity index 100% rename from powerline/config_files/themes/terminal/default.json rename to powerline/config_files/themes/shell/default.json diff --git a/powerline/renderers/terminal.py b/powerline/renderers/shell.py similarity index 59% rename from powerline/renderers/terminal.py rename to powerline/renderers/shell.py index 9f3c76de..e2b63929 100644 --- a/powerline/renderers/terminal.py +++ b/powerline/renderers/shell.py @@ -1,22 +1,10 @@ # -*- coding: utf-8 -*- -import os - from powerline.renderer import Renderer -class TerminalRenderer(Renderer): - '''Powerline terminal segment renderer.''' - _color_templates = { - 'default': '[{code}m', - 'zsh': '%{{[{code}m%}}', - } - - def __init__(self, *args, **kwargs): - super(TerminalRenderer, self).__init__(*args, **kwargs) - shell = os.path.basename(os.environ.get('SHELL')) - self.color_template = self._color_templates.get(shell, self._color_templates['default']) - +class ShellRenderer(Renderer): + '''Powerline shell segment renderer.''' def hl(self, fg=None, bg=None, attr=None): '''Highlight a segment. @@ -41,4 +29,4 @@ class TerminalRenderer(Renderer): else: if attr & Renderer.ATTR_BOLD: ansi += [1] - return self.color_template.format(code=';'.join(str(attr) for attr in ansi)) + return '[{0}m'.format(';'.join(str(attr) for attr in ansi))