[rhel5-branch] [PATCH] Close dialogs as canceled if Esc is hit (#773573)

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

 



Esc closes the dialog, but the response ID is different from the
Cancel button's one. So we need to check if the response ID was
the one of the OK button or something else.
---
 gui.py                |    6 +++---
 iw/blpasswidget.py    |    4 ++--
 iw/lvm_dialog_gui.py  |    4 ++--
 iw/network_gui.py     |    8 +++++---
 iw/osbootwidget.py    |    4 ++--
 iw/partition_gui.py   |    2 +-
 iw/raid_dialog_gui.py |    8 ++++----
 7 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/gui.py b/gui.py
index 6e463fc..6e37fe5 100755
--- a/gui.py
+++ b/gui.py
@@ -1047,10 +1047,10 @@ class InstallInterface:
     def getInstallKey(self, anaconda, key = ""):
         d = InstallKeyWindow(anaconda, key)
         rc = d.run()
-        if rc == 0:
-            ret = None
-        else:
+        if rc == 1:
             ret = d.get_key()
+        else:
+            ret = None
         d.destroy()
         return ret
 
diff --git a/iw/blpasswidget.py b/iw/blpasswidget.py
index 1e49cfb..7294a20 100644
--- a/iw/blpasswidget.py
+++ b/iw/blpasswidget.py
@@ -82,7 +82,7 @@ class BootloaderPasswordWidget:
             self.passButton.set_sensitive(False)
             self.setPassLabel()
         else:
-            if self.passwordWindow() == 2:
+            if self.passwordWindow() != 1:
                 widget.set_active(0)
             self.setPassLabel()
 
@@ -129,7 +129,7 @@ class BootloaderPasswordWidget:
 
         while 1:
             rc = dialog.run()
-            if rc == 2:
+            if rc != 1:
                 break
 
             if pwEntry.get_text() != confirmEntry.get_text():
diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index f0aa367..6f85b8b 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -490,7 +490,7 @@ class VolumeGroupEditor:
 
 	while 1:
 	    rc = dialog.run()
-	    if rc == 2:
+	    if rc != 1:
 		dialog.destroy()
 		return
 
@@ -902,7 +902,7 @@ class VolumeGroupEditor:
 	while 1:
 	    rc = self.dialog.run()
 
-	    if rc == 2:
+	    if rc != 1:
 		self.destroy()
 		return None
 
diff --git a/iw/network_gui.py b/iw/network_gui.py
index 2549249..c95bcfe 100644
--- a/iw/network_gui.py
+++ b/iw/network_gui.py
@@ -221,7 +221,8 @@ class NetworkWindow(InstallWindow):
         while rc == 1:
             editwin.run()
             rc = editwin.getInputValidationResults()
-            if rc == 3:
+            if rc == 3 or rc == 0:
+                editwin.close()
                 return
 
         # collect results
@@ -595,9 +596,10 @@ class NetworkDeviceEditWindow:
         self.ptp_table = self.xml.get_widget("ptp_table")
         self.ptp_address = self.xml.get_widget("ptp_ip")
 
-        self.valid_input = 1
+        self.valid_input = 0
 
     def getInputValidationResults(self):
+        # 0=not set (dialog exited with Esc)
         # 1=invalid input
         # 2=valid input
         # 3=cancel pressed
@@ -607,6 +609,7 @@ class NetworkDeviceEditWindow:
         self.toplevel.show_all()
 
     def run(self):
+        self.valid_input = 0
         self.toplevel.run()
 
     def close(self):
@@ -857,7 +860,6 @@ class NetworkDeviceEditWindow:
 
     def cancelClicked(self, args):
         self.valid_input = 3
-        self.toplevel.destroy()
 
     def _setManualIPv4Sensitivity(self, sensitive):
         self.ipv4_address_label.set_sensitive(sensitive)
diff --git a/iw/osbootwidget.py b/iw/osbootwidget.py
index 02d3350..27f5b27 100644
--- a/iw/osbootwidget.py
+++ b/iw/osbootwidget.py
@@ -201,8 +201,8 @@ class OSBootWidget:
         while 1:
             rc = dialog.run()
 
-            # cancel
-            if rc == 2:
+            # cancel or Esc
+            if rc != 1:
                 break
 
             label = labelEntry.get_text()
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index f7a7b75..1b62ce6 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -1302,7 +1302,7 @@ class PartitionWindow(InstallWindow):
 	dialog.show_all()
 	rc = dialog.run()
 	dialog.destroy()
-	if rc == 2:
+	if rc != 1:
 	    return
 
 	# see which option they choose
diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
index 38a8c4a..ea26114 100644
--- a/iw/raid_dialog_gui.py
+++ b/iw/raid_dialog_gui.py
@@ -123,8 +123,8 @@ class RaidEditor:
 	while 1:
 	    rc = self.dialog.run()
 
-	    # user hit cancel, do nothing
-	    if rc == 2:
+	    # user hit cancel or Esc, do nothing
+	    if rc != 1:
 		self.destroy()
 		return None
 
@@ -637,8 +637,8 @@ class RaidCloneDialog:
 	while 1:
 	    rc = self.dialog.run()
 
-	    # user hit cancel, do nothing
-	    if rc == 2:
+	    # user hit cancel or Esc, do nothing
+	    if rc != 1:
 		self.destroy()
 		return None
 
-- 
1.7.4.4

_______________________________________________
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