[PATCH] Show the event box immediately when setting infobar messages.

David Shea dshea at redhat.com
Fri Jan 16 18:10:30 UTC 2015


The only calls to set_info, set_warning and set_error that were not
immediately followed by a call to window.show_all() were bugs in that
the info bar would not be shown. Move the call to show() into the
widget, instead.
---
 pyanaconda/ui/gui/helpers.py               |  1 -
 pyanaconda/ui/gui/hubs/__init__.py         |  2 --
 pyanaconda/ui/gui/spokes/custom.py         | 22 ----------------------
 pyanaconda/ui/gui/spokes/datetime_spoke.py |  2 --
 pyanaconda/ui/gui/spokes/network.py        |  2 --
 pyanaconda/ui/gui/spokes/storage.py        |  2 --
 widgets/src/BaseWindow.c                   |  1 +
 7 files changed, 1 insertion(+), 31 deletions(-)

diff --git a/pyanaconda/ui/gui/helpers.py b/pyanaconda/ui/gui/helpers.py
index 11b4b15..320f933 100644
--- a/pyanaconda/ui/gui/helpers.py
+++ b/pyanaconda/ui/gui/helpers.py
@@ -90,7 +90,6 @@ class GUISpokeInputCheckHandler(GUIInputCheckHandler):
         self.clear_info()
         if failed_check:
             self.set_warning(failed_check.check_status)
-            self.window.show_all()
 
     # Implemented by GUIObject
     @abstractmethod
diff --git a/pyanaconda/ui/gui/hubs/__init__.py b/pyanaconda/ui/gui/hubs/__init__.py
index a418c19..7da5888 100644
--- a/pyanaconda/ui/gui/hubs/__init__.py
+++ b/pyanaconda/ui/gui/hubs/__init__.py
@@ -220,12 +220,10 @@ class Hub(GUIObject, common.Hub):
         if len(self._incompleteSpokes) == 0:
             if self._checker and not self._checker.check():
                 self.set_warning(self._checker.error_message)
-                self.window.show_all()
         else:
             msg = _("Please complete items marked with this icon before continuing to the next step.")
 
             self.set_warning(msg)
-            self.window.show_all()
 
         self._updateContinueButton()
 
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index dd87a4d..2866011 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -691,7 +691,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             self._update_all_devices_in_selectors()
             self._error = e
             self.set_warning(_(DEVICE_CONFIGURATION_ERROR_MSG))
-            self.window.show_all()
 
             if not removed_device:
                 # nothing more to do
@@ -711,7 +710,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
                     self.refresh()  # this calls self.clear_errors
                     self._error = e
                     self.set_warning(_(UNRECOVERABLE_ERROR_MSG))
-                    self.window.show_all()
                     return False
 
     @ui_storage_logged
@@ -777,7 +775,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
                 self._error = e
                 self.set_warning(_("Device resize request failed. "
                                    "Click for details."))
-                self.window.show_all()
             else:
                 _changed_size = True
 
@@ -851,7 +848,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             self._error = e
             self.set_warning(_("Device reformat request failed. "
                                "Click for details."))
-            self.window.show_all()
         else:
             # first, remove this selector from any old install page(s)
             new_selector = None
@@ -984,7 +980,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             if error:
                 self._error = error
                 self.set_warning(self._error)
-                self.window.show_all()
                 self._populate_right_side(selector)
                 return
 
@@ -1006,7 +1001,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             if error:
                 self._error = error
                 self.set_warning(self._error)
-                self.window.show_all()
                 self._populate_right_side(selector)
                 return
 
@@ -1034,7 +1028,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
                                           raid_level)
         if error:
             self.set_warning(error)
-            self.window.show_all()
             self._populate_right_side(selector)
             return
 
@@ -1225,7 +1218,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             except ValueError as e:
                 self._error = e
                 self.set_error(_("Invalid device name: %s") % name)
-                self.window.show_all()
             else:
                 new_name = use_dev.name
                 log.debug("changing name of %s to %s", old_name, new_name)
@@ -1597,7 +1589,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
 
         # on_info_bar_clicked requires self._error to be set, so set it to the
         # list of all errors and warnings that storage checking found.
-        self.window.show_all()
         self._error = "\n".join(self.errors + self.warnings)
 
         return self._error == ""
@@ -1703,7 +1694,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
                     self.set_info(_("Added new %(type)s to existing "
                                     "container %(name)s.")
                                     % {"type" : type_str, "name" : container.name})
-                    self.window.show_all()
                     e = None
 
             # the factory's error handling has replaced all of the devices
@@ -1714,12 +1704,10 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
                 self._error = e
                 self.set_error(_("Failed to add new device. Click for "
                                  "details."))
-                self.window.show_all()
         except OverflowError as e:
             log.error("invalid size set for partition")
             self._error = e
             self.set_error(_("Invalid partition size set. Use a valid integer."))
-            self.window.show_all()
 
     def on_add_clicked(self, button):
         self._save_right_side(self._current_selector)
@@ -1828,7 +1816,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             self._error = e
             self.set_warning(_("Device removal request failed. Click "
                                "for details."))
-            self.window.show_all()
         else:
             if is_logical_partition:
                 self._storage_playground.removeEmptyExtendedPartitions()
@@ -2000,7 +1987,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         if not disks:
             self._error = "No disks selected. Keeping previous disk set."
             self.set_info(self._error)
-            self.window.show_all()
             return
 
         if set(disks) != self._device_disks:
@@ -2059,7 +2045,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         if not disks:
             self._error = "No disks selected. Not saving changes."
             self.set_info(self._error)
-            self.window.show_all()
             return
 
         log.debug("new container name: %s", name)
@@ -2067,7 +2052,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             self._error = _("Volume Group name %s is already in use. Not "
                             "saving changes.") % name
             self.set_info(self._error)
-            self.window.show_all()
             return
 
         if (set(disks) != set(self._device_disks) or
@@ -2125,7 +2109,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             except ValueError as e:
                 self._error = e
                 self.set_error(_("Invalid device name: %s") % self._device_container_name)
-                self.window.show_all()
                 self._device_container_name = container_name
                 self.on_update_settings_clicked(None)
                 return
@@ -2333,20 +2316,17 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             log.error("doAutoPartition failed: %s", e)
             self._error = e
             self.set_error(_("No disks selected."))
-            self.window.show_all()
         except NotEnoughFreeSpaceError as e:
             # No handling should be required for this.
             log.error("doAutoPartition failed: %s", e)
             self._error = e
             self.set_error(_("Not enough free space on selected disks."))
-            self.window.show_all()
         except (StorageError, BootLoaderError) as e:
             log.error("doAutoPartition failed: %s", e)
             self._reset_storage()
             self._error = e
             self.set_error(_("Automatic partitioning failed. Click "
                              "for details."))
-            self.window.show_all()
         else:
             self._devices = self._storage_playground.devices
             # mark all new containers for automatic size management
@@ -2372,7 +2352,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             self._error = messages
             self.set_error(_("Automatic partitioning failed. Click "
                              "for details."))
-            self.window.show_all()
 
     def on_create_clicked(self, button, autopartTypeCombo):
         # Then do autopartitioning.  We do not do any clearpart first.  This is
@@ -2680,7 +2659,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             self._passphraseEntry.set_text("")
             self.set_warning(_("Failed to unlock encrypted block device. "
                                "Click for details"))
-            self.window.show_all()
             return
 
         log.info("unlocked %s, now going to populate devicetree...", device.name)
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py
index 703e8b8..1648c35 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.py
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py
@@ -1050,11 +1050,9 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
     def _show_no_network_warning(self):
         self.set_warning(_("You need to set up networking first if you "\
                            "want to use NTP"))
-        self.window.show_all()
 
     def _show_no_ntp_server_warning(self):
         self.set_warning(_("You have no working NTP server configured"))
-        self.window.show_all()
 
     def on_ntp_switched(self, switch, *args):
         if switch.get_active():
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index a26bdbf..4f34853 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -1446,7 +1446,6 @@ class NetworkSpoke(FirstbootSpokeMixIn, NormalSpoke):
             msg = _("Host name is not valid: %s") % error
             self.set_warning(msg)
             self.network_control_box.entry_hostname.grab_focus()
-            self.window.show_all()
         else:
             self.clear_info()
             NormalSpoke.on_back_clicked(self, button)
@@ -1516,7 +1515,6 @@ class NetworkStandaloneSpoke(StandaloneSpoke):
             msg = _("Host name is not valid: %s") % error
             self.set_warning(msg)
             self.network_control_box.entry_hostname.grab_focus()
-            self.window.show_all()
         else:
             self.clear_info()
             StandaloneSpoke._on_continue_clicked(self, window, user_data)
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 4ecdfdc..455c394 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -519,7 +519,6 @@ class StorageSpoke(NormalSpoke, StorageChecker):
             self.set_warning(_("Error checking storage configuration.  Click for details."))
         elif self.warnings:
             self.set_warning(_("Warning checking storage configuration.  Click for details."))
-        self.window.show_all()
 
     def initialize(self):
         NormalSpoke.initialize(self)
@@ -691,7 +690,6 @@ class StorageSpoke(NormalSpoke, StorageChecker):
 
         if self.data.bootloader.location == "none":
             self.set_warning(_("You have chosen to skip boot loader installation.  Your system may not be bootable."))
-            self.window.show_all()
         else:
             self.clear_info()
 
diff --git a/widgets/src/BaseWindow.c b/widgets/src/BaseWindow.c
index a70f7cc..a9ce108 100644
--- a/widgets/src/BaseWindow.c
+++ b/widgets/src/BaseWindow.c
@@ -598,6 +598,7 @@ static void anaconda_base_window_set_info_bar(AnacondaBaseWindow *win, GtkMessag
     gtk_container_add(GTK_CONTAINER(content_area), label);
     gtk_info_bar_set_message_type(GTK_INFO_BAR(win->priv->info_bar), ty);
     gtk_widget_show(win->priv->info_bar);
+    gtk_widget_show(win->priv->event_box);
 
     win->priv->info_shown = TRUE;
 }
-- 
2.1.0



More information about the anaconda-patches mailing list