From 0027f983c0992cd3656acc81f3627f9d74d330f3 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Sun, 27 May 2012 13:39:40 +0000 Subject: [PATCH] syncronize user.py abstraction with CLI and GUI reality svn: r19671 --- src/cli/user.py | 10 +++++----- src/gen/user.py | 40 +++++++++++++++++++++++++++++++--------- src/gui/user.py | 10 +++++----- 3 files changed, 41 insertions(+), 19 deletions(-) diff --git a/src/cli/user.py b/src/cli/user.py index 501c624cd..51337e7f6 100644 --- a/src/cli/user.py +++ b/src/cli/user.py @@ -69,9 +69,9 @@ class User(gen.user.User): @type title: str @param message: the message associated with the progress meter @type message: str - @param steps: the total number of steps for the progress meter. a value - of 0 indicates that the ending is unknown and the meter should just - show activity. + @param steps: the total number of steps for the progress meter. + a value of 0 indicates that the ending is unknown and the + meter should just show activity. @type steps: int @returns: none """ @@ -118,8 +118,8 @@ class User(gen.user.User): def prompt(self, title, question): """ - Ask the user a question. The answer must be "yes" or "no". The user will - be forced to answer the question before proceeding. + Ask the user a question. The answer must be "yes" or "no". + The user will be forced to answer the question before proceeding. @param title: the title of the question @type title: str diff --git a/src/gen/user.py b/src/gen/user.py index e54e1bff4..e47b96131 100644 --- a/src/gen/user.py +++ b/src/gen/user.py @@ -32,8 +32,8 @@ The User class provides basic interaction with the user. class User(): """ This class provides a means to interact with the user in an abstract way. - This class should be overridden by each respective user interface to provide - the appropriate interaction (eg. dialogs for GTK, promts for CLI). + This class should be overridden by each respective user interface to + provide the appropriate interaction (eg. dialogs for GTK, prompts for CLI). """ def begin_progress(self, title, message, steps): """ @@ -43,9 +43,9 @@ class User(): @type title: str @param message: the message associated with the progress meter @type message: str - @param steps: the total number of steps for the progress meter. a value - of 0 indicates that the ending is unknown and the meter should just - show activity. + @param steps: the total number of steps for the progress meter. + a value of 0 indicates that the ending is unknown and the + meter should just show activity. @type steps: int @returns: none """ @@ -57,6 +57,12 @@ class User(): """ pass + def callback(self, percentage, text=None): + """ + Display the precentage. + """ + pass + def end_progress(self): """ Stop showing the progress indicator to the user. @@ -65,8 +71,8 @@ class User(): def prompt(self, title, question): """ - Ask the user a question. The answer must be "yes" or "no". The user will - be forced to answer the question before proceeding. + Ask the user a question. The answer must be "yes" or "no". + The user will be forced to answer the question before proceeding. @param title: the title of the question @type title: str @@ -77,7 +83,7 @@ class User(): """ return False - def warn(self, title, warning): + def warn(self, title, warning=""): """ Warn the user. @@ -89,7 +95,7 @@ class User(): """ pass - def notify_error(self, title, error): + def notify_error(self, title, error=""): """ Notify the user of an error. @@ -100,3 +106,19 @@ class User(): @returns: none """ pass + + def notify_db_error(self, error): + """ + Notify the user of a DB error. + + @param error: the error message + @type error: str + @returns: none + """ + pass + + def info(self, msg1, infotext, parent=None, monospaced=False): + """ + Displays information to the user + """ + pass diff --git a/src/gui/user.py b/src/gui/user.py index bd40aacf8..e8d0b21c0 100644 --- a/src/gui/user.py +++ b/src/gui/user.py @@ -64,9 +64,9 @@ class User(gen.user.User): @type title: str @param message: the message associated with the progress meter @type message: str - @param steps: the total number of steps for the progress meter. a value - of 0 indicates that the ending is unknown and the meter should just - show activity. + @param steps: the total number of steps for the progress meter. + a value of 0 indicates that the ending is unknown and the + meter should just show activity. @type steps: int @returns: none """ @@ -108,8 +108,8 @@ class User(gen.user.User): def prompt(self, title, question): """ - Ask the user a question. The answer must be "yes" or "no". The user will - be forced to answer the question before proceeding. + Ask the user a question. The answer must be "yes" or "no". + The user will be forced to answer the question before proceeding. @param title: the title of the question @type title: str