Skip to content
Browse files

Merge branch 'rc/settings'

  • Loading branch information...
2 parents 3967b5d + b2b0a90 commit 807117c42a61aac62df45f5fa728b552c68c95bb @rctay committed Jan 26, 2014
Showing with 15 additions and 7 deletions.
  1. +3 −5 commands.py
  2. +12 −2 pipe_views.py
View
8 commands.py
@@ -12,9 +12,7 @@ def callback():
setattr(receiver, r_key, val)
settings.add_on_change(s_key, callback)
-def proxy_settings(pipe, view):
- settings = view.settings()
-
+def proxy_settings(pipe, settings):
# scrolling
set_settings_listener(pipe, "scroll_setting", settings, "bv_scroll")
@@ -69,7 +67,7 @@ class Pipe(PlacementPolicy1, PipeViews):
dest_view_name = "Build output"
def on_view_created(self, window, view, pipe):
- proxy_settings(pipe, view)
+ proxy_settings(pipe, view.settings())
window.set_view_index(view, *self.choose_group(window, self.view_launched_build))
@@ -125,7 +123,7 @@ def on_query_context(self, view, key, *args):
pipe = Pipe()
self.pipes[source_view.id()] = pipe
- proxy_settings(pipe, view)
+ proxy_settings(pipe, view.settings())
pipe.prepare_copy(window)
pipe.first_update = True
View
14 pipe_views.py
@@ -4,12 +4,22 @@
class PipeViews(object):
dest_view_name = "Dest"
+ def __setattr__(self, name, value):
+ if name is "enabled_setting":
+ value = value is None or value
+ elif name is "scroll_setting":
+ value = value if value in set(["bottom", "top", "last"]) else "bottom"
+
+ object.__setattr__(self, name, value)
+
def __init__(self):
self.source_last_pos = 0
self.is_running = False
self.last_scroll_region = None
- self.enabled_setting = True
+ # just use None, our internal cleanup ensures sane values anyway
+ self.enabled_setting = None
+ self.scroll_setting = None
self.dest_view = None
@@ -18,7 +28,7 @@ def create_destination(self):
settings = sublime.load_settings("Preferences.sublime-settings")
key = settings.get("buildview_scroll", None)
- self.scroll_setting = key if key in set(["bottom", "top", "last"]) else "bottom"
+ self.scroll_setting = key
dest_view.set_name(self.dest_view_name)

0 comments on commit 807117c

Please sign in to comment.
Something went wrong with that request. Please try again.