diff options
author | nfnty <git@nfnty.se> | 2016-02-25 08:36:05 +0100 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2016-02-25 08:36:05 +0100 |
commit | cfc9f99e77eb00c1c9793a57af0a551f9b406605 (patch) | |
tree | 766dc4340a996acffd792dd6915e6347d1731998 | |
parent | 5c2d64fe93d72da39ca7ffc6cf83f7e0395df524 (diff) | |
download | ranger-cfc9f99e77eb00c1c9793a57af0a551f9b406605.tar.gz |
VCS: Lazily initialize UI.vcsthread
-rw-r--r-- | ranger/gui/ui.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index ff3ced57..41b57c2c 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -10,6 +10,7 @@ import threading from .displayable import DisplayableContainer from .mouse_event import MouseEvent from ranger.ext.keybinding_parser import KeyBuffer, KeyMaps, ALT_KEY +from ranger.ext.lazy_property import lazy_property MOUSEMASK = curses.ALL_MOUSE_EVENTS | curses.REPORT_MOUSE_POSITION @@ -221,7 +222,6 @@ class UI(DisplayableContainer): from ranger.gui.widgets.statusbar import StatusBar from ranger.gui.widgets.taskview import TaskView from ranger.gui.widgets.pager import Pager - from ranger.ext.vcs import VcsThread # Create a title bar self.titlebar = TitleBar(self.win) @@ -252,9 +252,13 @@ class UI(DisplayableContainer): self.pager.visible = False self.add_child(self.pager) - # Create VCS thread - self.vcsthread = VcsThread(self) - self.vcsthread.start() + @lazy_property + def vcsthread(self): + """VCS thread""" + from ranger.ext.vcs import VcsThread + thread = VcsThread(self) + thread.start() + return thread def redraw(self): """Redraw all widgets""" |