[caribou: 5/6] Don't change layout when switching focus (bug #621654). Thanks David Pellicer!



commit 2787a4d5996a1c3a52411225b1dbdfc6967fa85b
Author: Eitan Isaacson <eitan monotonous org>
Date:   Wed Jun 16 09:08:42 2010 -0700

    Don't change layout when switching focus (bug #621654). Thanks David Pellicer!

 caribou/ui/keyboard.py |    6 ++++++
 caribou/ui/window.py   |   10 ++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/caribou/ui/keyboard.py b/caribou/ui/keyboard.py
index 6ac17fd..6ef8565 100644
--- a/caribou/ui/keyboard.py
+++ b/caribou/ui/keyboard.py
@@ -275,6 +275,7 @@ class CaribouKeyboard(gtk.Notebook):
         self.vk = virtkey.virtkey()
         self.key_size = 30
         self.current_mask = 0
+        self.current_page = 0
 
     def load_kb(self, kb_location):
         kb_deserializer = KbLayoutDeserializer()
@@ -322,6 +323,10 @@ class CaribouKeyboard(gtk.Notebook):
             self.current_mask |= key.value
             self.vk.latch_mod(self.current_mask)
 
+    def show_all(self):
+        self.set_current_page(self.current_page)
+        gtk.Notebook.show_all(self)
+
     def _pressed_preferences_key(self, key):
         KeyboardPreferences()
 
@@ -330,4 +335,5 @@ class CaribouKeyboard(gtk.Notebook):
         for i in range(n_pages):
             if self.get_nth_page(i).layout_name == name:
                 self.set_current_page(i)
+                self.current_page = i
                 break
diff --git a/caribou/ui/window.py b/caribou/ui/window.py
index 14f21ce..d881439 100644
--- a/caribou/ui/window.py
+++ b/caribou/ui/window.py
@@ -40,6 +40,7 @@ class CaribouWindow(gtk.Window):
 
         self._vbox = gtk.VBox()
         self.add(self._vbox)
+        self.keyboard = text_entry_mech
         self._vbox.pack_start(text_entry_mech)
 
         self.connect("size-allocate", lambda w, a: self._update_position())
@@ -148,6 +149,15 @@ class CaribouWindow(gtk.Window):
         if os.path.exists(xml_path):
             return xml_path
 
+
+    def show_all(self):
+        gtk.Window.show_all(self)
+        self.keyboard.show_all()
+
+    def hide_all(self):
+        self.keyboard.hide_all()
+        gtk.Window.hide_all(self)
+
 class CaribouWindowDocked(CaribouWindow, 
                           animation.AnimatedWindowBase,
                           opacity.ProximityWindowBase):



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