Module phonebook
[hide private]
[frames] | no frames]

Module phonebook

source code

A widget for displaying/editting the phone information

The format for a phonebook entry is standardised. It is a dict with the following fields. Each field is a list, most important first, with each item in the list being a dict.

names:

categories:

emails:

maillist:

urls:

ringtones:

addresses:

wallpapers:

flags:

memos:

numbers:

serials:

Classes [hide private]
  phonebookdataobject
  PhoneEntryDetailsView
  PhoneDataTable
  PhoneWidget
Main phone editing/displaying widget
  ImportCellRenderer
  ImportDataTable
  ImportDialog
The dialog for mixing new (imported) data with existing data
  ImportedEntryMatchDialog
The dialog shown to select how an imported entry should match
  EntryMatcher
Implements matching phonebook entries
  ColumnSelectorDialog
The dialog for selecting what columns you want to view
  PhonebookPrintDialog
Functions [hide private]
 
formatICE(iceindex) source code
 
formatFav(favoriteindex) source code
 
formatcategories(cats) source code
 
formataddress(address) source code
 
formattypenumber(number) source code
 
formatnumber(number) source code
 
formatstorage(flag) source code
 
formatsecret(flag) source code
 
getdata(column, entry, default=None)
Returns the value in a particular column.
source code
 
getdatainfo(column, entry)
Similar to getdata except returning higher level information.
source code
 
_htmlfixup(txt) source code
 
workaroundyetanotherwxpythonbug(method, *args) source code
 
dictintersection(one, two) source code
 
comparenames(s, a)
Give a score on two names
source code
 
cleanurl(url, mode='compare')
Returns lowercase url with the "http://" prefix removed and in lower case
source code
 
cleanemail(email, mode='compare')
Returns lowercase email
source code
 
cleannumber(num)
Returns num (a phone number) with all non-digits removed
source code
 
comparenumbers(s, a)
Give a score on two phone numbers
source code
 
comparefields(s, a, valuekey, threshold=0.8, lookat=3)
Compares the valuekey field in source and against lists returning a score for closeness of match
source code
 
compareallfields(s, a, fields, threshold=0.8, lookat=3)
Like comparefields, but for source and against lists where multiple keys have values in each item
source code
 
mergenumberlists(orig, imp)
Return the results of merging two lists of numbers
source code
 
default_cleaner(x) source code
 
mergefields(orig, imp, field, threshold=0.88, cleaner=<function <lambda> at 0x039A88F0>)
Return the results of merging two lists of fields
source code
 
comparestrings(origfield, impfield)
Compares two strings and returns the score using winkler routine from Febrl (stringcmp.py)
source code
 
normalise_data(entries) source code
 
htmlify(string) source code
Variables [hide private]
  phonebookobjectfactory = database.dataobjectfactory(phonebookd...
  ll = ['Home', ('numbers', 0, ('type', 'home'), <function forma...
  _getdatatable = {'Address': ('addresses', 0, None, <function f...
  AvailableColumns = ['Name', 'First', 'Middle', 'Last', 'Catego...
  DefaultColumns = ['Name', 'Phone', 'Phone2', 'Phone3', 'Email'...
  ImportColumns = ['Name', 'Categories', 'Home', 'Home2', 'Home3...
  CategoryManager = CategoryManager()
  nondigits = re.compile(r'[^0-9]')
  actual = 'data'
  n = 76
  pretty = 'Data'
  suf = '3'
  x = 76
Function Details [hide private]

getdata(column, entry, default=None)

source code 

Returns the value in a particular column. Note that the data is appropriately formatted.

Parameters:
  • column - column name
  • entry - the dict representing a phonebook entry
  • default - what to return if the entry has no data for that column

getdatainfo(column, entry)

source code 

Similar to getdata except returning higher level information.

Returns the key name and which index from the list corresponds to the column.

Parameters:
  • column - Column name
  • entry - The dict representing a phonebook entry
Returns:
(keyname, index) tuple. index will be None if the entry doesn't have the relevant column value and -1 if all of them apply

cleanurl(url, mode='compare')

source code 

Returns lowercase url with the "http://" prefix removed and in lower case

Parameters:
  • mode - If the value is compare (default), it removes ""http://www."" in preparation for comparing entries. Otherwise, if the value is pb, the result is formatted for writing to the phonebook.

compareallfields(s, a, fields, threshold=0.8, lookat=3)

source code 

Like comparefields, but for source and against lists where multiple keys have values in each item

Parameters:
  • fields - This should be a list of keys from the entries that are in the order the human would write them down.

mergenumberlists(orig, imp)

source code 

Return the results of merging two lists of numbers

We compare the sanitised numbers (ie after punctuation etc is stripped out). If they are the same, then the original is kept (since the number is the same, and the original most likely has the correct punctuation).

Otherwise the imported entries overwrite the originals

mergefields(orig, imp, field, threshold=0.88, cleaner=<function <lambda> at 0x039A88F0>)

source code 

Return the results of merging two lists of fields

We compare the fields. If they are the same, then the original is kept (since the name is the same, and the original most likely has the correct punctuation).

Otherwise the imported entries overwrite the originals

comparestrings(origfield, impfield)

source code 

Compares two strings and returns the score using winkler routine from Febrl (stringcmp.py)

Return value is between 0.0 and 1.0, where 0.0 means no similarity whatsoever, and 1.0 means the strings match exactly.


Variables Details [hide private]

phonebookobjectfactory

Value:
database.dataobjectfactory(phonebookdataobject)

ll

Value:
['Home',
 ('numbers',
  0,
  ('type', 'home'),
  <function formatnumber at 0x039A10F0>,
  True),
 'Home2',
 ('numbers', 1, ('type', 'home'), <function formatnumber at 0x039A10F0\
...

_getdatatable

Value:
{'Address': ('addresses',
             0,
             None,
             <function formataddress at 0x039A1070>,
             True),
 'Address2': ('addresses',
              1,
              None,
...

AvailableColumns

Value:
['Name',
 'First',
 'Middle',
 'Last',
 'Category',
 'Category2',
 'Category3',
 'Category4',
...

DefaultColumns

Value:
['Name',
 'Phone',
 'Phone2',
 'Phone3',
 'Email',
 'Categories',
 'Memo',
 'Secret']

ImportColumns

Value:
['Name',
 'Categories',
 'Home',
 'Home2',
 'Home3',
 'Office',
 'Office2',
 'Office3',
...