diff options
author | Martin Sivak <msivak@redhat.com> | 2010-08-23 15:14:06 +0200 |
---|---|---|
committer | Martin Sivak <msivak@redhat.com> | 2010-08-23 16:49:35 +0200 |
commit | b6f503fc174302bdc3fc05dcc33e737432037218 (patch) | |
tree | f12c8b094c2b9573fdb48b6a263bfe517435b859 /pyfirstaidkit | |
parent | 8079f17a282c83825e07b76cd6bec972ba2ba112 (diff) | |
download | firstaidkit-b6f503fc174302bdc3fc05dcc33e737432037218.tar.gz firstaidkit-b6f503fc174302bdc3fc05dcc33e737432037218.tar.xz firstaidkit-b6f503fc174302bdc3fc05dcc33e737432037218.zip |
Add List/Config question (something similar to about:config) and Gtk GUI for it
Diffstat (limited to 'pyfirstaidkit')
-rw-r--r-- | pyfirstaidkit/reporting.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pyfirstaidkit/reporting.py b/pyfirstaidkit/reporting.py index 5c859ee..9151db9 100644 --- a/pyfirstaidkit/reporting.py +++ b/pyfirstaidkit/reporting.py @@ -47,6 +47,7 @@ CHOICE_QUESTION = 990 #a Question object, "reply" specifies a Reports object TEXT_QUESTION = 991 FILENAME_QUESTION = 992 PASSWORD_QUESTION = 993 +CONFIG_QUESTION = 994 ANSWER = 999 #Data sent in reply to a *_QUESTION END = 1000 #End of operations, final message @@ -73,6 +74,18 @@ class Question(object): importance = question_message["importance"], inreplyto = self) question_message["reply"].end(level = FIRSTAIDKIT) +class ConfigQuestion(Question): + """A question that allows list of configurable variables + + Each item is a tuple (id, title, value, tooltip)""" + + def __init__(self, title, description, items): + super(ConfigQuestion, self).__init__(title) + assert len(items) > 0 + self.title = title + self.description = description + self.items = items + class ChoiceQuestion(Question): """A question that offers multiple options. @@ -326,3 +339,13 @@ class Reports(object): def filename_question_wait(self, *args, **kwargs): return self.__blocking_question(self.filename_question, args, kwargs) + + def config_question(self, reply_mb, title, description, items, origin, level = PLUGIN, + importance = logging.ERROR): + q = ConfigQuestion(title, description, items) + self.put(q, origin, level, CONFIG_QUESTION, importance = importance, + reply = reply_mb) + return q + + def config_question_wait(self, *args, **kwargs): + return self.__blocking_question(self.config_question, args, kwargs) |