[PATCH 2/6] Add an InputCheckHandler subclass for dialogs.
David Shea
dshea at redhat.com
Mon Mar 31 20:05:31 UTC 2014
This provides a method to set an entry's secondary icon with an error
tooltip, like we currently do with the LUKS passphrase entry widgets.
---
pyanaconda/ui/helpers.py | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/pyanaconda/ui/helpers.py b/pyanaconda/ui/helpers.py
index e0ec1f5..7961e92 100644
--- a/pyanaconda/ui/helpers.py
+++ b/pyanaconda/ui/helpers.py
@@ -65,6 +65,8 @@ from pyanaconda.i18n import _
import logging
import copy
+from gi.repository import Gtk
+
class StorageChecker(object):
__metaclass__ = ABCMeta
@@ -382,6 +384,28 @@ class GUIInputCheckHandler(InputCheckHandler):
input_obj.connect_after("changed", self._update_check_status, checkRef)
return checkRef
+class GUIDialogInputCheckHandler(GUIInputCheckHandler):
+ """Provide InputCheckHandler functionality for Gtk dialogs.
+
+ This class provides a helper method for setting an error message
+ on an entry field. Implementors of this class must still provide
+ a set_status method in order to control the sensitivty of widgets or
+ ignore activated signals.
+ """
+
+ __metaclass__ = ABCMeta
+
+ @abstractmethod
+ def set_status(self, inputcheck):
+ if inputcheck.check_status == InputCheck.CHECK_OK:
+ inputcheck.input_obj.set_icon_from_icon_name(Gtk.EntryIconPosition.SECONDARY, None)
+ inputcheck.input_obj.set_icon_tooltip_text(Gtk.EntryIconPosition.SECONDARY, "")
+ else:
+ inputcheck.input_obj.set_icon_from_icon_name(Gtk.EntryIconPosition.SECONDARY,
+ "gtk-dialog-error")
+ inputcheck.input_obj.set_icon_tooltip_text(Gtk.EntryIconPosition.SECONDARY,
+ inputcheck.check_status)
+
class GUISpokeInputCheckHandler(GUIInputCheckHandler):
"""Provide InputCheckHandler functionality for graphical spokes.
--
1.9.0
More information about the anaconda-patches
mailing list