Commit Graph

624 Commits

Author SHA1 Message Date
ZyX 4e5bd54f79 Fix cwd segment, add use_path_separator option
cwd segment was not drawing inner separators because of new default for 
multisegment functions. use_path_separator was added because current variant 
looks bad for my taste.
2013-04-02 19:01:03 +04:00
ZyX 992e6151eb Remove update_first set from set_state
It is already handled correctly in .render() method
2013-04-02 17:37:03 +04:00
ZyX 66beaaaa9d Replace draw_soft_divider setting with draw_inner_divider
If weather or system_load segments were moved to the left draw_soft_divider
variant resulted in incorrect renderring. Thus it was replaced by
draw_inner_divider.
2013-04-02 17:22:55 +04:00
ZyX f15cdd9413 Replace draw_divider setting with draw_(soft|hard)_divider
Previous variant was bad because
1. draw_divider only applied to soft dividers. Hard dividers were always drawn
2. But there was a hack with width=auto segments: for this segments draw_divider 
   setting applied always.

Now there are no additional dependencies: draw_*_divider applies no matter what 
other properties of the segment are.
2013-04-02 17:21:22 +04:00
Kim Silkebækken fcc009a6f5 Merge remote-tracking branch 'mspaulding06/hostname_exclude_domain' into develop
Conflicts:
	powerline/segments/common.py
	tests/test_segments.py
2013-04-02 11:29:08 +02:00
Kim Silkebækken 3d72a227dd Merge remote-tracking branch 'zyx-i/autoreload-config' into develop 2013-04-02 11:03:55 +02:00
ZyX b7c61f8bf6 Handle removed and then added files
Note: if user configuration was removed, but global configuration was not it 
will start tracking global configuration file for changes.
2013-04-02 00:27:54 +04:00
ZyX 4d1dc0658b Remove unexistent kwargs 2013-04-01 00:01:51 +04:00
ZyX 46b5063ea8 Remove unused import 2013-03-31 15:01:06 +04:00
ZyX d1e79000b5 Add tests for reloading theme and colorscheme 2013-03-31 14:57:43 +04:00
ZyX 54471569ab Check whether it switches configuration fine 2013-03-31 14:53:21 +04:00
ZyX 8c3be65bba Added test for colors config reloading 2013-03-31 13:37:07 +04:00
ZyX e35b1541e8 Make it possible to supply different watcher
Used in tests
2013-03-31 13:36:41 +04:00
Matt Spaulding 3a6c0ab8fd Add test for hostname exclude_domain option 2013-03-30 15:32:29 -07:00
Matt Spaulding e03e864f69 Add exclude_domain option to hostname segment
Provides an option to return only the hostname if an fqdn is returned by
socket.gethostname()
2013-03-30 15:09:01 -07:00
ZyX 5a50acf16b Add initial tests for configuration reloading
Currently only:
- Test for not reloading configuration if run_once is not True
- Test for reloading main configuration and other configurations triggered by 
  changes in main configuration file

TODO: tests for all other configuration files reloading (colors, colorscheme, 
      theme).
2013-03-31 00:06:49 +04:00
ZyX c6be4426d3 Fix whitespace errors 2013-03-31 00:03:35 +04:00
ZyX c2ceac093f Add replace_item with function, remove os import 2013-03-31 00:02:53 +04:00
ZyX 26412c3aff Add watching interval customization, some fixes
Custom interval (zero) will be used in tests.
Fixes:
- wrong check for subscribers receiving all events
- missing prev_ext_config setting that meant theme and colorscheme always
  reloaded if main configuration was reloaded
2013-03-30 23:57:21 +04:00
ZyX 3ebc16a48c Replace pl.environ/getcwd/home with segment_info 2013-03-30 21:55:00 +04:00
ZyX 854216810e Change spaces in vim renderer 2013-03-30 21:52:05 +04:00
ZyX 3061738506 Collect all renderer options into one dictionary 2013-03-30 21:51:30 +04:00
ZyX 452e7780eb Add extension to prefix when logging 2013-03-30 21:50:11 +04:00
ZyX 90c8020e09 Use monotonic clock, not time.time 2013-03-30 18:12:55 +04:00
ZyX a31d6f00a7 Rename update_state to branch in powerline.segments.vim.BranchSegment 2013-03-30 16:58:18 +04:00
ZyX 388cccb3cf Add write_lock to KwThreadedSegment
Otherwise it is not safe to use. ThreadedSegment does not need write locks.

New variant spends much less time locked in both threads
2013-03-30 16:57:04 +04:00
ZyX e2b13d9bba Also catch keyboard interrupts while updating
This will skip segments and issue a warning to log.
2013-03-30 16:54:43 +04:00
ZyX bc1a3e4c1d Allow overriding renderer module with any module
Will be used in tests. Allows renderer modules (and extensions) that look like 
`foo.bar`: it will import `foo.bar` and not `powerline.renderers.foo.bar` like 
before.
2013-03-30 16:53:04 +04:00
ZyX 34c775f628 Fix problem with updating value: it was not updated in a thread 2013-03-30 16:51:04 +04:00
ZyX 655549440b Use daemon threads by default
Note: current implementation runs `thread.join()` to ensure that thread is not 
shut down while updating, but this works only with regular shutdown. If shutdown 
is somehow done without triggering VimLeavePre (for vim) threads can be 
terminated at any state.

Closes #368
Closes #371
2013-03-30 15:54:33 +04:00
ZyX 29f29213a9 Remove ThreadedSegment.write_lock
Assuming getattr(self, 'update_value') and setattr(self, 'update_value', value) 
are atomic. True with cpython unless somebody defined __getattribute__ or 
__setattr__.
2013-03-30 14:07:24 +04:00
ZyX ff6fd64339 Only access watcher through proxy
This is a fix for powerline-daemon: otherwise the first powerline object that 
did `watcher(file)` will receive file changed event and other powerline objects 
will not.
2013-03-30 13:56:03 +04:00
ZyX 38081239f2 Remove self.sleep call 2013-03-26 21:31:05 +04:00
ZyX ee23c57d6a Purge configs in another place
Loading main configuration does not necessary imply loading other configurations
2013-03-26 18:37:29 +04:00
ZyX e5db01193c Add missing PowerlineState.use_daemon_threads assignment 2013-03-26 08:20:32 +04:00
ZyX 878b808e9e Workaround deadlock in ipython
shutdown_hook is called after all non-daemon threads exit, but it is needed for 
them to exit. Thus I had to use daemon threads in ipython or find some hack to 
make .shutdown be called earlier.
2013-03-26 08:12:35 +04:00
ZyX 27c9a05782 Change indentation of closing }, ], ) and combinations of them 2013-03-25 19:04:18 +04:00
ZyX ada5dede25 Fix network_load test
It was using old network_load.sleep and also was not shutting down network_load 
in case it failed test
2013-03-25 18:45:43 +04:00
ZyX 3f53aa298a Use global watcher 2013-03-25 18:43:29 +04:00
ZyX fc6636cf57 Clear Powerline.configs when loading main configuration
It should eventually clear out stale watches.
2013-03-25 18:41:38 +04:00
ZyX 7646c949e2 Automatically reload configuration
Needs testing
2013-03-25 18:24:17 +04:00
ZyX 5d1089f252 Some fixes for flake8, remove executable bit and shebang 2013-03-25 18:24:17 +04:00
ZyX 559b5caef2 Take file_watcher from @kovidgoyal develop branch 2013-03-25 18:24:17 +04:00
ZyX 80ddbfbf9a Split Powerline.__init__ into __init__ and create_renderer
Target: with long-living Powerline objects periodically reload configuration 
recreating renderer. Use file watchers to watch for configuration. Configuration 
should be able to be safely reloaded in non-blocking mode in a separate thread 
up to the time when it comes to recreating renderer.

This commit does not add anything that actually reloads the configuration, 
multiple runs of .create_renderer were not tested.
2013-03-25 18:24:16 +04:00
Kim Silkebækken bc7c5b784d Merge branch 'update-docs' into develop
TODO:

* Add info about code layout, debugging tips, etc.
* Add "developing powerline" section to docs (not contributing document)

Ref #287
2013-03-25 13:55:31 +01:00
Kim Silkebækken 40436c549a Merge remote-tracking branch 'zyx-i/no-update_lock' into develop 2013-03-25 13:49:50 +01:00
ZyX 92652ca5c4 Some fixes for flake8 2013-03-25 00:10:54 +04:00
ZyX 8c63d20880 Fix update_first 2013-03-24 22:39:31 +04:00
ZyX 3aab9ef96c Make zsh/zpython also call .shutdown correctly 2013-03-24 22:24:48 +04:00
ZyX 3809b8b3b5 Allow multiple shutdowns with multiple starts 2013-03-24 22:24:48 +04:00