[PATCH] Move the encryption checkbox to the dialog
Brian C. Lane
bcl at redhat.com
Wed Feb 13 00:26:13 UTC 2013
From: "Brian C. Lane" <bcl at redhat.com>
This moves the 'Encrypt my data' checkbox from the main storage spoke
into the dialog above the partition type combobox.
---
pyanaconda/ui/gui/spokes/storage.glade | 68 +++++++++++++++++++---------------
pyanaconda/ui/gui/spokes/storage.py | 30 ++++++++++-----
2 files changed, 58 insertions(+), 40 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/storage.glade b/pyanaconda/ui/gui/spokes/storage.glade
index 114d4d2..24a0737 100644
--- a/pyanaconda/ui/gui/spokes/storage.glade
+++ b/pyanaconda/ui/gui/spokes/storage.glade
@@ -158,6 +158,24 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="encryption1_checkbutton">
+ <property name="label" translatable="yes">_Encrypt my data. I'll set a passphrase later.</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="hexpand">True</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_encrypt_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkExpander" id="options1_expander">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -215,7 +233,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
</object>
@@ -456,6 +474,24 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="encryption2_checkbutton">
+ <property name="label" translatable="yes">_Encrypt my data. I'll set a passphrase later.</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="hexpand">True</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_encrypt_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkExpander" id="options2_expander">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -513,7 +549,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">5</property>
</packing>
</child>
</object>
@@ -793,8 +829,6 @@
<property name="vexpand">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
- <property name="xscale">1</property>
- <property name="yscale">1</property>
<child internal-child="action_area">
<object class="GtkBox" id="storageWindow-action_area1">
<property name="can_focus">False</property>
@@ -946,32 +980,6 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="encryption_checkbutton">
- <property name="label" translatable="yes">_Encrypt my data. I'll set a passphrase later.</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="halign">end</property>
- <property name="valign">end</property>
- <property name="hexpand">True</property>
- <property name="use_underline">True</property>
- <property name="xalign">1</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
<placeholder/>
</child>
</object>
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index a3d31ff..6d53bb4 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -147,11 +147,15 @@ class InstallOptions1Dialog(GUIObject):
self.window.destroy()
return rc
- def refresh(self, required_space, disk_free, fs_free, autoPartType):
+ def refresh(self, required_space, disk_free, fs_free, autoPartType, encrypted):
self.autoPartType = autoPartType
self.autoPartTypeCombo = self.builder.get_object("options1_combo")
self.autoPartTypeCombo.set_active(self.autoPartType)
+ self.encrypted = encrypted
+ self.encryptCheckbutton = self.builder.get_object("encryption1_checkbutton")
+ self.encryptCheckbutton.set_active(self.encrypted)
+
options_label = self.builder.get_object("options1_label")
options_text = _("You have <b>%(freeSpace)s</b> of free space, which is "
@@ -241,15 +245,22 @@ class InstallOptions1Dialog(GUIObject):
def on_type_changed(self, combo):
self.autoPartType = combo.get_active()
+ def on_encrypt_toggled(self, checkbox):
+ self.encrypted = checkbox.get_active()
+
class InstallOptions2Dialog(InstallOptions1Dialog):
builderObjects = ["options2_dialog"]
mainWidgetName = "options2_dialog"
- def refresh(self, required_space, disk_free, fs_free, autoPartType):
+ def refresh(self, required_space, disk_free, fs_free, autoPartType, encrypted):
self.autoPartType = autoPartType
self.autoPartTypeCombo = self.builder.get_object("options2_combo")
self.autoPartTypeCombo.set_active(self.autoPartType)
+ self.encrypted = encrypted
+ self.encryptCheckbutton = self.builder.get_object("encryption2_checkbutton")
+ self.encryptCheckbutton.set_active(self.encrypted)
+
sw_text = self._get_sw_needs_text(required_space)
label_text = _("%s\nThe disks you've selected have the following "
"amounts of free space:") % sw_text
@@ -279,7 +290,7 @@ class InstallOptions3Dialog(InstallOptions1Dialog):
builderObjects = ["options3_dialog"]
mainWidgetName = "options3_dialog"
- def refresh(self, required_space, disk_free, fs_free, autoPartType):
+ def refresh(self, required_space, disk_free, fs_free, autoPartType, encrypted):
sw_text = self._get_sw_needs_text(required_space)
label_text = (_("%s\nYou don't have enough space available to install "
"<b>%s</b>, even if you used all of the free space\n"
@@ -501,9 +512,6 @@ class StorageSpoke(NormalSpoke, StorageChecker):
self._previous_autopart = self.autopart
- encrypt_checkbutton = self.builder.get_object("encryption_checkbutton")
- encrypt_checkbutton.set_active(self.encrypted)
-
# update the selections in the ui
overviews = self.local_disks_box.get_children()
for overview in overviews:
@@ -658,9 +666,6 @@ class StorageSpoke(NormalSpoke, StorageChecker):
def _check_encrypted(self):
# even if they're not doing autopart, setting autopart.encrypted
# establishes a default of encrypting new devices
- encrypt_button = self.builder.get_object("encryption_checkbutton")
- self.encrypted = encrypt_button.get_active()
-
if not self.encrypted:
return True
@@ -733,10 +738,12 @@ class StorageSpoke(NormalSpoke, StorageChecker):
else:
dialog = InstallOptions3Dialog(self.data, payload=self.payload)
- dialog.refresh(required_space, disk_free, fs_free, self.autoPartType)
+ dialog.refresh(required_space, disk_free, fs_free, self.autoPartType,
+ self.encrypted)
rc = self.run_lightbox_dialog(dialog)
if rc == dialog.RESPONSE_CONTINUE:
self.autoPartType = dialog.autoPartType
+ self.encrypted = dialog.encrypted
if not self._check_encrypted():
return
@@ -761,6 +768,8 @@ class StorageSpoke(NormalSpoke, StorageChecker):
NormalSpoke.on_back_clicked(self, button)
elif rc == dialog.RESPONSE_RECLAIM:
self.autoPartType = dialog.autoPartType
+ self.encrypted = dialog.encrypted
+
if not self._check_encrypted():
return
@@ -771,6 +780,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
elif rc == dialog.RESPONSE_CUSTOM:
self.autopart = False
self.autoPartType = dialog.autoPartType
+ self.encrypted = dialog.encrypted
self.skipTo = "CustomPartitioningSpoke"
NormalSpoke.on_back_clicked(self, button)
--
1.8.1
More information about the anaconda-patches
mailing list