Exemple #1
0
def enableAutomaticCacheReloading():
    """ Enable automatic reloading of our geolocator caches.

        We set the internal app settings to re-enable the reloading of the
        geolocator cache when a signal is received.  If a signal was received
        while the automatic reloading was disabled, we process that signal
        again to reload the appropriate cache.
    """
    # Get the current XXX_did_change settings, so we know what's changed while
    # the automatic reloading was disabled.

    location_did_change      = appSettings.get("location_did_change") == "1"
    location_name_did_change = \
            appSettings.get("location_name_did_change") == "1"
    name_did_change          = appSettings.get("name_did_change") == "1"
    outline_did_change       = appSettings.get("outline_did_change") == "1"

    # Turn on automatic reloading again.

    appSettings.set("geolocator_cache_reload_enabled", "1")

    # If things have changed while reloading was disabled, reload the affected
    # cache(s).

    if location_did_change:
        on_location_changed()

    if location_name_did_change:
        on_location_name_changed()

    if name_did_change:
        on_name_changed()

    if outline_did_change:
        on_outline_changed()
Exemple #2
0
def isAutomaticCacheReloadingEnabled():
    """ Return True iff the automatic reloading of our cache currently enabled.
    """
    return appSettings.get("geolocator_cache_reload_enabled") in [None, "1"]