add more useful __repr__
[vuplus_dvbapp] / lib / python / Screens / Screen.py
index bbc6b1e..0727f78 100644 (file)
@@ -1,5 +1,6 @@
 from Components.HTMLSkin import *
 from Components.GUISkin import *
+from Components.Sources.Source import Source
 
 import sys
 
@@ -64,6 +65,13 @@ class Screen(dict, HTMLSkin, GUISkin):
                # fixup circular references
                del self.helpList
                GUISkin.close(self)
+
+               # first disconnect all render from their sources.
+               # we might split this out into a "unskin"-call,
+               # but currently we destroy the screen afterwards
+               # anyway.
+               for val in self.renderer:
+                       val.disconnectAll()  # disconnected converter/sources and probably destroy them
                
                del self.session
                for (name, val) in self.items():
@@ -92,7 +100,7 @@ class Screen(dict, HTMLSkin, GUISkin):
                for x in self.onShow:
                        x()
                for val in self.values() + self.renderer:
-                       if isinstance(val, GUIComponent):
+                       if isinstance(val, GUIComponent) or isinstance(val, Source):
                                val.onShow()
 
        def hide(self):
@@ -103,5 +111,8 @@ class Screen(dict, HTMLSkin, GUISkin):
                for x in self.onHide:
                        x()
                for val in self.values() + self.renderer:
-                       if isinstance(val, GUIComponent):
+                       if isinstance(val, GUIComponent) or isinstance(val, Source):
                                val.onHide()
+
+       def __repr__(self):
+               return str(type(self))