updater4pyi.upd_iface module

class updater4pyi.upd_iface.UpdateConsoleInterface(updater, ask_before_checking=False, **kwargs)[source]

Bases: updater4pyi.upd_iface.UpdateInterface

A very simple UpdateInterface implementation that checks for updates each time the program is run. This is mostly meant for debugging purposes.

start()[source]
class updater4pyi.upd_iface.UpdateGenericGuiInterface(updater, ask_before_checking=True, **kwargs)[source]

Bases: updater4pyi.upd_iface.UpdateInterface

all_settings()[source]

Utility to get all settings. Useful for subclasses; this doesn’t need to be reimplemented.

ask_first_time()[source]

Subclasses should prompt the user whether they want to regularly look for updates.

This is prompted to the user only if the main program set ask_before_checking to True in the constructor of this object.

Return TRUE if the program should regularly check for updates, or FALSE if not.

ask_to_restart()[source]

Subclasses should prompt the user to restart the program after a successful update.

Return TRUE if the program should be restarted, or FALSE if not.

ask_to_update(rel_info)[source]

Subclasses should prompt the user whether they want to install the update rel_info or not.

Note: Interfaces may also present additional buttons such as “Never check for updates”, or “Skip this update”, and set properties and/or settings accordingly with e.g. setCheckForUpdatesEnabled().

Return TRUE if the program should be restarted, or FALSE if not.

checkForUpdatesEnabled()[source]
checkInterval()[source]
check_for_updates()[source]

Perform a possible update check. You don’t have to reimplement this function, the default implementation should be good enough and relies on your implementations of ask_to_update() and ask_to_restart().

If the update check isn’t due yet, this function does not do the update check. If you want to force an update check, call do_check_for_updates().

do_check_for_updates()[source]

Actually perform the udpate check. Call this function if you want to force an update check even though it’s not yet due. If you want to periodically possibly check only if a check is due, then call check_for_updates() instead.

Returns:
  • None if we asked the user for the first time if they want to check regularly for updates, and they refused.

  • False if no new update is available

  • a tuple if a new update is available:
    • (True, rel_info) if the user installed the update but did not restart the app;
    • (False, rel_info) if the user declined to install the update now
  • the tuple (False, None, error_str) if an error occurred while checking for updates.

initCheckDelay()[source]
is_check_now_due(tolerance=datetime.timedelta(0, 10))[source]
lastCheck()[source]
load_settings(keylist)[source]

Subclasses may reimplement this function to cusomize where and how the settings are stored, usually using a toolbox-specific utility, such as QSettings in PyQt4.

save_settings(d=None)[source]

Save the given settings in the dictionary d to some local settings. If d is None, then all settings should be saved, effectively taking d to be the dictionary returned by all_settings().

schedule_next_update_check()[source]
setCheckForUpdatesEnabled(enabled, save=True, schedule_check=True)[source]
setCheckInterval(check_interval, save=True)[source]
setInitCheckDelay(init_check_delay, save=True)[source]
setLastCheck(last_check, save=True)[source]
set_timeout_check(interval_timedelta)[source]

Subclasses should reimplement this function to call the function check_for_updates() after interval_timedelta. interval_timedelta is a datetime.timedelta object.

start()[source]
timedelta_remaining_to_next_check()[source]
class updater4pyi.upd_iface.UpdateInterface(updater, progname=None, **kwargs)[source]

Bases: object

start(**kwargs)[source]

Start being aware of wanting to check for updates. It is up to the interface to decide when to check for updates, how often, etc. For example, a console interface would check right away, while a GUI might first load the application, and set a timer to check later, so that startup is not slowed down by the update check.