syncronize user.py abstraction with CLI and GUI reality

svn: r19671
This commit is contained in:
Paul Franklin 2012-05-27 13:39:40 +00:00
parent 02d0af7c0a
commit 0027f983c0
3 changed files with 41 additions and 19 deletions

View File

@ -69,9 +69,9 @@ class User(gen.user.User):
@type title: str @type title: str
@param message: the message associated with the progress meter @param message: the message associated with the progress meter
@type message: str @type message: str
@param steps: the total number of steps for the progress meter. a value @param steps: the total number of steps for the progress meter.
of 0 indicates that the ending is unknown and the meter should just a value of 0 indicates that the ending is unknown and the
show activity. meter should just show activity.
@type steps: int @type steps: int
@returns: none @returns: none
""" """
@ -118,8 +118,8 @@ class User(gen.user.User):
def prompt(self, title, question): def prompt(self, title, question):
""" """
Ask the user a question. The answer must be "yes" or "no". The user will Ask the user a question. The answer must be "yes" or "no".
be forced to answer the question before proceeding. The user will be forced to answer the question before proceeding.
@param title: the title of the question @param title: the title of the question
@type title: str @type title: str

View File

@ -32,8 +32,8 @@ The User class provides basic interaction with the user.
class User(): class User():
""" """
This class provides a means to interact with the user in an abstract way. 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 This class should be overridden by each respective user interface to
the appropriate interaction (eg. dialogs for GTK, promts for CLI). provide the appropriate interaction (eg. dialogs for GTK, prompts for CLI).
""" """
def begin_progress(self, title, message, steps): def begin_progress(self, title, message, steps):
""" """
@ -43,9 +43,9 @@ class User():
@type title: str @type title: str
@param message: the message associated with the progress meter @param message: the message associated with the progress meter
@type message: str @type message: str
@param steps: the total number of steps for the progress meter. a value @param steps: the total number of steps for the progress meter.
of 0 indicates that the ending is unknown and the meter should just a value of 0 indicates that the ending is unknown and the
show activity. meter should just show activity.
@type steps: int @type steps: int
@returns: none @returns: none
""" """
@ -57,6 +57,12 @@ class User():
""" """
pass pass
def callback(self, percentage, text=None):
"""
Display the precentage.
"""
pass
def end_progress(self): def end_progress(self):
""" """
Stop showing the progress indicator to the user. Stop showing the progress indicator to the user.
@ -65,8 +71,8 @@ class User():
def prompt(self, title, question): def prompt(self, title, question):
""" """
Ask the user a question. The answer must be "yes" or "no". The user will Ask the user a question. The answer must be "yes" or "no".
be forced to answer the question before proceeding. The user will be forced to answer the question before proceeding.
@param title: the title of the question @param title: the title of the question
@type title: str @type title: str
@ -77,7 +83,7 @@ class User():
""" """
return False return False
def warn(self, title, warning): def warn(self, title, warning=""):
""" """
Warn the user. Warn the user.
@ -89,7 +95,7 @@ class User():
""" """
pass pass
def notify_error(self, title, error): def notify_error(self, title, error=""):
""" """
Notify the user of an error. Notify the user of an error.
@ -100,3 +106,19 @@ class User():
@returns: none @returns: none
""" """
pass 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

View File

@ -64,9 +64,9 @@ class User(gen.user.User):
@type title: str @type title: str
@param message: the message associated with the progress meter @param message: the message associated with the progress meter
@type message: str @type message: str
@param steps: the total number of steps for the progress meter. a value @param steps: the total number of steps for the progress meter.
of 0 indicates that the ending is unknown and the meter should just a value of 0 indicates that the ending is unknown and the
show activity. meter should just show activity.
@type steps: int @type steps: int
@returns: none @returns: none
""" """
@ -108,8 +108,8 @@ class User(gen.user.User):
def prompt(self, title, question): def prompt(self, title, question):
""" """
Ask the user a question. The answer must be "yes" or "no". The user will Ask the user a question. The answer must be "yes" or "no".
be forced to answer the question before proceeding. The user will be forced to answer the question before proceeding.
@param title: the title of the question @param title: the title of the question
@type title: str @type title: str