Module pisicli :: Class CLICallback
[hide private]
[frames] | no frames]

Class CLICallback

source code

pisiprogress.AbstractCallback --+
                                |
                               CLICallback

Command Line Interface to PISI

Instance Methods [hide private]
 
__init__(self, verbose)
Constructor
source code
 
message(self, st)
Output the string to console
source code
 
error(self, st)
Redirect to message
source code
 
verbose(self, st)
Only redirect to message if we are in verbose mode
source code
 
promptGeneric(self, prompt, default)
Prepare a prompt and return the user input
source code
 
promptGenericConfirmation(self, prompt)
Ask user for a single confirmation (OK / Cancel)
source code
 
update(self, status)
If we are not in verbose mode, we display the progress here
source code
 
_strFixedLen(self, str, width, spaces=' ')
Supporting function to print a string with a fixed length (good for tables)
source code
 
_getDetailValue(self, dict, key, default='<n.a.>')
Gets around the problem if an attribute in one data source is not set in the other one at all
source code
 
_printConflictDetails(self, entry1, entry2, nameSource1, nameSource2)
Supporting function to show differences for two contact entries
source code
 
askConfirmation(self, source, idList)
Use interaction for choosing which contact entry to keep in case of a conflict
source code

Inherited from pisiprogress.AbstractCallback: promptFilename

Method Details [hide private]

__init__(self, verbose)
(Constructor)

source code 

Constructor

Remember whether we are in verbose mode.

Overrides: pisiprogress.AbstractCallback.__init__

message(self, st)

source code 

Output the string to console

Overrides: pisiprogress.AbstractCallback.message

error(self, st)

source code 

Redirect to message

Overrides: pisiprogress.AbstractCallback.error

verbose(self, st)

source code 

Only redirect to message if we are in verbose mode

Overrides: pisiprogress.AbstractCallback.verbose

promptGeneric(self, prompt, default)

source code 

Prepare a prompt and return the user input

If user input is empty, the provided default is returned.

Overrides: pisiprogress.AbstractCallback.promptGeneric

promptGenericConfirmation(self, prompt)

source code 

Ask user for a single confirmation (OK / Cancel)

Overrides: pisiprogress.AbstractCallback.promptGenericConfirmation

update(self, status)

source code 

If we are not in verbose mode, we display the progress here

Overrides: pisiprogress.AbstractCallback.update

_strFixedLen(self, str, width, spaces=' ')

source code 

Supporting function to print a string with a fixed length (good for tables)

Cuts the string when too long and fills up with characters when too short.

_getDetailValue(self, dict, key, default='<n.a.>')

source code 

Gets around the problem if an attribute in one data source is not set in the other one at all

Returns default value if the attribute is not available in the given dictionery (key error).

_printConflictDetails(self, entry1, entry2, nameSource1, nameSource2)

source code 

Supporting function to show differences for two contact entries

Prints a table with all attributes being different in the two sources for comparing two contact entries.

askConfirmation(self, source, idList)

source code 

Use interaction for choosing which contact entry to keep in case of a conflict

Iterates through the given list of contact IDs and requests the user for choosing an action for every single entry.

Returns:
A dictionary which contains the action for each conflict entry; the key is the id of the contact entry, the value one out of a - keep entry from first source, b - keep value from second source and s - skip this entry (no change on either side)
Overrides: pisiprogress.AbstractCallback.askConfirmation