utils

Utility functions

class camelot.core.utils.CollectionGetterFromObjectGetter(object_getter)[source]

Convert an object getter to a collection getter. The resulting class is callable and will make sure object_getter is only called once, even if collection getter is called multiple times.

camelot.core.utils.dgettext(domain, message)[source]

Like ugettext but look the message up in the specified domain. This uses the Translation table.

camelot.core.utils.load_translations()[source]

Fill the global dictionary of translations with all data from the database, to be able to do fast gui thread lookups of translations

camelot.core.utils.set_translation(source, value)[source]

Store a tranlation in the global translation dictionary

camelot.core.utils.ugettext(string_to_translate)[source]

Translate the string_to_translate to the language of the current locale. This is a two step process. First the function will try to get the translation out of the Translation entity, if this is not successfull, the function will ask QCoreApplication to translate string_to_translate (which tries to get the translation from the .qm files)

class camelot.core.utils.ugettext_lazy(string_to_translate)[source]

Like :function:`ugettext`, but delays the translation until the string is shown to the user. This makes it possible for the user to translate the string.