[caribou] Fixes the checks of existing layouts



commit 9be34af3f81ed10834ab9c7039a2b254c0b5d862
Author: Daniel Baeyens <dbaeyens warp es>
Date:   Sun Jun 20 15:48:21 2010 +0200

    Fixes the checks of existing layouts
    
    With new json backend, the way to autodetect layouts
    has changed. It tries looking for .json files and then
    for .xml ones, but if the configuration has the suffix
    already, then fails and do not load anything.
    
    Now, it first checks if the configured layout exists.
    If not, then it fallbacks to the standard autodetection
    
    https://bugzilla.gnome.org/show_bug.cgi?id=622221

 caribou/ui/window.py |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/caribou/ui/window.py b/caribou/ui/window.py
index d881439..72647a2 100644
--- a/caribou/ui/window.py
+++ b/caribou/ui/window.py
@@ -3,6 +3,8 @@
 # Caribou - text entry and UI navigation application
 #
 # Copyright (C) 2009 Eitan Isaacson <eitan monotonous org>
+# Copyright (C) 2010 Warp Networks S.L.
+#  * Contributor: Daniel Baeyens <dbaeyens warp es>
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License as published by the
@@ -139,15 +141,18 @@ class CaribouWindow(gtk.Window):
             or "qwerty"
         conf_file_path = os.path.join(data_path, CARIBOU_LAYOUT_DIR, layout)
 
-        json_path = '%s.json' % conf_file_path
+        if os.path.exists(conf_file_path):
+            return conf_file_path
+        else:
+            json_path = '%s.json' % conf_file_path
 
-        if os.path.exists(json_path):
-            return json_path
+            if os.path.exists(json_path):
+                return json_path
 
-        xml_path = '%s.xml' % conf_file_path
+            xml_path = '%s.xml' % conf_file_path
 
-        if os.path.exists(xml_path):
-            return xml_path
+            if os.path.exists(xml_path):
+                return xml_path
 
 
     def show_all(self):



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