[caribou/kb-rework: 13/13] Load with json or xml extension.



commit e28caa779ead199fcc7f3c01fc8e77b57e8cd227
Author: Eitan Isaacson <eitan monotonous org>
Date:   Thu Jun 10 08:32:34 2010 -0700

    Load with json or xml extension.

 caribou/window.py |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/caribou/window.py b/caribou/window.py
index 738dfb6..4fe5b82 100644
--- a/caribou/window.py
+++ b/caribou/window.py
@@ -134,12 +134,18 @@ class CaribouWindow(gtk.Window):
         return offset
 
     def _get_keyboard_conf(self):
-        layout = self._gconf_client.get_string(CARIBOU_GCONF_LAYOUT_KEY)
-        if not layout:
-            return None
+        layout = self._gconf_client.get_string(CARIBOU_GCONF_LAYOUT_KEY) \
+            or "qwerty"
         conf_file_path = os.path.join(data_path, CARIBOU_LAYOUT_DIR, layout)
-        if os.path.exists(conf_file_path):
-            return conf_file_path
+
+        xml_path = '.'.join([conf_file_path, "xml"])
+        json_path = '.'.join([conf_file_path, "json"])
+
+        if os.path.exists(json_path):
+            return json_path
+
+        if os.path.exists(xml_path):
+            return xml_path
 
 class CaribouWindowDocked(CaribouWindow, 
                           animation.AnimatedWindowBase,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]