b9e75c5a9f2c v0.0.5

Add boolsetting() and clean up a bit.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 13 Jun 2011 17:27:42 -0400
parents c716ddab8449
children 1a5a7431190f
branches/tags v0.0.5
files plugin/threesomelib/modes.py plugin/threesomelib/settings.py

Changes

--- a/plugin/threesomelib/modes.py	Mon Jun 13 17:24:49 2011 -0400
+++ b/plugin/threesomelib/modes.py	Mon Jun 13 17:27:42 2011 -0400
@@ -1,6 +1,6 @@
 import vim
 from util import buffers, windows
-from settings import setting
+from settings import boolsetting, setting
 from util.io import error
 
 
@@ -130,7 +130,7 @@
     def __init__(self):
         self._current_layout = int(setting('initial_layout_grid', 0))
         self._current_diff_mode = int(setting('initial_diff_grid', 0))
-        self._current_scrollbind = int(setting('initial_scrollbind_grid', 0)) and True or False
+        self._current_scrollbind = boolsetting('initial_scrollbind_grid')
 
         self._number_of_diff_modes = 2
         self._number_of_layouts = 3
@@ -259,7 +259,7 @@
     def __init__(self):
         self._current_layout = int(setting('initial_layout_loupe', 0))
         self._current_diff_mode = int(setting('initial_diff_loupe', 0))
-        self._current_scrollbind = int(setting('initial_scrollbind_loupe', 0)) and True or False
+        self._current_scrollbind = boolsetting('initial_scrollbind_loupe')
 
         self._number_of_diff_modes = 1
         self._number_of_layouts = 1
@@ -314,7 +314,7 @@
     def __init__(self):
         self._current_layout = int(setting('initial_layout_compare', 0))
         self._current_diff_mode = int(setting('initial_diff_compare', 0))
-        self._current_scrollbind = int(setting('initial_scrollbind_compare', 0)) and True or False
+        self._current_scrollbind = boolsetting('initial_scrollbind_compare')
 
         self._number_of_diff_modes = 2
         self._number_of_layouts = 2
@@ -467,7 +467,7 @@
     def __init__(self):
         self._current_layout = int(setting('initial_layout_path', 0))
         self._current_diff_mode = int(setting('initial_diff_path', 0))
-        self._current_scrollbind = int(setting('initial_scrollbind_path', 0)) and True or False
+        self._current_scrollbind = boolsetting('initial_scrollbind_path')
 
         self._number_of_diff_modes = 5
         self._number_of_layouts = 2
--- a/plugin/threesomelib/settings.py	Mon Jun 13 17:24:49 2011 -0400
+++ b/plugin/threesomelib/settings.py	Mon Jun 13 17:27:42 2011 -0400
@@ -8,3 +8,9 @@
         return default
     else:
         return vim.eval(full_name)
+
+def boolsetting(name):
+    if int(setting(name, 0)):
+        return True
+    else:
+        False