add support for cyclic garbage collection to eTimer and eSocketNotifier
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 14 Feb 2008 19:44:14 +0000 (19:44 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 14 Feb 2008 19:44:14 +0000 (19:44 +0000)
class, add simpler method to set a timer callback.. or remove.. instead of
timer.timeout.get().append(func).. or .remove(func)... now it is possible to
do timer.callback.append(func)... timer.callback.remove(func) (the old
method still works..but is now deprecated)

41 files changed:
lib/base/ebase.cpp
lib/base/ebase.h
lib/python/Components/Clock.py
lib/python/Components/ConditionalWidget.py
lib/python/Components/ConfigList.py
lib/python/Components/Converter/ConditionalShowHide.py
lib/python/Components/Converter/Poll.py
lib/python/Components/PerServiceDisplay.py
lib/python/Components/Pixmap.py
lib/python/Components/ServicePosition.py
lib/python/Components/Sources/Boolean.py
lib/python/Components/Sources/Clock.py
lib/python/Components/Sources/FrontendStatus.py
lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpg.py
lib/python/Plugins/Extensions/MediaPlayer/plugin.py
lib/python/Plugins/Extensions/PicturePlayer/plugin.py
lib/python/Plugins/Extensions/SimpleRSS/plugin.py
lib/python/Plugins/SystemPlugins/OldSoftwareUpdate/plugin.py
lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py
lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py
lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py
lib/python/Screens/ChannelSelection.py
lib/python/Screens/Ci.py
lib/python/Screens/EventView.py
lib/python/Screens/HarddiskSetup.py
lib/python/Screens/InfoBar.py
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/Ipkg.py
lib/python/Screens/MessageBox.py
lib/python/Screens/MovieSelection.py
lib/python/Screens/ParentalControlSetup.py
lib/python/Screens/ScanSetup.py
lib/python/Screens/SubservicesQuickzap.py
lib/python/Screens/Wizard.py
lib/python/Tools/NumericalTextInput.py
lib/python/enigma_python.i
lib/python/python.cpp
lib/python/python.h
mytest.py
tests/enigma.py
timer.py

index effd7250924a2ed224df80b1b82888b1ede0efab..bf41dc0bf2c582a125e4df003bae82a579c62002 100644 (file)
@@ -390,3 +390,420 @@ void eMainloop::applyTimeOffset()
 }
 
 eApplication* eApp = 0;
+
+#include "structmember.h"
+
+extern "C" {
+
+// eTimer replacement
+
+struct eTimerPy
+{
+       PyObject_HEAD
+       eTimer *tm;
+       PyObject *in_weakreflist; /* List of weak references */
+};
+
+static int
+eTimerPy_traverse(eTimerPy *self, visitproc visit, void *arg)
+{
+       PyObject *obj = self->tm->timeout.get();
+       Py_VISIT(obj);
+       return 0;
+}
+
+static int
+eTimerPy_clear(eTimerPy *self)
+{
+       PyObject *obj = self->tm->timeout.get();
+       Py_CLEAR(obj);
+       return 0;
+}
+
+static void
+eTimerPy_dealloc(eTimerPy* self)
+{
+       if (self->in_weakreflist != NULL)
+               PyObject_ClearWeakRefs((PyObject *) self);
+       eTimerPy_clear(self);
+       delete self->tm;
+       self->ob_type->tp_free((PyObject*)self);
+}
+
+static PyObject *
+eTimerPy_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+       eTimerPy *self = (eTimerPy *)type->tp_alloc(type, 0);
+       self->tm = new eTimer(eApp);
+       self->in_weakreflist = NULL;
+       return (PyObject *)self;
+}
+
+static PyObject *
+eTimerPy_is_active(eTimerPy* self)
+{
+       PyObject *ret = NULL;
+       ret = !!self->tm->isActive() ? Py_True : Py_False;
+       Org_Py_INCREF(ret);
+       return ret;
+}
+
+static PyObject *
+eTimerPy_start(eTimerPy* self, PyObject *args)
+{
+       long v=0;
+       long singleShot=0;
+       if (PyTuple_Size(args) > 1)
+       {
+               if (!PyArg_ParseTuple(args, "ll", &v, &singleShot)) // when 2nd arg is a value
+               {
+                       PyObject *obj=0;
+                       if (!PyArg_ParseTuple(args, "lO", &v, &obj)) // get 2nd arg as python object
+                               return NULL;
+                       else if (obj == Py_True)
+                               singleShot=1;
+                       else if (obj != Py_False)
+                               return NULL;
+               }
+       }
+       else if (!PyArg_ParseTuple(args, "l", &v))
+               return NULL;
+       self->tm->start(v, singleShot);
+       Py_RETURN_NONE;
+}
+
+static PyObject *
+eTimerPy_start_long(eTimerPy* self, PyObject *args)
+{
+       long v=0;
+       if (!PyArg_ParseTuple(args, "l", &v)) {
+               return NULL;
+       }
+       self->tm->startLongTimer(v);
+       Py_RETURN_NONE;
+}
+
+static PyObject *
+eTimerPy_change_interval(eTimerPy* self, PyObject *args)
+{
+       long v=0;
+       if (!PyArg_ParseTuple(args, "l", &v)) {
+               return NULL;
+       }
+       self->tm->changeInterval(v);
+       Py_RETURN_NONE;
+}
+
+static PyObject *
+eTimerPy_stop(eTimerPy* self)
+{
+       self->tm->stop();
+       Py_RETURN_NONE;
+}
+
+static PyObject *
+eTimerPy_get_callback_list(eTimerPy *self)
+{ //used for compatibilty with the old eTimer
+       return self->tm->timeout.get();
+}
+
+static PyMethodDef eTimerPy_methods[] = {
+       {"isActive", (PyCFunction)eTimerPy_is_active, METH_NOARGS,
+        "returns the timer state"
+       },
+       {"start", (PyCFunction)eTimerPy_start, METH_VARARGS,
+        "start timer with interval in msecs"
+       },
+       {"startLongTimer", (PyCFunction)eTimerPy_start_long, METH_VARARGS,
+        "start timer with interval in secs"
+       },
+       {"changeInterval", (PyCFunction)eTimerPy_change_interval, METH_VARARGS,
+        "change interval of a timer (in msecs)"
+       },
+       {"stop", (PyCFunction)eTimerPy_stop, METH_NOARGS,
+        "stops the timer"
+       },
+       //used for compatibilty with the old eTimer
+       {"get", (PyCFunction)eTimerPy_get_callback_list, METH_NOARGS,
+        "get timeout callback list"
+       },
+       {NULL}  /* Sentinel */
+};
+
+static PyObject *
+eTimerPy_get_cb_list(eTimerPy *self, void *closure)
+{
+       return self->tm->timeout.get();
+}
+
+static PyObject *
+eTimerPy_timeout(eTimerPy *self, void *closure) 
+{ //used for compatibilty with the old eTimer
+       Org_Py_INCREF((PyObject*)self);
+       return (PyObject*)self;
+}
+
+static PyGetSetDef eTimerPy_getseters[] = {
+       {"callback",
+        (getter)eTimerPy_get_cb_list, (setter)0,
+        "returns the callback python list",
+        NULL},
+
+       {"timeout", //used for compatibilty with the old eTimer
+        (getter)eTimerPy_timeout, (setter)0,
+        "synonym for our self",
+        NULL},
+
+       {NULL} /* Sentinel */
+};
+
+static PyTypeObject eTimerPyType = {
+       PyObject_HEAD_INIT(NULL)
+       0, /*ob_size*/
+       "eBaseImpl.eTimer", /*tp_name*/
+       sizeof(eTimerPy), /*tp_basicsize*/
+       0, /*tp_itemsize*/
+       (destructor)eTimerPy_dealloc, /*tp_dealloc*/
+       0, /*tp_print*/
+       0, /*tp_getattr*/
+       0, /*tp_setattr*/
+       0, /*tp_compare*/
+       0, /*tp_repr*/
+       0, /*tp_as_number*/
+       0, /*tp_as_sequence*/
+       0, /*tp_as_mapping*/
+       0, /*tp_hash */
+       0, /*tp_call*/
+       0, /*tp_str*/
+       0, /*tp_getattro*/
+       0, /*tp_setattro*/
+       0, /*tp_as_buffer*/
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+       "eTimer objects", /* tp_doc */
+       (traverseproc)eTimerPy_traverse, /* tp_traverse */
+       (inquiry)eTimerPy_clear, /* tp_clear */
+       0, /* tp_richcompare */
+       offsetof(eTimerPy, in_weakreflist), /* tp_weaklistoffset */
+       0, /* tp_iter */
+       0, /* tp_iternext */
+       eTimerPy_methods, /* tp_methods */
+       0, /* tp_members */
+       eTimerPy_getseters, /* tp_getset */
+       0, /* tp_base */
+       0, /* tp_dict */
+       0, /* tp_descr_get */
+       0, /* tp_descr_set */
+       0, /* tp_dictoffset */
+       0, /* tp_init */
+       0, /* tp_alloc */
+       eTimerPy_new, /* tp_new */
+};
+
+// eSocketNotifier replacement
+
+struct eSocketNotifierPy
+{
+       PyObject_HEAD
+       eSocketNotifier *sn;
+       PyObject *in_weakreflist; /* List of weak references */
+};
+
+static int
+eSocketNotifierPy_traverse(eSocketNotifierPy *self, visitproc visit, void *arg)
+{
+       PyObject *obj = self->sn->activated.get();
+       Py_VISIT(obj);
+       return 0;
+}
+
+static int
+eSocketNotifierPy_clear(eSocketNotifierPy *self)
+{
+       PyObject *obj = self->sn->activated.get();
+       Py_CLEAR(obj);
+       return 0;
+}
+
+static void
+eSocketNotifierPy_dealloc(eSocketNotifierPy* self)
+{
+       if (self->in_weakreflist != NULL)
+               PyObject_ClearWeakRefs((PyObject *) self);
+       eSocketNotifierPy_clear(self);
+       delete self->sn;
+       self->ob_type->tp_free((PyObject*)self);
+}
+
+static PyObject *
+eSocketNotifierPy_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+       eSocketNotifierPy *self = (eSocketNotifierPy *)type->tp_alloc(type, 0);
+       int fd, req, immediate_start = 1, size = PyTuple_Size(args);
+       if (size > 2)
+       {
+               if (!PyArg_ParseTuple(args, "iii", &fd, &req, &immediate_start))
+               {
+                       PyObject *obj = NULL;
+                       if (!PyArg_ParseTuple(args, "iiO", &fd, &req, &immediate_start))
+                               return NULL;
+                       if (obj == Py_False)
+                               immediate_start = 0;
+                       else if (obj != Py_True)
+                               return NULL;
+               }
+       }
+       else if (size < 2 || !PyArg_ParseTuple(args, "ii", &fd, &req))
+               return NULL;
+       self->sn = new eSocketNotifier(eApp, fd, req, immediate_start);
+       self->in_weakreflist = NULL;
+       return (PyObject *)self;
+}
+
+static PyObject *
+eSocketNotifierPy_is_running(eSocketNotifierPy* self)
+{
+       PyObject *ret = self->sn->isRunning() ? Py_True : Py_False;
+       Org_Py_INCREF(ret);
+       return ret;
+}
+
+static PyObject *
+eSocketNotifierPy_start(eSocketNotifierPy* self)
+{
+       self->sn->start();
+       Py_RETURN_NONE;
+}
+
+static PyObject *
+eSocketNotifierPy_stop(eSocketNotifierPy* self)
+{
+       self->sn->stop();
+       Py_RETURN_NONE;
+}
+
+static PyObject *
+eSocketNotifierPy_get_fd(eSocketNotifierPy* self)
+{
+       return PyInt_FromLong(self->sn->getFD());
+}
+
+static PyObject *
+eSocketNotifierPy_get_requested(eSocketNotifierPy* self)
+{
+       return PyInt_FromLong(self->sn->getRequested());
+}
+
+static PyObject *
+eSocketNotifierPy_set_requested(eSocketNotifierPy* self, PyObject *args)
+{
+       int req;
+       if (PyTuple_Size(args) != 1 || !PyArg_ParseTuple(args, "i", &req))
+               return NULL;
+       self->sn->setRequested(req);
+       Py_RETURN_NONE;
+}
+
+static PyMethodDef eSocketNotifierPy_methods[] = {
+       {"isRunning", (PyCFunction)eSocketNotifierPy_is_running, METH_NOARGS,
+        "returns the running state"
+       },
+       {"start", (PyCFunction)eSocketNotifierPy_start, METH_NOARGS,
+        "start the sn"
+       },
+       {"stop", (PyCFunction)eSocketNotifierPy_stop, METH_NOARGS,
+        "stops the sn"
+       },
+       {"getFD", (PyCFunction)eSocketNotifierPy_get_fd, METH_NOARGS,
+        "get file descriptor"
+       },
+       {"getRequested", (PyCFunction)eSocketNotifierPy_get_requested, METH_NOARGS,
+        "get requested"
+       },
+       {"setRequested", (PyCFunction)eSocketNotifierPy_set_requested, METH_VARARGS,
+        "set requested"
+       },
+       {NULL}  /* Sentinel */
+};
+
+static PyObject *
+eSocketNotifierPy_get_cb_list(eSocketNotifierPy *self, void *closure)
+{
+       return self->sn->activated.get();
+}
+
+static PyGetSetDef eSocketNotifierPy_getseters[] = {
+       {"callback",
+        (getter)eSocketNotifierPy_get_cb_list, (setter)0,
+        "returns the callback python list",
+        NULL},
+       {NULL} /* Sentinel */
+};
+
+static PyTypeObject eSocketNotifierPyType = {
+       PyObject_HEAD_INIT(NULL)
+       0, /*ob_size*/
+       "eBaseImpl.eSocketNotifier", /*tp_name*/
+       sizeof(eSocketNotifierPy), /*tp_basicsize*/
+       0, /*tp_itemsize*/
+       (destructor)eSocketNotifierPy_dealloc, /*tp_dealloc*/
+       0, /*tp_print*/
+       0, /*tp_getattr*/
+       0, /*tp_setattr*/
+       0, /*tp_compare*/
+       0, /*tp_repr*/
+       0, /*tp_as_number*/
+       0, /*tp_as_sequence*/
+       0, /*tp_as_mapping*/
+       0, /*tp_hash */
+       0, /*tp_call*/
+       0, /*tp_str*/
+       0, /*tp_getattro*/
+       0, /*tp_setattro*/
+       0, /*tp_as_buffer*/
+       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+       "eTimer objects", /* tp_doc */
+       (traverseproc)eSocketNotifierPy_traverse, /* tp_traverse */
+       (inquiry)eSocketNotifierPy_clear, /* tp_clear */
+       0, /* tp_richcompare */
+       offsetof(eSocketNotifierPy, in_weakreflist), /* tp_weaklistoffset */
+       0, /* tp_iter */
+       0, /* tp_iternext */
+       eSocketNotifierPy_methods, /* tp_methods */
+       0, /* tp_members */
+       eSocketNotifierPy_getseters, /* tp_getset */
+       0, /* tp_base */
+       0, /* tp_dict */
+       0, /* tp_descr_get */
+       0, /* tp_descr_set */
+       0, /* tp_dictoffset */
+       0, /* tp_init */
+       0, /* tp_alloc */
+       eSocketNotifierPy_new, /* tp_new */
+};
+
+static PyMethodDef module_methods[] = {
+       {NULL}  /* Sentinel */
+};
+
+void eBaseInit(void)
+{
+       PyObject* m;
+
+       m = Py_InitModule3("eBaseImpl", module_methods,
+               "Module that implements some enigma classes with working cyclic garbage collection.");
+
+       if (m == NULL)
+               return;
+
+       if (!PyType_Ready(&eTimerPyType))
+       {
+               Org_Py_INCREF((PyObject*)&eTimerPyType);
+               PyModule_AddObject(m, "eTimer", (PyObject*)&eTimerPyType);
+       }
+       if (!PyType_Ready(&eSocketNotifierPyType))
+       {
+               Org_Py_INCREF((PyObject*)&eSocketNotifierPyType);
+               PyModule_AddObject(m, "eSocketNotifier", (PyObject*)&eSocketNotifierPyType);
+       }
+}
+}
index 4378711a9a0126bf555c9cea31c8185d012a5f85..c4dab6216f549ea38104754dd3872a34d56e67a4 100644 (file)
@@ -132,8 +132,6 @@ static inline long timeout_usec ( const timeval & orig )
        return (orig-now).tv_sec*1000000 + (orig-now).tv_usec;
 }
 
-#endif
-
 class eMainloop;
 
                                        // die beiden signalquellen: SocketNotifier...
@@ -154,6 +152,7 @@ private:
        int fd;
        int state;
        int requested;          // requested events (POLLIN, ...)
+       void activate(int what) { /*emit*/ activated(what); }
 public:
        /**
         * \brief Constructs a eSocketNotifier.
@@ -166,7 +165,6 @@ public:
        ~eSocketNotifier();
 
        PSignal1<void, int> activated;
-       void activate(int what) { /*emit*/ activated(what); }
 
        void start();
        void stop();
@@ -177,6 +175,8 @@ public:
        void setRequested(int req) { requested=req; }
 };
 
+#endif
+
 class eTimer;
 
                        // werden in einer mainloop verarbeitet
@@ -265,6 +265,7 @@ public:
        }
 };
 
+#ifndef SWIG
                                // ... und Timer
 /**
  * \brief Gives a callback after a specified timeout.
@@ -280,6 +281,7 @@ class eTimer
        bool bSingleShot;
        bool bActive;
        void addTimeOffset(int);
+       void activate();
 public:
        /**
         * \brief Constructs a timer.
@@ -291,17 +293,17 @@ public:
        ~eTimer() { if (bActive) stop(); }
 
        PSignal0<void> timeout;
-       void activate();
 
        bool isActive() { return bActive; }
+
        timeval &getNextActivation() { return nextActivation; }
 
        void start(long msec, bool b=false);
        void stop();
        void changeInterval(long msek);
-#ifndef SWIG
-       bool operator<(const eTimer& t) const { return nextActivation < t.nextActivation; }
-#endif
        void startLongTimer( int seconds );
+       bool operator<(const eTimer& t) const { return nextActivation < t.nextActivation; }
 };
+#endif  // SWIG
+
 #endif
index ddd6ffb1dcab30dc4ec58506cc27f08b9779fb83..338101ef5994b333177360e312ee979f30b7dcfb 100644 (file)
@@ -14,7 +14,7 @@ class Clock(VariableText, HTMLComponent, GUIComponent):
                self.doClock()
                
                self.clockTimer = eTimer()
-               self.clockTimer.timeout.get().append(self.doClock)
+               self.clockTimer.callback.append(self.doClock)
 
        def onShow(self):
                self.doClock()
index f4b998376bc5ef5a7ebdc89cbf29fb75c92b5ccc..192813f527654d1976d61531a224bd0f362b6ce2 100644 (file)
@@ -9,7 +9,7 @@ class ConditionalWidget(GUIComponent):
                
                if (withTimer):
                        self.conditionCheckTimer = eTimer()
-                       self.conditionCheckTimer.timeout.get().append(self.update)
+                       self.conditionCheckTimer.callback.append(self.update)
                        self.conditionCheckTimer.start(1000)
 
        def postWidgetCreate(self, instance):
@@ -38,7 +38,7 @@ class BlinkingWidget(GUIComponent):
                self.blinking = False
                self.setBlinkTime(500)
                self.timer = eTimer()
-               self.timer.timeout.get().append(self.blink)
+               self.timer.callback.append(self.blink)
        
        def setBlinkTime(self, time):
                self.blinktime = time
index f42d6a96318aaad2699b432fd56388c255ee8486..d1b295baedff92dceff541a19474f26e0f4aca25 100644 (file)
@@ -19,7 +19,7 @@ class ConfigList(HTMLComponent, GUIComponent, object):
        def execBegin(self):
                rcinput = eRCInput.getInstance()
                rcinput.setKeyboardMode(rcinput.kmAscii)
-               self.timer.timeout.get().append(self.timeout)
+               self.timer.callback.append(self.timeout)
 
        def execEnd(self):
                rcinput = eRCInput.getInstance()
index 50e8b1a8dee879f905e60354b1b96db0de071a1c..f5ec7039a875ccfb27ee0f18abaea255c7de7ceb 100644 (file)
@@ -10,8 +10,8 @@ class ConditionalShowHide(Converter, object):
                if self.blink:
                        self.blinktime = 500
                        self.timer = eTimer()
-                       self.timer.timeout.get().append(self.blinkFunc)
-               else:
+                       self.timer.callback.append(self.blinkFunc)
+               else
                        self.timer = None
 
        def blinkFunc(self):
index f41765d487f6516a262910e94774dcc00ce97ae0..33b9f3056748e3b9a7043fc66d96adf5b345c403 100644 (file)
@@ -3,7 +3,7 @@ from enigma import eTimer
 class Poll(object):
        def __init__(self):
                self.__poll_timer = eTimer()
-               self.__poll_timer.timeout.get().append(self.poll)
+               self.__poll_timer.callback.append(self.poll)
                self.__interval = 1000
                self.__enabled = False
 
index 6e02cce99ad0c1bf4ad7cc0c4ab39d70437ecd6f..2d0a71e7270b9529c0a212c742d7308394698822 100644 (file)
@@ -11,7 +11,7 @@ class PerServiceBase(object):
                self.navcore = navcore
                self.navcore.event.append(self.event_callback)
                self.poll_timer = eTimer()
-               self.poll_timer.timeout.get().append(self.poll)
+               self.poll_timer.callback.append(self.poll)
                self.with_event = with_event
                
                # start with stopped state, so simulate that
index 3cc8c661e3572b066941fe1e8999b13f3cf3eca8..f6ecaf0ca00b9ea117ed266257a674c0ca9d038d 100644 (file)
@@ -24,7 +24,7 @@ class MovingPixmap(Pixmap):
                self.clearPath()
                
                self.moveTimer = eTimer()
-               self.moveTimer.timeout.get().append(self.doMove)
+               self.moveTimer.callback.append(self.doMove)
                
        def clearPath(self, repeated = False):
                if (self.moving):
index 6f7082d545c661958fa98b1c318523b8270c9055..985f884162e466e3fe06d00bef2192c938b35345 100644 (file)
@@ -12,7 +12,7 @@ class ServicePosition(PerServiceDisplay, object):
        def __init__(self, navcore, type):
                object.__init__(self)
                self.updateTimer = eTimer()
-               self.updateTimer.timeout.get().append(self.update)
+               self.updateTimer.callback.append(self.update)
                PerServiceDisplay.__init__(self, navcore,
                        {
                                iPlayableService.evStart: self.newService,
index 21c2c2b976222f8b31f324b87c24bcd49b37cce4..97b92bc6da9c19f483223d130f28d61950c5fecb 100644 (file)
@@ -16,7 +16,7 @@ class Boolean(Source, object):
                self.fixed = fixed
                if poll > 0:
                        self.poll_timer = eTimer()
-                       self.poll_timer.timeout.get().append(self.poll)
+                       self.poll_timer.callback.append(self.poll)
                        self.poll_timer.start(poll)
                else:
                        self.poll_timer = None
index b59a20d5fbece643fcf92a159ce572a0009da94b..60fa7ac2807bfefb4a1ed5f9013d29c159c9eb5d 100644 (file)
@@ -8,7 +8,7 @@ class Clock(Source):
        def __init__(self):
                Source.__init__(self)
                self.clock_timer = eTimer()
-               self.clock_timer.timeout.get().append(self.poll)
+               self.clock_timer.callback.append(self.poll)
                self.clock_timer.start(1000)
 
        @cached
index 4d38f754c7e83da983c2642aa99b66b5b7478bc3..141bd8a47763fda4d1ce05b9d85d8a3233f42af5 100644 (file)
@@ -9,7 +9,7 @@ class FrontendStatus(Source):
                self.frontend_source = frontend_source
                self.invalidate()
                self.poll_timer = eTimer()
-               self.poll_timer.timeout.get().append(self.updateFrontendStatus)
+               self.poll_timer.callback.append(self.updateFrontendStatus)
                self.poll_timer.start(update_interval)
 
        def invalidate(self):
index 4f31fa468728aaf1beeda424f80b332a35e3515f..80a07df4918d014f62506c0c76f1d068b6ba037f 100644 (file)
@@ -380,7 +380,7 @@ class GraphMultiEPG(Screen):
                        },-1)
 
                self.updateTimelineTimer = eTimer()
-               self.updateTimelineTimer.timeout.get().append(self.moveTimeLines)
+               self.updateTimelineTimer.callback.append(self.moveTimeLines)
                self.updateTimelineTimer.start(60*1000)
                self.onLayoutFinish.append(self.onCreate)
 
index 63e2b302899a1e13e6bb2a62964bb10590daec5f..03d7617306ada6c11c48d8de5758decdd1f9cf61 100644 (file)
@@ -159,11 +159,11 @@ class MediaPlayer(Screen, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSup
 
                self.righttimer = False
                self.rightKeyTimer = eTimer()
-               self.rightKeyTimer.timeout.get().append(self.rightTimerFire)
+               self.rightKeyTimer.callback.append(self.rightTimerFire)
 
                self.lefttimer = False
                self.leftKeyTimer = eTimer()
-               self.leftKeyTimer.timeout.get().append(self.leftTimerFire)
+               self.leftKeyTimer.callback.append(self.leftTimerFire)
 
                self.currList = "filelist"
 
index b305b653b4b5193863a3b2d6041b0ccf3c82e7cf..6d41305ea20cd55e56302c8354cedcddffe71146 100644 (file)
@@ -94,7 +94,7 @@ class ThumbView(Screen):
                        self["label0"].setText(_("no Picture found"))
                
                self.ThumbTimer = eTimer()
-               self.ThumbTimer.timeout.get().append(self.showThumb)
+               self.ThumbTimer.callback.append(self.showThumb)
 
                self.fillPage()
                
@@ -244,11 +244,11 @@ class PicView(Screen):
                self["pause"] = Pixmap()
                
                self.decodeTimer = eTimer()
-               self.decodeTimer.timeout.get().append(self.decodePic)
+               self.decodeTimer.callback.append(self.decodePic)
                self.decodeTimer.start(300, True)
 
                self.slideTimer = eTimer()
-               self.slideTimer.timeout.get().append(self.slidePic)
+               self.slideTimer.callback.append(self.slidePic)
                
                
        def Pause(self):
@@ -457,7 +457,7 @@ class picmain(Screen):
                self["thumbnail"] = Pixmap()
                
                self.ThumbTimer = eTimer()
-               self.ThumbTimer.timeout.get().append(self.showThumb)
+               self.ThumbTimer.callback.append(self.showThumb)
                self.ThumbTimer.start(500, True)
                
        def up(self):
index b52183580f6ace2c2fcdb89158a68fb222888994..3c96dd448a9dd827fd4d7c7f78c7d227dc086e95 100644 (file)
@@ -139,7 +139,7 @@ class RSSPoller:
 
        def __init__(self):
                self.poll_timer = eTimer()
-               self.poll_timer.timeout.get().append(self.poll)
+               self.poll_timer.callback.append(self.poll)
                self.poll_timer.start(0, 1)
                self.last_links = Set()
                self.dialog = None
index 17abb0ffc20bcb52b6c15687e9cab0c601392b93..c72163820b97cb7050ecb12831385a81102af8c0 100644 (file)
@@ -30,7 +30,7 @@ class Upgrade(Screen):
                
                self.update = True
                self.delayTimer = eTimer()
-               self.delayTimer.timeout.get().append(self.doUpdateDelay)
+               self.delayTimer.callback.append(self.doUpdateDelay)
                
        def go(self):
                if self.update:
index e394db4bd2c5294147e6934f3561c55179c36350..1f222046a46cc7fc0819c326248ecc06d87b22b4 100644 (file)
@@ -123,7 +123,7 @@ class PositionerSetup(Screen):
                self.updateColors("tune")
                
                self.statusTimer = eTimer()
-               self.statusTimer.timeout.get().append(self.updateStatus)
+               self.statusTimer.callback.append(self.updateStatus)
                self.statusTimer.start(50, False)
 
        def restartPrevService(self, yesno):
index c0fbe74052aad6b1b8e7a4c28ac776d88714c323..8127514cbe8d94af86dc7d266d58c6389478d572 100644 (file)
@@ -268,7 +268,7 @@ class UpdatePlugin(Screen):
                
                self.activity = 0
                self.activityTimer = eTimer()
-               self.activityTimer.timeout.get().append(self.doActivityTimer)
+               self.activityTimer.callback.append(self.doActivityTimer)
                self.activityTimer.start(100, False)
                                
                self.ipkg = IpkgComponent()
index c6d6b864e9ca84bd0a93bf3b067348187bc045f1..9defb9eb887748829d3f548e517391da0befbb2b 100644 (file)
@@ -66,7 +66,7 @@ class VideoHardware:
 
                # until we have the hotplug poll socket
 #              self.timer = eTimer()
-#              self.timer.timeout.get().append(self.readPreferredModes)
+#              self.timer.callback.append(self.readPreferredModes)
 #              self.timer.start(1000)
 
        def readAvailableModes(self):
index e1402aeab93c66a41d17276c556f6246fa945d3d..d640ac250fccf0b30c667fe9fef8539c795b56d8 100644 (file)
@@ -1,28 +1,39 @@
+from Tools.Profile import profile
+
 from Screen import Screen
 from Components.Button import Button
 from Components.ServiceList import ServiceList
 from Components.ActionMap import NumberActionMap, ActionMap, HelpableActionMap
 from Components.MenuList import MenuList
 from Components.ServiceEventTracker import ServiceEventTracker
+profile("ChannelSelection.py 1")
 from EpgSelection import EPGSelection
 from enigma import eServiceReference, eEPGCache, eServiceCenter, eRCInput, eTimer, eDVBDB, iPlayableService, iServiceInformation, getPrevAsciiCode
 from Components.config import config, ConfigSubsection, ConfigText
 from Tools.NumericalTextInput import NumericalTextInput
+profile("ChannelSelection.py 2")
 from Components.NimManager import nimmanager
+profile("ChannelSelection.py 2.1")
 from Components.Sources.Source import ObsoleteSource
+profile("ChannelSelection.py 2.2")
 from Components.Sources.RdsDecoder import RdsDecoder
+profile("ChannelSelection.py 2.3")
 from Components.Sources.ServiceEvent import ServiceEvent
+profile("ChannelSelection.py 2.4")
 from Components.Input import Input
+profile("ChannelSelection.py 3")
 from Components.ParentalControl import parentalControl
 from Components.Pixmap import Pixmap
 from Screens.InputBox import InputBox, PinInput
 from Screens.MessageBox import MessageBox
 from Screens.ServiceInfo import ServiceInfo
+profile("ChannelSelection.py 4")
 from Screens.RdsDisplay import RassInteractive
 from ServiceReference import ServiceReference
 from Tools.BoundFunction import boundFunction
 from re import compile
 from os import remove
+profile("ChannelSelection.py after imports")
 
 FLAG_SERVICE_NEW_FOUND = 64 #define in lib/dvb/idvb.h as dxNewFound = 64
 
@@ -276,7 +287,7 @@ class SelectionEventInfo:
                self["ServiceEvent"] = ServiceEvent()
                self.servicelist.connectSelChanged(self.__selectionChanged)
                self.timer = eTimer()
-               self.timer.timeout.get().append(self.updateEventInfo)
+               self.timer.callback.append(self.updateEventInfo)
                self.onShown.append(self.__selectionChanged)
 
        def __selectionChanged(self):
@@ -1081,7 +1092,7 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect
                        })
 
                self.lastChannelRootTimer = eTimer()
-               self.lastChannelRootTimer.timeout.get().append(self.__onCreate)
+               self.lastChannelRootTimer.callback.append(self.__onCreate)
                self.lastChannelRootTimer.start(100,True)
 
                self.history_tv = [ ]
index 10423ada7ad9af83f658c03b83aebd760d43b597..5028301e9275c37ad57b2dadf9ce931aa7cdeaa5 100644 (file)
@@ -29,7 +29,7 @@ class MMIDialog(Screen):
                self.slotid = slotid
 
                self.timer = eTimer()
-               self.timer.timeout.get().append(self.keyCancel)
+               self.timer.callback.append(self.keyCancel)
 
                #else the skins fails
                self["title"] = Label("")
index 7746b135a29a48423fafb7d2a248ad5efe9f5ed0..1bb3d0b16adb184d78f5a71dcbc719f5c9f030a6 100644 (file)
@@ -22,7 +22,7 @@ class EventViewBase:
                self["key_red"] = Button("")
                if similarEPGCB is not None:
                        self.SimilarBroadcastTimer = eTimer()
-                       self.SimilarBroadcastTimer.timeout.get().append(self.getSimilarEvents)
+                       self.SimilarBroadcastTimer.callback.append(self.getSimilarEvents)
                else:
                        self.SimilarBroadcastTimer = None
                if self.isRecording:
index 1578fae1ff11dae31463c52804ed77409a3c5f5b..19a674ec66d8da6116f4b61ce820d5a9b585b676 100644 (file)
@@ -24,10 +24,10 @@ class HarddiskWait(Screen):
                self.timer = eTimer()
                if type == HarddiskSetup.HARDDISK_INITIALIZE:
                        text = _("Initializing Harddisk...")
-                       self.timer.timeout.get().append(self.doInit)
+                       self.timer.callback.append(self.doInit)
                else:
                        text = _("Checking Filesystem...")
-                       self.timer.timeout.get().append(self.doCheck)
+                       self.timer.callback.append(self.doCheck)
                self["wait"] = Label(text)
                self.timer.start(100)
 
index 228ca4efceacef71528e3b0ed5bec9da59b7ed65..80b4239e93d7d1865130deb2ee01cce6b69c24d5 100644 (file)
@@ -2,19 +2,16 @@ from Tools.Profile import profile, profile_final
 
 from Screen import Screen
 
-profile("LOAD:MovieSelection")
-from Screens.MovieSelection import MovieSelection
+profile("LOAD:enigma")
+from enigma import iPlayableService
+
 profile("LOAD:ChannelSelectionRadio")
 from Screens.ChannelSelection import ChannelSelectionRadio
+profile("LOAD:MovieSelection")
+from Screens.MovieSelection import MovieSelection
 profile("LOAD:ChoiceBox")
 from Screens.ChoiceBox import ChoiceBox
 
-profile("LOAD:InitBar_Components")
-from Components.Sources.Source import ObsoleteSource
-from Components.ActionMap import HelpableActionMap
-from Components.config import config
-from Components.ServiceEventTracker import ServiceEventTracker
-
 profile("LOAD:InfoBarGenerics")
 from Screens.InfoBarGenerics import InfoBarShowHide, \
        InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarRdsDecoder, \
@@ -25,12 +22,15 @@ from Screens.InfoBarGenerics import InfoBarShowHide, \
        InfoBarSummarySupport, InfoBarMoviePlayerSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \
        InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport
 
+profile("LOAD:InitBar_Components")
+from Components.Sources.Source import ObsoleteSource
+from Components.ActionMap import HelpableActionMap
+from Components.config import config
+from Components.ServiceEventTracker import ServiceEventTracker
+
 profile("LOAD:HelpableScreen")
 from Screens.HelpMenu import HelpableScreen
 
-profile("LOAD:enigma")
-from enigma import iPlayableService
-
 class InfoBar(InfoBarShowHide,
        InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, InfoBarRdsDecoder,
        InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, 
index 28e619fd75de525b5b66ae57abd575fcf3a1192a..b62a466b7d339962ce3766f1f390013dcb62b53d 100644 (file)
@@ -71,7 +71,7 @@ class InfoBarShowHide:
                self.__locked = 0
 
                self.hideTimer = eTimer()
-               self.hideTimer.timeout.get().append(self.doTimerHide)
+               self.hideTimer.callback.append(self.doTimerHide)
                self.hideTimer.start(5000, True)
 
                self.onShow.append(self.__onShow)
@@ -171,7 +171,7 @@ class NumberZap(Screen):
                        })
 
                self.Timer = eTimer()
-               self.Timer.timeout.get().append(self.keyOK)
+               self.Timer.callback.append(self.keyOK)
                self.Timer.start(3000, True)
 
 class InfoBarNumberZap:
@@ -1018,7 +1018,7 @@ class InfoBarTimeshift:
                self.timeshift_enabled = 0
                self.timeshift_state = 0
                self.ts_rewind_timer = eTimer()
-               self.ts_rewind_timer.timeout.get().append(self.rewindService)
+               self.ts_rewind_timer.callback.append(self.rewindService)
 
                self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
                        {
index 216cf8c85b96244de6691327bc34dfb080c9c4dc..eac034798ef2e895fb2925c90e9324fa3e81cf89 100644 (file)
@@ -28,7 +28,7 @@ class Ipkg(Screen):
                
                self.activity = 0
                self.activityTimer = eTimer()
-               self.activityTimer.timeout.get().append(self.doActivityTimer)
+               self.activityTimer.callback.append(self.doActivityTimer)
                #self.activityTimer.start(100, False)
                                
                self.ipkg = IpkgComponent()
index df2766702da77c5b491c719e3801a766de280cee..51f398774966bcf67206c66a4a8bdedd89391405 100644 (file)
@@ -61,7 +61,7 @@ class MessageBox(Screen):
                self.timeout = timeout
                if timeout > 0:
                        self.timer = eTimer()
-                       self.timer.timeout.get().append(self.timerTick)
+                       self.timer.callback.append(self.timerTick)
                        self.onExecBegin.append(self.startTimer)
                        self.origTitle = None
                        if self.execing:
index e0bd4ab30789aff027b013f7c1c89db4048cc4d1..8fb1eb80a0ed34d7996c4f20f0b6d3d1c3944f52 100644 (file)
@@ -129,7 +129,7 @@ class SelectionEventInfo:
                self["Service"] = ServiceEvent()
                self.list.connectSelChanged(self.__selectionChanged)
                self.timer = eTimer()
-               self.timer.timeout.get().append(self.updateEventInfo)
+               self.timer.callback.append(self.updateEventInfo)
                self.onShown.append(self.__selectionChanged)
 
        def __selectionChanged(self):
@@ -156,7 +156,7 @@ class MovieSelection(Screen, HelpableScreen, SelectionEventInfo):
                self.bouquet_mark_edit = False
 
                self.delayTimer = eTimer()
-               self.delayTimer.timeout.get().append(self.updateHDDData)
+               self.delayTimer.callback.append(self.updateHDDData)
 
                self["waitingtext"] = Label(_("Please wait... Loading list..."))
 
index f5f48e250f66d9e510de4dc205306396d111f88d..6ae12cae88bce4a7c9206f49ac5d611d8c7aec7d 100644 (file)
@@ -148,7 +148,7 @@ class ParentalControlEditor(Screen):
                self.currentLetter = chr(SPECIAL_CHAR)
                self.readServiceList()
                self.chooseLetterTimer = eTimer()
-               self.chooseLetterTimer.timeout.get().append(self.chooseLetter)
+               self.chooseLetterTimer.callback.append(self.chooseLetter)
                self.onLayoutFinish.append(self.LayoutFinished)
 
                self["actions"] = NumberActionMap(["DirectionActions", "ColorActions", "OkCancelActions", "NumberActions"],
index 2a8c3df72b086067cadfe61d41622b5c23b8fec8..3e71912b1b4f2453d21a31d32382a4e33fb0ea41 100644 (file)
@@ -298,7 +298,7 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
                }, -2)
 
                self.statusTimer = eTimer()
-               self.statusTimer.timeout.get().append(self.updateStatus)
+               self.statusTimer.callback.append(self.updateStatus)
                #self.statusTimer.start(5000, True)
 
                self.list = []
index c098886887c7834ffca2218637fe3f06740a7dd4..448b4b44410ab5a99918cee652f8505f3c66689f 100644 (file)
@@ -23,7 +23,7 @@ class SubservicesQuickzap(InfoBarShowHide, InfoBarMenu, InfoBarServiceName, Info
                self.currentlyPlayingSubservice = 0
 
                self.timer = eTimer()
-               self.timer.timeout.get().append(self.playSubservice)
+               self.timer.callback.append(self.playSubservice)
                self.onLayoutFinish.append(self.onLayoutFinished)
 
                self["actions"] = NumberActionMap( [ "InfobarSubserviceQuickzapActions", "NumberActions", "DirectionActions", "ColorActions" ], 
index 1b133152f61ea38e28e81938a2ee2d53582e7cac..c987ac61ce2abc843d91ecdb20f4ce691db577a2 100644 (file)
@@ -162,7 +162,7 @@ class Wizard(Screen, HelpableScreen):
                self.currStep = 1
                
                self.timeoutTimer = eTimer()
-               self.timeoutTimer.timeout.get().append(self.timeoutCounterFired)
+               self.timeoutTimer.callback.append(self.timeoutCounterFired)
 
                self["text"] = Label()
 
index 2cbc0f4fc41c3a21ff3048f61f550bb9b4e4c1de..696b8e209b9c910d6f3eed22e025044555aae6e0 100644 (file)
@@ -56,7 +56,7 @@ class NumericalTextInput:
 
                if handleTimeout:
                        self.timer = eTimer()
-                       self.timer.timeout.get().append(self.timeout)
+                       self.timer.callback.append(self.timeout)
                else:
                        self.timer = None
                self.lastKey = -1
index 06d7435539057c5f6e242d55a07f20acc713b7a3..e3b4cd20c1028377059e4173c1a5a424ed6c6677 100644 (file)
@@ -135,7 +135,6 @@ typedef long time_t;
 %include <lib/base/object.h>
 %include <lib/base/eerror.h>
 
-%immutable eTimer::timeout;
 %immutable eSocketNotifier::activated;
 %include <lib/base/ebase.h>
 %include <lib/base/smartptr.h>
index 84716e7226626f5b9ce119b4411d3b1c2d595793..ad029fb67de01e73f5cb43f34473d10e77ed6ea8 100644 (file)
@@ -3,6 +3,7 @@
 #undef _POSIX_C_SOURCE
 #define _POSIX_C_SOURCE 200112L
 extern "C" void init_enigma();
+extern "C" void eBaseInit(void);
 extern void bsodFatal();
 
 #define SKIP_PART2
@@ -124,6 +125,7 @@ ePython::ePython()
        PyEval_InitThreads();
 
        init_enigma();
+       eBaseInit();
 }
 
 ePython::~ePython()
index 76f6aa88b03ee9df28ffaba1e0451004729ff2f5..9edc50ada9dec481dd22967db3d501b2f5c0e400 100644 (file)
@@ -314,10 +314,16 @@ inline ePyObject Impl_PyTuple_GET_ITEM(ePyObject list, unsigned int pos)
 }
 #endif
 
+inline void Impl_INCREF(PyObject *ob)
+{
+       Py_INCREF(ob);
+}
+
 inline void Impl_DECREF(PyObject *ob)
 {
        Py_DECREF(ob);
 }
+#define Org_Py_INCREF(obj) Impl_INCREF(obj)
 #define Org_Py_DECREF(obj) Impl_DECREF(obj)
 #undef Py_DECREF
 #undef Py_XDECREF
index fd72529b61907e4b16b956d403ef7620a4437faf..7e7c662d15bf03a7cd3cbe5d2e650f5a1403bd5b 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -1,3 +1,8 @@
+import eBaseImpl
+import enigma
+enigma.eTimer = eBaseImpl.eTimer
+enigma.eSocketNotifier = eBaseImpl.eSocketNotifier
+
 from Tools.Profile import profile, profile_final
 
 profile("PYTHON_START")
@@ -141,7 +146,7 @@ class Session:
                self.summary_desktop = summary_desktop
                self.nav = navigation
                self.delay_timer = eTimer()
-               self.delay_timer.timeout.get().append(self.processDelay)
+               self.delay_timer.callback.append(self.processDelay)
 
                self.current_dialog = None
 
@@ -350,7 +355,7 @@ class VolumeControl:
                self.muteDialog = session.instantiateDialog(Mute)
 
                self.hideVolTimer = eTimer()
-               self.hideVolTimer.timeout.get().append(self.volHide)
+               self.hideVolTimer.callback.append(self.volHide)
 
                vol = config.audio.volume.value
                self.volumeDialog.setValue(vol)
index bf232628ed07496df54e182a373ea90694485736..2bf2a59f9717d0f6972104b5cf0caa199351b3e1 100644 (file)
@@ -75,7 +75,7 @@ def stop():
 def run(duration = 1000):
        stoptimer = eTimer()
        stoptimer.start(duration * 1000.0)
-       stoptimer.timeout.get().append(stop)
+       stoptimer.callback.append(stop)
        while not stopped:
                runIteration()
 
index 6f3a05fbfe97290c92a491089169a0ad07dfa665..056963513bd9a2699d9802d3715cda892ab10406 100644 (file)
--- a/timer.py
+++ b/timer.py
@@ -139,7 +139,7 @@ class Timer:
                self.processed_timers = [ ]
                
                self.timer = eTimer()
-               self.timer.timeout.get().append(self.calcNextActivation)
+               self.timer.callback.append(self.calcNextActivation)
                self.lastActivation = time()
                
                self.calcNextActivation()