From 2c79a7fc6ea5995ecdc7e3f8c83fe410586d9f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Fri, 5 Dec 2008 12:54:37 +0100 Subject: Make the dependency list lazy --- portato/gui/views.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'portato/gui/views.py') diff --git a/portato/gui/views.py b/portato/gui/views.py index 85a06c8..26a8a89 100644 --- a/portato/gui/views.py +++ b/portato/gui/views.py @@ -46,6 +46,20 @@ class LazyView (object): def _get_content (self): raise NotImplementedError +class LazyStoreView (gtk.TreeView, LazyView): + def __init__ (self, update_fn): + gtk.TreeView.__init__(self) + LazyView.__init__(self) + + self.update_fn = update_fn + + def cb_mapped (self, *args): + if self.updated and self.pkg: + self.set_model(self.update_fn(self.pkg)) + self.updated = False + + return False + class ListView (gtk.TextView, LazyView): def __init__ (self, content_fn): -- cgit v1.2.3