parent
ee51b8b76c
commit
282cb43eef
|
@ -15,7 +15,7 @@ class PowerlinePrompt(BasePrompt):
|
|||
|
||||
def auto_rewrite(self):
|
||||
# TODO color this
|
||||
return '%s>%s' % ('-'*self.prompt_text_len, ' '*self.nrspaces)
|
||||
return '%s>%s' % ('-' * self.prompt_text_len, ' ' * self.nrspaces)
|
||||
|
||||
|
||||
def setup(prompt='1'):
|
||||
|
|
|
@ -5,8 +5,8 @@ ATTR_BOLD = 1
|
|||
ATTR_ITALIC = 2
|
||||
ATTR_UNDERLINE = 4
|
||||
|
||||
class Colorscheme(object):
|
||||
|
||||
class Colorscheme(object):
|
||||
def __init__(self, colorscheme):
|
||||
'''Initialize a colorscheme.'''
|
||||
self.colors = {}
|
||||
|
|
|
@ -3,6 +3,10 @@ import os
|
|||
from powerline.lib.memoize import memoize
|
||||
|
||||
|
||||
vcs_props = (('git', '.git', os.path.exists),
|
||||
('mercurial', '.hg', os.path.isdir))
|
||||
|
||||
|
||||
def generate_directories(path):
|
||||
yield path
|
||||
while True:
|
||||
|
@ -13,9 +17,6 @@ def generate_directories(path):
|
|||
yield path
|
||||
|
||||
|
||||
vcs_props = (('git', '.git', os.path.exists),
|
||||
('mercurial', '.hg', os.path.isdir))
|
||||
|
||||
@memoize(100)
|
||||
def guess(path):
|
||||
for directory in generate_directories(path):
|
||||
|
|
|
@ -42,7 +42,7 @@ class Renderer(object):
|
|||
theme.segment_info.update(segment_info)
|
||||
|
||||
# Handle excluded/included segments for the current mode
|
||||
segments = [segment for segment in segments\
|
||||
segments = [segment for segment in segments
|
||||
if mode not in segment['exclude_modes'] or (segment['include_modes'] and segment in segment['include_modes'])]
|
||||
|
||||
segments = [segment for segment in self._render_segments(mode, theme, segments)]
|
||||
|
|
|
@ -43,7 +43,7 @@ class ShellRenderer(Renderer):
|
|||
if attr & ATTR_BOLD:
|
||||
ansi += [1]
|
||||
elif attr & ATTR_ITALIC:
|
||||
# Note: is likely not to work or even be inverse in place of
|
||||
# Note: is likely not to work or even be inverse in place of
|
||||
# italic. Omit using this in colorschemes.
|
||||
ansi += [3]
|
||||
elif attr & ATTR_UNDERLINE:
|
||||
|
|
|
@ -191,54 +191,54 @@ def uptime(format='{days:02d}d {hours:02d}h {minutes:02d}m'):
|
|||
# Weather condition code descriptions available at
|
||||
# http://developer.yahoo.com/weather/#codes
|
||||
weather_conditions_codes = (
|
||||
('tornado', 'stormy'), # 0
|
||||
('tropical_storm', 'stormy'), # 1
|
||||
('hurricane', 'stormy'), # 2
|
||||
('severe_thunderstorms', 'stormy'), # 3
|
||||
('thunderstorms', 'stormy'), # 4
|
||||
('mixed_rain_and_snow', 'rainy' ), # 5
|
||||
('mixed_rain_and_sleet', 'rainy' ), # 6
|
||||
('mixed_snow_and_sleet', 'snowy' ), # 7
|
||||
('freezing_drizzle', 'rainy' ), # 8
|
||||
('drizzle', 'rainy' ), # 9
|
||||
('freezing_rain', 'rainy' ), # 10
|
||||
('showers', 'rainy' ), # 11
|
||||
('showers', 'rainy' ), # 12
|
||||
('snow_flurries', 'snowy' ), # 13
|
||||
('light_snow_showers', 'snowy' ), # 14
|
||||
('blowing_snow', 'snowy' ), # 15
|
||||
('snow', 'snowy' ), # 16
|
||||
('hail', 'snowy' ), # 17
|
||||
('sleet', 'snowy' ), # 18
|
||||
('dust', 'foggy' ), # 19
|
||||
('fog', 'foggy' ), # 20
|
||||
('haze', 'foggy' ), # 21
|
||||
('smoky', 'foggy' ), # 22
|
||||
('blustery', 'foggy' ), # 23
|
||||
('windy', ), # 24
|
||||
('cold', 'day' ), # 25
|
||||
('clouds', 'cloudy'), # 26
|
||||
('mostly_cloudy_night', 'cloudy'), # 27
|
||||
('mostly_cloudy_day', 'cloudy'), # 28
|
||||
('partly_cloudy_night', 'cloudy'), # 29
|
||||
('partly_cloudy_day', 'cloudy'), # 30
|
||||
('clear_night', 'night' ), # 31
|
||||
('sun', 'sunny' ), # 32
|
||||
('fair_night', 'night' ), # 33
|
||||
('fair_day', 'day' ), # 34
|
||||
('mixed_rain_and_hail', 'rainy' ), # 35
|
||||
('hot', 'sunny' ), # 36
|
||||
('isolated_thunderstorms', 'stormy'), # 37
|
||||
('scattered_thunderstorms', 'stormy'), # 38
|
||||
('scattered_thunderstorms', 'stormy'), # 39
|
||||
('scattered_showers', 'rainy' ), # 40
|
||||
('heavy_snow', 'snowy' ), # 41
|
||||
('scattered_snow_showers', 'snowy' ), # 42
|
||||
('heavy_snow', 'snowy' ), # 43
|
||||
('partly_cloudy', 'cloudy'), # 44
|
||||
('thundershowers', 'rainy' ), # 45
|
||||
('snow_showers', 'snowy' ), # 46
|
||||
('isolated_thundershowers', 'rainy' ), # 47
|
||||
('tornado', 'stormy'), # 0
|
||||
('tropical_storm', 'stormy'), # 1
|
||||
('hurricane', 'stormy'), # 2
|
||||
('severe_thunderstorms', 'stormy'), # 3
|
||||
('thunderstorms', 'stormy'), # 4
|
||||
('mixed_rain_and_snow', 'rainy' ), # 5
|
||||
('mixed_rain_and_sleet', 'rainy' ), # 6
|
||||
('mixed_snow_and_sleet', 'snowy' ), # 7
|
||||
('freezing_drizzle', 'rainy' ), # 8
|
||||
('drizzle', 'rainy' ), # 9
|
||||
('freezing_rain', 'rainy' ), # 10
|
||||
('showers', 'rainy' ), # 11
|
||||
('showers', 'rainy' ), # 12
|
||||
('snow_flurries', 'snowy' ), # 13
|
||||
('light_snow_showers', 'snowy' ), # 14
|
||||
('blowing_snow', 'snowy' ), # 15
|
||||
('snow', 'snowy' ), # 16
|
||||
('hail', 'snowy' ), # 17
|
||||
('sleet', 'snowy' ), # 18
|
||||
('dust', 'foggy' ), # 19
|
||||
('fog', 'foggy' ), # 20
|
||||
('haze', 'foggy' ), # 21
|
||||
('smoky', 'foggy' ), # 22
|
||||
('blustery', 'foggy' ), # 23
|
||||
('windy', ), # 24
|
||||
('cold', 'day' ), # 25
|
||||
('clouds', 'cloudy'), # 26
|
||||
('mostly_cloudy_night', 'cloudy'), # 27
|
||||
('mostly_cloudy_day', 'cloudy'), # 28
|
||||
('partly_cloudy_night', 'cloudy'), # 29
|
||||
('partly_cloudy_day', 'cloudy'), # 30
|
||||
('clear_night', 'night' ), # 31
|
||||
('sun', 'sunny' ), # 32
|
||||
('fair_night', 'night' ), # 33
|
||||
('fair_day', 'day' ), # 34
|
||||
('mixed_rain_and_hail', 'rainy' ), # 35
|
||||
('hot', 'sunny' ), # 36
|
||||
('isolated_thunderstorms', 'stormy'), # 37
|
||||
('scattered_thunderstorms', 'stormy'), # 38
|
||||
('scattered_thunderstorms', 'stormy'), # 39
|
||||
('scattered_showers', 'rainy' ), # 40
|
||||
('heavy_snow', 'snowy' ), # 41
|
||||
('scattered_snow_showers', 'snowy' ), # 42
|
||||
('heavy_snow', 'snowy' ), # 43
|
||||
('partly_cloudy', 'cloudy'), # 44
|
||||
('thundershowers', 'rainy' ), # 45
|
||||
('snow_showers', 'snowy' ), # 46
|
||||
('isolated_thundershowers', 'rainy' ), # 47
|
||||
)
|
||||
# ('day', (25, 34)),
|
||||
# ('rainy', (5, 6, 8, 9, 10, 11, 12, 35, 40, 45, 47)),
|
||||
|
|
|
@ -6,7 +6,7 @@ import os
|
|||
try:
|
||||
import vim
|
||||
except ImportError:
|
||||
vim = {}
|
||||
vim = {} # NOQA
|
||||
|
||||
from powerline.bindings.vim import vim_get_func, getbufvar
|
||||
from powerline.theme import requires_segment_info
|
||||
|
@ -49,15 +49,16 @@ mode_translations = {
|
|||
}
|
||||
|
||||
|
||||
eventcaches = defaultdict(lambda : [])
|
||||
bufeventcaches = defaultdict(lambda : [])
|
||||
eventcaches = defaultdict(lambda: [])
|
||||
bufeventcaches = defaultdict(lambda: [])
|
||||
|
||||
|
||||
def purgeonevents_reg(events, eventcaches=bufeventcaches):
|
||||
def cache_reg_func(cache):
|
||||
for event in events:
|
||||
if event not in eventcaches:
|
||||
vim.eval('PowerlineRegisterCachePurgerEvent("' + event + '")')
|
||||
eventcaches[event].append(cache)
|
||||
|
||||
return cache_reg_func
|
||||
|
||||
purgeall_on_shell = purgeonevents_reg(('ShellCmdPost', 'ShellFilterPost', 'FocusGained'), eventcaches=eventcaches)
|
||||
|
|
|
@ -5,8 +5,9 @@ from copy import copy
|
|||
|
||||
from .segment import Segment
|
||||
|
||||
|
||||
try:
|
||||
unicode()
|
||||
unicode() # NOQA
|
||||
except NameError:
|
||||
unicode = str
|
||||
|
||||
|
|
Loading…
Reference in New Issue