Tell the user when a background update completes, not when it starts
[zeroinstall/solver.git] / zeroinstall / 0launch-gui / utils.py
blobf2e516c376ed5018abcfd2596b19edd3c8c7a479
1 # Copyright (C) 2009, Thomas Leonard
2 # See the README file for details, or visit http://0install.net.
4 from zeroinstall import _
5 from zeroinstall import support
7 def get_fetch_info(config, impl):
8 """Get the text for a Fetch column."""
9 if impl is None:
10 return ""
11 elif impl.is_available(config.stores):
12 if impl.local_path:
13 return _('(local)')
14 elif impl.id.startswith('package:'):
15 return _('(package)')
16 else:
17 return _('(cached)')
18 else:
19 src = config.fetcher.get_best_source(impl)
20 if src:
21 return support.pretty_size(src.size)
22 else:
23 return _('(unavailable)')