Make ipython accept paths, not a single path

This commit is contained in:
ZyX 2014-08-10 15:28:30 +04:00
parent 8de14c1fd7
commit 17b32b1765
6 changed files with 10 additions and 8 deletions

View File

@ -104,8 +104,8 @@ use ``c.Powerline.KEY``. Supported ``KEY`` strings or keyword argument names:
a dictionary where keys are theme names and values are dictionaries which a dictionary where keys are theme names and values are dictionaries which
will be recursively merged with the contents of the given theme. will be recursively merged with the contents of the given theme.
``path`` ``paths``
Sets directory where configuration should be read from. If present, no Sets directories where configuration should be read from. If present, no
default locations are searched for configuration. No expansions are default locations are searched for configuration. No expansions are
performed thus you cannot use paths starting with ``~/``. performed thus you cannot use paths starting with ``~/``.

View File

@ -47,7 +47,7 @@ class ConfigurableIpythonPowerline(IpythonPowerline):
config = ip.config.Powerline config = ip.config.Powerline
self.config_overrides = config.get('config_overrides') self.config_overrides = config.get('config_overrides')
self.theme_overrides = config.get('theme_overrides', {}) self.theme_overrides = config.get('theme_overrides', {})
self.path = config.get('path') self.paths = config.get('paths')
super(ConfigurableIpythonPowerline, self).__init__(is_prompt) super(ConfigurableIpythonPowerline, self).__init__(is_prompt)

View File

@ -82,10 +82,10 @@ class PowerlinePrompt2(PowerlinePromptOut):
class ConfigurableIpythonPowerline(IpythonPowerline): class ConfigurableIpythonPowerline(IpythonPowerline):
def __init__(self, is_prompt, config_overrides=None, theme_overrides={}, path=None): def __init__(self, is_prompt, config_overrides=None, theme_overrides={}, paths=None):
self.config_overrides = config_overrides self.config_overrides = config_overrides
self.theme_overrides = theme_overrides self.theme_overrides = theme_overrides
self.path = path self.paths = paths
super(ConfigurableIpythonPowerline, self).__init__(is_prompt) super(ConfigurableIpythonPowerline, self).__init__(is_prompt)

View File

@ -31,8 +31,8 @@ class IpythonPowerline(Powerline):
) )
def get_config_paths(self): def get_config_paths(self):
if self.path: if self.paths:
return [self.path] return self.paths
else: else:
return super(IpythonPowerline, self).get_config_paths() return super(IpythonPowerline, self).get_config_paths()

View File

@ -112,7 +112,7 @@ class TestConfig(TestCase):
from powerline.ipython import IpythonPowerline from powerline.ipython import IpythonPowerline
class IpyPowerline(IpythonPowerline): class IpyPowerline(IpythonPowerline):
path = None paths = None
config_overrides = None config_overrides = None
theme_overrides = {} theme_overrides = {}

View File

@ -1,6 +1,8 @@
import os
c = get_config() c = get_config()
c.InteractiveShellApp.extensions = ['powerline.bindings.ipython.post_0_11'] c.InteractiveShellApp.extensions = ['powerline.bindings.ipython.post_0_11']
c.TerminalInteractiveShell.autocall = 1 c.TerminalInteractiveShell.autocall = 1
c.Powerline.paths = [os.path.abspath('powerline/config_files')]
c.Powerline.theme_overrides = { c.Powerline.theme_overrides = {
'in': { 'in': {
'segment_data': { 'segment_data': {