Commit Graph

810 Commits

Author SHA1 Message Date
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
ZyX 00271c2a0c Shut down network_load segment in tests 2013-03-24 22:24:48 +04:00
ZyX 80e55b0c81 Replace update_lock with shutdon_event 2013-03-24 22:24:48 +04:00
Kim Silkebækken 07c2ea1176 Merge remote-tracking branch 'zyx-i/fix-361' into develop 2013-03-24 19:07:44 +01:00
ZyX b6143cf429 Readd log_ prefix and expand log_file 2013-03-24 21:04:09 +04:00
ZyX d27c720279 Fix race condition, don’t rely on detect feature
detect feature is to be tested though
2013-03-24 20:36:28 +04:00
ZyX 7764bcc6a1 Fix logging format
Fixes #361
2013-03-24 20:21:21 +04:00
Kim Silkebækken 68e29a7eba Merge remote-tracking branch 'zyx-i/pl-argument' into develop 2013-03-24 17:11:29 +01:00
ZyX 6c495374a0 Fix exec call for non-python-2.7 2013-03-24 20:03:09 +04:00
ZyX 1351207462 Some fixes for flake8 2013-03-24 19:59:56 +04:00
Kim Silkebækken 5cebad9428 Merge remote-tracking branch 'zyx-i/pl-argument' into develop 2013-03-24 16:52:44 +01:00
ZyX 14d957bdf9 Skip crashed segments 2013-03-24 19:49:54 +04:00
ZyX ca2f0cc873 Do not wait for update lock, exit 2013-03-24 19:49:54 +04:00
ZyX 63a50ad200 Remove run_once from ShellPowerline, fix update_first
run_once will be passed to Powerline as a part of **kwargs
2013-03-24 19:49:54 +04:00
ZyX 7370876c35 Make scripts/powerline use os.environ['PWD'] for .getcwd() if present
Closes #330
2013-03-24 19:49:54 +04:00