[PATCH 3/3] Add layout indicator to the LUKS passphrase dialog

Vratislav Podzimek vpodzime at redhat.com
Wed Apr 10 17:16:41 UTC 2013


This means we can change the warning not to include the static
value for current layout.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/ui/gui/spokes/lib/passphrase.glade | 19 +++++++++++++++++--
 pyanaconda/ui/gui/spokes/lib/passphrase.py    | 20 ++++----------------
 2 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/lib/passphrase.glade b/pyanaconda/ui/gui/spokes/lib/passphrase.glade
index cb08899..4f5dc76 100644
--- a/pyanaconda/ui/gui/spokes/lib/passphrase.glade
+++ b/pyanaconda/ui/gui/spokes/lib/passphrase.glade
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
+  <!-- interface-requires AnacondaWidgets 1.0 -->
   <!-- interface-requires gtk+ 3.0 -->
   <object class="GtkDialog" id="passphrase_dialog">
     <property name="can_focus">False</property>
@@ -186,7 +187,21 @@
               </packing>
             </child>
             <child>
-              <placeholder/>
+              <object class="AnacondaLayoutIndicator" id="AnacondaLayoutIndicator1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="has_tooltip">True</property>
+                <property name="tooltip_markup" translatable="yes">Current layout: &amp;apos;us&amp;apos;. Click to switch to the next layout</property>
+                <property name="tooltip_text" translatable="yes">Current layout: 'us'. Click to switch to the next layout</property>
+                <property name="halign">center</property>
+                <property name="label_width">4</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
             </child>
           </object>
           <packing>
@@ -216,7 +231,7 @@
               <object class="GtkLabel" id="passphrase_warning_label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">keymap warning label</property>
+                <property name="label" translatable="yes">Warning: You want be able to change your keyboard layout (from the default one) when you decrypt your disks after install.</property>
                 <property name="use_markup">True</property>
                 <property name="wrap">True</property>
               </object>
diff --git a/pyanaconda/ui/gui/spokes/lib/passphrase.py b/pyanaconda/ui/gui/spokes/lib/passphrase.py
index ecf2484..3cb7ae5 100644
--- a/pyanaconda/ui/gui/spokes/lib/passphrase.py
+++ b/pyanaconda/ui/gui/spokes/lib/passphrase.py
@@ -19,28 +19,22 @@
 # Red Hat Author(s): David Lehman <dlehman at redhat.com>
 #
 
-from gi.repository import Gtk
-from gi.repository import Gdk
+# pylint: disable-msg=E0611
+from gi.repository import Gtk, Gdk
 
 import gettext
 import pwquality
 
 from pyanaconda.ui.gui import GUIObject
 
-from pyanaconda import keyboard
-
 _ = lambda x: gettext.ldgettext("anaconda", x)
 N_ = lambda x: x
 P_ = lambda x, y, z: gettext.ldngettext("anaconda", x, y, z)
 
 __all__ = ["PassphraseDialog"]
 
-warning_label_template = N_("Warning: Your current keyboard layout is <b>%s</b>."
-                            "If you change your keyboard layout, you may not be "
-                            "able to decrypt your disks after install.")
-
 ERROR_WEAK = N_("You have provided a weak passphrase: %s")
-ERROR_NOT_MATCHING = N_("Passphrases do not match.") 
+ERROR_NOT_MATCHING = N_("Passphrases do not match.")
 
 class PassphraseDialog(GUIObject):
     builderObjects = ["passphrase_dialog"]
@@ -49,7 +43,6 @@ class PassphraseDialog(GUIObject):
 
     def refresh(self):
         super(GUIObject, self).refresh()
-        self._warning_label = self.builder.get_object("passphrase_warning_label")
 
         # disable input methods for the passphrase Entry widgets and make sure
         # the focus change mask is enabled
@@ -78,12 +71,6 @@ class PassphraseDialog(GUIObject):
         self._pwq = pwquality.PWQSettings()
         self._pwq.read_config()
 
-        # update the warning label with the currently selected keymap
-        xkl_wrapper = keyboard.XklWrapper.get_instance()
-        keymap_name = xkl_wrapper.get_current_layout_name()
-        warning_label_text = _(warning_label_template) % keymap_name
-        self._warning_label.set_markup(warning_label_text)
-
         # initialize with the previously set passphrase
         self.passphrase = self.data.autopart.passphrase
 
@@ -98,6 +85,7 @@ class PassphraseDialog(GUIObject):
 
     def run(self):
         self.refresh()
+        self.window.show_all()
         rc = self.window.run()
         self.window.destroy()
         return rc
-- 
1.7.11.7



More information about the anaconda-patches mailing list