fixed refcount of eListboxPythonStringContent
authorFelix Domke <tmbinc@elitedvb.net>
Sat, 29 Jan 2005 00:19:00 +0000 (00:19 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Sat, 29 Jan 2005 00:19:00 +0000 (00:19 +0000)
components.py
lib/gui/elistbox.cpp
lib/python/enigma_python.i
mytest.py

index 20827180851a82e2900607631c17aff44605f535..52c9460651ddb8dd831ba8978fc4e049fc2b07c3 100644 (file)
@@ -229,17 +229,18 @@ class MenuList(HTMLComponent, GUIComponent):
                GUIComponent.__init__(self)
        
        def getCurrent(self):
-               return self.l.getCurrentSelection()
+#              return self.l.getCurrentSelection()
+               return "none"
        
        def GUIcreateInstance(self, priv, parent, skindata):
                g = eListbox(parent)
                # BIG BIG HACK. :( we have to ensure that the eListboxPythonStringContent doesn't get destroyed.
                # we really have to take a look at the GC stuff
-               self.l = eListboxPythonStringContent()
-               self.l.setList(["Test Object 1", "Item #2", "Item #3", "nun kommt eine Zahl:", 15, "Bla fasel", "lulabla"])
-               g.setContent(self.l)
+               l = eListboxPythonStringContent()
+               l.setList(["Test Object 1", "Item #2", "Item #3", "nun kommt eine Zahl:", 15, "Bla fasel", "lulabla"])
+               g.setContent(l)
                return g
        
        def GUIdeleteInstance(self, g):
                g.setContent(None)
-               del self.l
+               #del self.l
index 96214aea6abb762abbac7edb49146b16dec1d46f..e06ab3e6deb129c2ceca06af5bba88459c2c1a7e 100644 (file)
@@ -114,9 +114,7 @@ int eListbox::event(int event, void *data, void *data2)
 
 void eListbox::recalcSize()
 {
-       eDebug("recalc size");
        m_itemheight = 20;
        m_content->setSize(eSize(size().width(), m_itemheight));
        m_items_per_page = size().height() / m_itemheight;
-       eDebug("done!");
 }
index b84dbd14b25a92e54527d8314077caf067053ac7..ae15d0d9b451e00ca9d67a1fa87b1f922a897675 100644 (file)
@@ -33,6 +33,11 @@ is usually caused by not marking PSignals as immutable.
 
 */
 
+%define RefCount(...)
+%typemap(newfree) __VA_ARGS__ * { eDebug("adding ref"); $1->AddRef(); }
+%extend __VA_ARGS__  { ~__VA_ARGS__() { eDebug("removing ref!"); self->Release(); } }
+%ignore __VA_ARGS__::~__VA_ARGS__();
+%enddef
 
 %module enigma
 %{
@@ -59,6 +64,8 @@ extern void runMainloop();
 extern PSignal1<void,int> &keyPressedSignal();
 %}
 
+RefCount(eListboxPythonStringContent)
+
 #define DEBUG
 %include "stl.i"
 %include <lib/base/object.h>
index 5233d85e8324e168b3fe0decb604f692c764ce96..e4a722ac3cc265c527271649b03ac83c85e7a650 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -37,11 +37,11 @@ screens["global"](components)
 # test our screens
 components["$001"] = screens["testDialog"]()
 
-print "*** classes:"
-dump(screens)
-
-print "*** instances:"
-dump(components)
+#print "*** classes:"
+#dump(screens)
+#
+#print "*** instances:"
+#dump(components)
 
 # display
 
@@ -100,7 +100,7 @@ class Session:
                        self.currentWindow = None
 
        def keyEvent(self, code):
-               print "code " + str(code)
+#              print "code " + str(code)
                if code == 32:
                        self.currentDialog.data["okbutton"]["instance"].push()