Fix various minor formatting issues

Closes #242.
This commit is contained in:
Kim Silkebækken 2013-02-20 13:47:54 +01:00
parent ee51b8b76c
commit 282cb43eef
9 changed files with 65 additions and 61 deletions

View File

@ -15,7 +15,7 @@ class PowerlinePrompt(BasePrompt):
def auto_rewrite(self): def auto_rewrite(self):
# TODO color this # 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'): def setup(prompt='1'):

View File

@ -5,8 +5,8 @@ ATTR_BOLD = 1
ATTR_ITALIC = 2 ATTR_ITALIC = 2
ATTR_UNDERLINE = 4 ATTR_UNDERLINE = 4
class Colorscheme(object):
class Colorscheme(object):
def __init__(self, colorscheme): def __init__(self, colorscheme):
'''Initialize a colorscheme.''' '''Initialize a colorscheme.'''
self.colors = {} self.colors = {}

View File

@ -3,6 +3,10 @@ import os
from powerline.lib.memoize import memoize from powerline.lib.memoize import memoize
vcs_props = (('git', '.git', os.path.exists),
('mercurial', '.hg', os.path.isdir))
def generate_directories(path): def generate_directories(path):
yield path yield path
while True: while True:
@ -13,9 +17,6 @@ def generate_directories(path):
yield path yield path
vcs_props = (('git', '.git', os.path.exists),
('mercurial', '.hg', os.path.isdir))
@memoize(100) @memoize(100)
def guess(path): def guess(path):
for directory in generate_directories(path): for directory in generate_directories(path):

View File

@ -42,7 +42,7 @@ class Renderer(object):
theme.segment_info.update(segment_info) theme.segment_info.update(segment_info)
# Handle excluded/included segments for the current mode # 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'])] 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)] segments = [segment for segment in self._render_segments(mode, theme, segments)]

View File

@ -191,54 +191,54 @@ def uptime(format='{days:02d}d {hours:02d}h {minutes:02d}m'):
# Weather condition code descriptions available at # Weather condition code descriptions available at
# http://developer.yahoo.com/weather/#codes # http://developer.yahoo.com/weather/#codes
weather_conditions_codes = ( weather_conditions_codes = (
('tornado', 'stormy'), # 0 ('tornado', 'stormy'), # 0
('tropical_storm', 'stormy'), # 1 ('tropical_storm', 'stormy'), # 1
('hurricane', 'stormy'), # 2 ('hurricane', 'stormy'), # 2
('severe_thunderstorms', 'stormy'), # 3 ('severe_thunderstorms', 'stormy'), # 3
('thunderstorms', 'stormy'), # 4 ('thunderstorms', 'stormy'), # 4
('mixed_rain_and_snow', 'rainy' ), # 5 ('mixed_rain_and_snow', 'rainy' ), # 5
('mixed_rain_and_sleet', 'rainy' ), # 6 ('mixed_rain_and_sleet', 'rainy' ), # 6
('mixed_snow_and_sleet', 'snowy' ), # 7 ('mixed_snow_and_sleet', 'snowy' ), # 7
('freezing_drizzle', 'rainy' ), # 8 ('freezing_drizzle', 'rainy' ), # 8
('drizzle', 'rainy' ), # 9 ('drizzle', 'rainy' ), # 9
('freezing_rain', 'rainy' ), # 10 ('freezing_rain', 'rainy' ), # 10
('showers', 'rainy' ), # 11 ('showers', 'rainy' ), # 11
('showers', 'rainy' ), # 12 ('showers', 'rainy' ), # 12
('snow_flurries', 'snowy' ), # 13 ('snow_flurries', 'snowy' ), # 13
('light_snow_showers', 'snowy' ), # 14 ('light_snow_showers', 'snowy' ), # 14
('blowing_snow', 'snowy' ), # 15 ('blowing_snow', 'snowy' ), # 15
('snow', 'snowy' ), # 16 ('snow', 'snowy' ), # 16
('hail', 'snowy' ), # 17 ('hail', 'snowy' ), # 17
('sleet', 'snowy' ), # 18 ('sleet', 'snowy' ), # 18
('dust', 'foggy' ), # 19 ('dust', 'foggy' ), # 19
('fog', 'foggy' ), # 20 ('fog', 'foggy' ), # 20
('haze', 'foggy' ), # 21 ('haze', 'foggy' ), # 21
('smoky', 'foggy' ), # 22 ('smoky', 'foggy' ), # 22
('blustery', 'foggy' ), # 23 ('blustery', 'foggy' ), # 23
('windy', ), # 24 ('windy', ), # 24
('cold', 'day' ), # 25 ('cold', 'day' ), # 25
('clouds', 'cloudy'), # 26 ('clouds', 'cloudy'), # 26
('mostly_cloudy_night', 'cloudy'), # 27 ('mostly_cloudy_night', 'cloudy'), # 27
('mostly_cloudy_day', 'cloudy'), # 28 ('mostly_cloudy_day', 'cloudy'), # 28
('partly_cloudy_night', 'cloudy'), # 29 ('partly_cloudy_night', 'cloudy'), # 29
('partly_cloudy_day', 'cloudy'), # 30 ('partly_cloudy_day', 'cloudy'), # 30
('clear_night', 'night' ), # 31 ('clear_night', 'night' ), # 31
('sun', 'sunny' ), # 32 ('sun', 'sunny' ), # 32
('fair_night', 'night' ), # 33 ('fair_night', 'night' ), # 33
('fair_day', 'day' ), # 34 ('fair_day', 'day' ), # 34
('mixed_rain_and_hail', 'rainy' ), # 35 ('mixed_rain_and_hail', 'rainy' ), # 35
('hot', 'sunny' ), # 36 ('hot', 'sunny' ), # 36
('isolated_thunderstorms', 'stormy'), # 37 ('isolated_thunderstorms', 'stormy'), # 37
('scattered_thunderstorms', 'stormy'), # 38 ('scattered_thunderstorms', 'stormy'), # 38
('scattered_thunderstorms', 'stormy'), # 39 ('scattered_thunderstorms', 'stormy'), # 39
('scattered_showers', 'rainy' ), # 40 ('scattered_showers', 'rainy' ), # 40
('heavy_snow', 'snowy' ), # 41 ('heavy_snow', 'snowy' ), # 41
('scattered_snow_showers', 'snowy' ), # 42 ('scattered_snow_showers', 'snowy' ), # 42
('heavy_snow', 'snowy' ), # 43 ('heavy_snow', 'snowy' ), # 43
('partly_cloudy', 'cloudy'), # 44 ('partly_cloudy', 'cloudy'), # 44
('thundershowers', 'rainy' ), # 45 ('thundershowers', 'rainy' ), # 45
('snow_showers', 'snowy' ), # 46 ('snow_showers', 'snowy' ), # 46
('isolated_thundershowers', 'rainy' ), # 47 ('isolated_thundershowers', 'rainy' ), # 47
) )
# ('day', (25, 34)), # ('day', (25, 34)),
# ('rainy', (5, 6, 8, 9, 10, 11, 12, 35, 40, 45, 47)), # ('rainy', (5, 6, 8, 9, 10, 11, 12, 35, 40, 45, 47)),

View File

@ -6,7 +6,7 @@ import os
try: try:
import vim import vim
except ImportError: except ImportError:
vim = {} vim = {} # NOQA
from powerline.bindings.vim import vim_get_func, getbufvar from powerline.bindings.vim import vim_get_func, getbufvar
from powerline.theme import requires_segment_info from powerline.theme import requires_segment_info
@ -49,15 +49,16 @@ mode_translations = {
} }
eventcaches = defaultdict(lambda : []) eventcaches = defaultdict(lambda: [])
bufeventcaches = defaultdict(lambda : []) bufeventcaches = defaultdict(lambda: [])
def purgeonevents_reg(events, eventcaches=bufeventcaches): def purgeonevents_reg(events, eventcaches=bufeventcaches):
def cache_reg_func(cache): def cache_reg_func(cache):
for event in events: for event in events:
if event not in eventcaches: if event not in eventcaches:
vim.eval('PowerlineRegisterCachePurgerEvent("' + event + '")') vim.eval('PowerlineRegisterCachePurgerEvent("' + event + '")')
eventcaches[event].append(cache) eventcaches[event].append(cache)
return cache_reg_func return cache_reg_func
purgeall_on_shell = purgeonevents_reg(('ShellCmdPost', 'ShellFilterPost', 'FocusGained'), eventcaches=eventcaches) purgeall_on_shell = purgeonevents_reg(('ShellCmdPost', 'ShellFilterPost', 'FocusGained'), eventcaches=eventcaches)

View File

@ -5,8 +5,9 @@ from copy import copy
from .segment import Segment from .segment import Segment
try: try:
unicode() unicode() # NOQA
except NameError: except NameError:
unicode = str unicode = str

View File

@ -11,7 +11,8 @@ try:
except IOError: except IOError:
README = '' README = ''
setup(name='Powerline', setup(
name='Powerline',
version='beta', version='beta',
description='The ultimate statusline/prompt utility.', description='The ultimate statusline/prompt utility.',
long_description=README, long_description=README,