[master 2/9] iscsi gui: make the iSCSI wizard never return gtk constants.

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

 



This is in preparation for making the addIscsiDrive() code same for both
the GUI/TUI.
---
 pyanaconda/iw/advanced_storage.py |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/pyanaconda/iw/advanced_storage.py b/pyanaconda/iw/advanced_storage.py
index 2b811f4..55cb124 100644
--- a/pyanaconda/iw/advanced_storage.py
+++ b/pyanaconda/iw/advanced_storage.py
@@ -210,16 +210,19 @@ class iSCSIWizard(object):
 
     def _normalize_dialog_response(self, value):
         """
-        One can not use named GTK constants in glade, but we can get them by
-        filtering through this method.
+        Maps the glade return values to a boolean.
+
+        Returns True upon success.
         """
-        if value == 1:
-            return gtk.RESPONSE_OK
+        if value == 1: 
+            # gtk.RESPONSE_OK
+            return True 
         elif value == -6:
-            return gtk.RESPONSE_CANCEL
+            # gtk.RESPONSE_CANCEL
+            return False 
         elif value == gtk.RESPONSE_DELETE_EVENT: 
             # escape pressed to dismiss the dialog
-            return gtk.RESPONSE_CANCEL
+            return False
         else:
             raise ValueError("Unexpected dialog box return value: %d" % value)
         
@@ -441,7 +444,7 @@ def addIscsiDrive(anaconda):
                 rc = wizard.display_discovery_dialog(
                     anaconda.storage.iscsi.initiator,
                     anaconda.storage.iscsi.initiatorSet)
-                if rc == gtk.RESPONSE_CANCEL:
+                if not rc:
                     break
                 anaconda.storage.iscsi.initiator = wizard.get_initiator()
                 discovery_dict = wizard.get_discovery_dict()
@@ -458,12 +461,12 @@ def addIscsiDrive(anaconda):
                                                 _("No new iSCSI nodes discovered"))
                     break
                 (rc, selected_nodes) = wizard.display_nodes_dialog(found_nodes)
-                if rc == gtk.RESPONSE_CANCEL or len(selected_nodes) == 0:
+                if not rc or len(selected_nodes) == 0:
                     break
                 step = STEP_LOGIN
             elif step == STEP_LOGIN:
                 rc = wizard.display_login_dialog()
-                if rc == gtk.RESPONSE_CANCEL:
+                if not rc:
                     break
                 login_dict = wizard.get_login_dict()
                 log.critical("logging with %s" % login_dict)
@@ -485,7 +488,7 @@ def addIscsiDrive(anaconda):
                 rc = wizard.display_success_dialog(login_ok_nodes, 
                                                    login_fail_nodes,
                                                    login_fail_msg)
-                if rc == gtk.RESPONSE_OK:
+                if rc:
                     step = STEP_DONE
                 else:
                     # user wants to try logging into the failed nodes again
-- 
1.7.1.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux