summaryrefslogtreecommitdiffstats
path: root/powerline/renderers/ipython/__init__.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:40:16 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:40:16 +0000
commit3f25952c13d5847d510c0cae22a8ba876638d570 (patch)
tree02f505f016ed5a1029277dcae520d5e2a75906fb /powerline/renderers/ipython/__init__.py
parentInitial commit. (diff)
downloadpowerline-upstream.tar.xz
powerline-upstream.zip
Adding upstream version 2.8.3.upstream/2.8.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'powerline/renderers/ipython/__init__.py')
-rw-r--r--powerline/renderers/ipython/__init__.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/powerline/renderers/ipython/__init__.py b/powerline/renderers/ipython/__init__.py
new file mode 100644
index 0000000..8f463b5
--- /dev/null
+++ b/powerline/renderers/ipython/__init__.py
@@ -0,0 +1,34 @@
+# vim:fileencoding=utf-8:noet
+from __future__ import (unicode_literals, division, absolute_import, print_function)
+
+from powerline.theme import Theme
+from powerline.renderers.shell import PromptRenderer
+
+
+class IPythonRenderer(PromptRenderer):
+ '''Powerline ipython segment renderer.'''
+ def get_segment_info(self, segment_info, mode):
+ r = self.segment_info.copy()
+ r['ipython'] = segment_info
+ return r
+
+ def get_theme(self, matcher_info):
+ if matcher_info == 'in':
+ return self.theme
+ else:
+ match = self.local_themes[matcher_info]
+ try:
+ return match['theme']
+ except KeyError:
+ match['theme'] = Theme(
+ theme_config=match['config'],
+ main_theme_config=self.theme_config,
+ **self.theme_kwargs
+ )
+ return match['theme']
+
+ def shutdown(self):
+ self.theme.shutdown()
+ for match in self.local_themes.values():
+ if 'theme' in match:
+ match['theme'].shutdown()