PyObject *in_weakreflist; /* List of weak references */
};
-#define COMPATIBILITY_MODE
-// with COMPATIBILITY_MODE enabled the callback list is accessed via console.appClosed.get()
-// we remove this code after next enigma2 release... then the list should be accessed via console.appClosed ( without .get() )
-
-#ifdef COMPATIBILITY_MODE
-struct eListCompatibilityWrapper
-{
- PyObject_HEAD
- PyObject *list;
- PyObject *in_weakreflist; /* List of weak references */
-};
-
-static int
-eListCompatibilityWrapper_traverse(eListCompatibilityWrapper *self, visitproc visit, void *arg)
-{
- Py_VISIT(self->list);
- return 0;
-}
-
-static int
-eListCompatibilityWrapper_clear(eListCompatibilityWrapper *self)
-{
- Py_CLEAR(self->list);
- return 0;
-}
-
-static void
-eListCompatibilityWrapper_dealloc(eListCompatibilityWrapper* self)
-{
- if (self->in_weakreflist != NULL)
- PyObject_ClearWeakRefs((PyObject *) self);
- eListCompatibilityWrapper_clear(self);
- Org_Py_DECREF(self->list);
- self->ob_type->tp_free((PyObject*)self);
-}
-
-static PyObject *
-eListCompatibilityWrapper_get(eListCompatibilityWrapper *self, void *closure)
-{
- Org_Py_INCREF(self->list);
- return self->list;
-}
-
-static PyMethodDef eListCompatibilityWrapper_methods[] = {
- {"get", (PyCFunction)eListCompatibilityWrapper_get, METH_NOARGS,
- "returns the list"
- },
- {NULL} /* Sentinel */
-};
-
-static PyGetSetDef eListCompatibilityWrapper_getseters[] = {
- {NULL} /* Sentinel */
-};
-
-static PyTypeObject eListCompatibilityWrapperType = {
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
- "eConsoleImpl.eListCompatibilityWrapper", /*tp_name*/
- sizeof(eListCompatibilityWrapper), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- (destructor)eListCompatibilityWrapper_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*/
- "eListCompatibilityWrapper objects", /* tp_doc */
- (traverseproc)eListCompatibilityWrapper_traverse, /* tp_traverse */
- (inquiry)eListCompatibilityWrapper_clear, /* tp_clear */
- 0, /* tp_richcompare */
- offsetof(eListCompatibilityWrapper, in_weakreflist), /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- eListCompatibilityWrapper_methods, /* tp_methods */
- 0, /* tp_members */
- eListCompatibilityWrapper_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 */
- 0, /* tp_new */
-};
-
-static PyObject *
-eConsolePy_dataAvail(eConsolePy *self, void *closure)
-{
- eListCompatibilityWrapper *wrapper = (eListCompatibilityWrapper *)eListCompatibilityWrapperType.tp_alloc(&eListCompatibilityWrapperType, 0);
- Org_Py_INCREF((PyObject*)wrapper);
- wrapper->list = self->cont->dataAvail.get();
- wrapper->in_weakreflist = NULL;
- return (PyObject*)wrapper;
-}
-
-static PyObject *
-eConsolePy_stdoutAvail(eConsolePy *self, void *closure)
-{
- eListCompatibilityWrapper *wrapper = (eListCompatibilityWrapper *)eListCompatibilityWrapperType.tp_alloc(&eListCompatibilityWrapperType, 0);
- Org_Py_INCREF((PyObject*)wrapper);
- wrapper->list = self->cont->stdoutAvail.get();
- wrapper->in_weakreflist = NULL;
- return (PyObject*)wrapper;
-}
-
-static PyObject *
-eConsolePy_stderrAvail(eConsolePy *self, void *closure)
-{
- eListCompatibilityWrapper *wrapper = (eListCompatibilityWrapper *)eListCompatibilityWrapperType.tp_alloc(&eListCompatibilityWrapperType, 0);
- Org_Py_INCREF((PyObject*)wrapper);
- wrapper->list = self->cont->stderrAvail.get();
- wrapper->in_weakreflist = NULL;
- return (PyObject*)wrapper;
-}
-
-static PyObject *
-eConsolePy_dataSent(eConsolePy *self, void *closure)
-{
- eListCompatibilityWrapper *wrapper = (eListCompatibilityWrapper *)eListCompatibilityWrapperType.tp_alloc(&eListCompatibilityWrapperType, 0);
- Org_Py_INCREF((PyObject*)wrapper);
- wrapper->list = self->cont->dataSent.get();
- wrapper->in_weakreflist = NULL;
- return (PyObject*)wrapper;
-}
-
-static PyObject *
-eConsolePy_appClosed(eConsolePy *self, void *closure)
-{
- eListCompatibilityWrapper *wrapper = (eListCompatibilityWrapper *)eListCompatibilityWrapperType.tp_alloc(&eListCompatibilityWrapperType, 0);
- Org_Py_INCREF((PyObject*)wrapper);
- wrapper->list = self->cont->appClosed.get();
- wrapper->in_weakreflist = NULL;
- return (PyObject*)wrapper;
-}
-#else
static PyObject *
eConsolePy_dataAvail(eConsolePy *self, void *closure)
{
{
return self->cont->appClosed.get();
}
-#endif
static PyGetSetDef eConsolePy_getseters[] = {
{"dataAvail",
if (m == NULL)
return;
-#ifdef COMPATIBILITY_MODE
- if (!PyType_Ready(&eListCompatibilityWrapperType))
- {
- Org_Py_INCREF((PyObject*)&eListCompatibilityWrapperType);
- PyModule_AddObject(m, "eListCompatibilityWrapper", (PyObject*)&eListCompatibilityWrapperType);
- }
-#endif
if (!PyType_Ready(&eConsolePyType))
{
Org_Py_INCREF((PyObject*)&eConsolePyType);
self.extra_args[name] = extra_args
self.callbacks[name] = callback
self.appContainers[name] = eConsoleAppContainer()
- self.appContainers[name].dataAvail.get().append(boundFunction(self.dataAvailCB,name))
- self.appContainers[name].appClosed.get().append(boundFunction(self.finishedCB,name))
+ self.appContainers[name].dataAvail.append(boundFunction(self.dataAvailCB,name))
+ self.appContainers[name].appClosed.append(boundFunction(self.finishedCB,name))
retval = self.appContainers[name].execute(cmd)
if retval:
self.finishedCB(name, retval)
self.appResults[name] += data
def finishedCB(self, name, retval):
- del self.appContainers[name].dataAvail.get()[:]
- del self.appContainers[name].appClosed.get()[:]
+ del self.appContainers[name].dataAvail[:]
+ del self.appContainers[name].appClosed[:]
data = self.appResults[name]
extra_args = self.extra_args[name]
del self.appContainers[name]
self.currentlyInstallingMetaIndex = None
self.console = eConsoleAppContainer()
- self.console.appClosed.get().append(self.installNext)
+ self.console.appClosed.append(self.installNext)
self.reloadFavourites = False
self.statusCallback = statusCallback
def runCmd(self, cmd):
print "executing", self.ipkg, cmd
- self.cmd.appClosed.get().append(self.cmdFinished)
- self.cmd.dataAvail.get().append(self.cmdData)
+ self.cmd.appClosed.append(self.cmdFinished)
+ self.cmd.dataAvail.append(self.cmdData)
if self.cmd.execute(self.ipkg + " " + cmd):
self.cmdFinished(-1)
def cmdFinished(self, retval):
self.callCallbacks(self.EVENT_DONE)
- self.cmd.appClosed.get().remove(self.cmdFinished)
- self.cmd.dataAvail.get().remove(self.cmdData)
+ self.cmd.appClosed.remove(self.cmdFinished)
+ self.cmd.dataAvail.remove(self.cmdData)
def cmdData(self, data):
print "data:", data
def getLinkState(self,iface,callback):
self.dataAvail = callback
cmd = self.ethtool_bin + " " + iface
- self.container.appClosed.get().append(self.cmdFinished)
- self.container.dataAvail.get().append(callback)
+ self.container.appClosed.append(self.cmdFinished)
+ self.container.dataAvail.append(callback)
self.container.execute(cmd)
def cmdFinished(self,retval):
- self.container.appClosed.get().remove(self.cmdFinished)
- self.container.dataAvail.get().remove(self.dataAvail)
+ self.container.appClosed.remove(self.cmdFinished)
+ self.container.dataAvail.remove(self.dataAvail)
def stopContainer(self):
self.container.kill()
self.task_progress_changed = task_progress_changed
from enigma import eConsoleAppContainer
self.container = eConsoleAppContainer()
- self.container.appClosed.get().append(self.processFinished)
- self.container.stdoutAvail.get().append(self.processStdout)
- self.container.stderrAvail.get().append(self.processStderr)
+ self.container.appClosed.append(self.processFinished)
+ self.container.stdoutAvail.append(self.processStdout)
+ self.container.stderrAvail.append(self.processStderr)
assert self.cmd is not None
assert len(self.args) >= 1
def run(self, callback, task_progress_changed):
Task.run(self, callback, task_progress_changed)
- self.container.stdoutAvail.get().remove(self.processStdout)
+ self.container.stdoutAvail.remove(self.processStdout)
self.container.dumpToFile(self.dumpFile)
def processStderr(self, data):
def run(self, callback, task_progress_changed):
Task.run(self, callback, task_progress_changed)
- self.container.stdoutAvail.get().remove(self.processStdout)
+ self.container.stdoutAvail.remove(self.processStdout)
self.container.dumpToFile(self.dumpFile)
self.container.readFromFile(self.inputFile)
self.skin = PluginRunner.skin
Screen.__init__(self, session)
self.container = eConsoleAppContainer()
- self.container.appClosed.get().append(self.finishedExecution)
+ self.container.appClosed.append(self.finishedExecution)
self.runPlugin(pluginname)
def runPlugin(self, pluginname):
md5 = self.nfo[pos+5:pos+5+32] + " " + self.nfilocal
print cmd, md5
self.download_container.setCWD(self["destlist"].getCurrentDirectory())
- self.download_container.appClosed.get().append(self.md5finished)
+ self.download_container.appClosed.append(self.md5finished)
self.download_container.execute(cmd)
self.download_container.write(md5)
- self.download_container.dataSent.get().append(self.md5ready)
+ self.download_container.dataSent.append(self.md5ready)
else:
self["statusbar"].text = "Download completed."
self.downloading(False)
def md5finished(self, retval):
print "[md5finished]: " + str(retval)
- self.download_container.appClosed.get().remove(self.md5finished)
+ self.download_container.appClosed.remove(self.md5finished)
if retval==0:
self["statusbar"].text = _(".NFI file passed md5sum signature check. You can safely flash this image!")
self.switchList(self.LIST_SOURCE)
def flasherdownload_finished(self, string=""):
print "[flasherdownload_finished] " + str(string)
self.container = eConsoleAppContainer()
- self.container.appClosed.get().append(self.umount_finished)
- self.container.dataAvail.get().append(self.tool_avail)
+ self.container.appClosed.append(self.umount_finished)
+ self.container.dataAvail.append(self.tool_avail)
self.taskstring = ""
umountdevs = ""
from os import listdir
self.taskstring += string
def umount_finished(self, retval):
- self.container.appClosed.get().remove(self.umount_finished)
+ self.container.appClosed.remove(self.umount_finished)
self.session.openWithCallback(self.dmesg_clear, MessageBox, _("To make sure you intend to do this, please remove the target USB stick now and stick it back in upon prompt. Press OK when you have taken the stick out."), MessageBox.TYPE_INFO)
def dmesg_clear(self, answer):
- self.container.appClosed.get().append(self.dmesg_cleared)
+ self.container.appClosed.append(self.dmesg_cleared)
self.taskstring = ""
self.cmd = "dmesg -c"
print "executing " + self.cmd
self.container.execute(self.cmd)
def dmesg_cleared(self, retval):
- self.container.appClosed.get().remove(self.dmesg_cleared)
+ self.container.appClosed.remove(self.dmesg_cleared)
self.session.openWithCallback(self.stick_back_in, MessageBox, (_("Now please insert the USB stick (minimum size is 64 MB) that you want to format and use as .NFI image flasher. Press OK after you've put the stick back in.")), MessageBox.TYPE_INFO)
def stick_back_in(self, answer):
self["job_progresslabel"].text = "-%d s" % (6-self.delayCount)
if self.delayCount > 5:
self.delayTimer.stop()
- self.container.appClosed.get().append(self.dmesg_scanned)
+ self.container.appClosed.append(self.dmesg_scanned)
self.taskstring = ""
self.cmd = "dmesg"
print "executing " + self.cmd
self.container.execute(self.cmd)
def dmesg_scanned(self, retval):
- self.container.appClosed.get().remove(self.dmesg_scanned)
+ self.container.appClosed.remove(self.dmesg_scanned)
dmesg_lines = self.taskstring.splitlines()
self.devicetext = None
self.stickdevice = None
self["job_progressbar"].value = 100
self["job_progresslabel"].text = "5.00%"
self.taskstring = ""
- self.container.appClosed.get().append(self.fdisk_finished)
+ self.container.appClosed.append(self.fdisk_finished)
self.container.execute("fdisk " + self.stickdevice + "/disc")
self.container.write("d\nn\np\n1\n\n\nt\n6\nw\n")
self.delayTimer = eTimer()
self.remove_img(True)
def fdisk_finished(self, retval):
- self.container.appClosed.get().remove(self.fdisk_finished)
+ self.container.appClosed.remove(self.fdisk_finished)
self.delayTimer.stop()
if retval == 0:
if fileExists(self.imagefilename):
else:
self["statusbar"].text = _("Decompressing USB stick flasher boot image...")
self.taskstring = ""
- self.container.appClosed.get().append(self.tar_finished)
+ self.container.appClosed.append(self.tar_finished)
self.container.setCWD("/tmp")
self.cmd = "tar -xjvf nfiflasher_image.tar.bz2"
self.container.execute(self.cmd)
def tar_finished(self, retval):
self.delayTimer.stop()
- if len(self.container.appClosed.get()) > 0:
- self.container.appClosed.get().remove(self.tar_finished)
+ if len(self.container.appClosed) > 0:
+ self.container.appClosed.remove(self.tar_finished)
if retval == 0:
self.imagefilename = "/tmp/nfiflash_" + self.box + ".img"
self["statusbar"].text = _("Copying USB flasher boot image to stick...")
self.taskstring = ""
- self.container.appClosed.get().append(self.dd_finished)
+ self.container.appClosed.append(self.dd_finished)
self.cmd = "dd if=%s of=%s" % (self.imagefilename,self.stickdevice+"/part1")
self.container.execute(self.cmd)
print "executing " + self.cmd
def dd_finished(self, retval):
self.delayTimer.stop()
- self.container.appClosed.get().remove(self.dd_finished)
+ self.container.appClosed.remove(self.dd_finished)
self.downloading(False)
if retval == 0:
self["job_progressbar"].value = 950
self["job_progresslabel"].text = "95.00%"
self["statusbar"].text = _("Remounting stick partition...")
self.taskstring = ""
- self.container.appClosed.get().append(self.mount_finished)
+ self.container.appClosed.append(self.mount_finished)
self.cmd = "mount %s /mnt/usb -o rw,sync" % (self.stickdevice+"/part1")
self.container.execute(self.cmd)
print "executing " + self.cmd
self.session.openWithCallback(self.remove_img, MessageBox, (self.cmd + " " + _("failed") + ":\n" + str(self.taskstring)), MessageBox.TYPE_ERROR)
def mount_finished(self, retval):
- self.container.dataAvail.get().remove(self.tool_avail)
- self.container.appClosed.get().remove(self.mount_finished)
+ self.container.dataAvail.remove(self.tool_avail)
+ self.container.appClosed.remove(self.mount_finished)
if retval == 0:
self["job_progressbar"].value = 1000
self["job_progresslabel"].text = "100.00%"
self.session.summary.setText(_("Please wait for md5 signature verification..."))
self.container = eConsoleAppContainer()
self.container.setCWD(self["filelist"].getCurrentDirectory())
- self.container.appClosed.get().append(self.md5finished)
- self.container.dataSent.get().append(self.md5ready)
+ self.container.appClosed.append(self.md5finished)
+ self.container.dataSent.append(self.md5ready)
self.container.execute("md5sum -cw -")
self.container.write(self.md5sum)
else:
self.container = eConsoleAppContainer()
self.run = 0
- self.container.appClosed.get().append(self.runFinished)
- self.container.dataAvail.get().append(self.dataAvail)
+ self.container.appClosed.append(self.runFinished)
+ self.container.dataAvail.append(self.dataAvail)
self.onLayoutFinish.append(self.startRun) # dont start before gui is finished
def updateTitle(self):
def cancel(self):
if self.run == len(self.cmdlist):
self.close()
- self.container.appClosed.get().remove(self.runFinished)
- self.container.dataAvail.get().remove(self.dataAvail)
+ self.container.appClosed.remove(self.runFinished)
+ self.container.dataAvail.remove(self.dataAvail)
def dataAvail(self, str):
self["text"].setText(self["text"].getText() + str)
self.type = type
self.container = eConsoleAppContainer()
- self.container.appClosed.get().append(self.runFinished)
- self.container.dataAvail.get().append(self.dataAvail)
+ self.container.appClosed.append(self.runFinished)
+ self.container.dataAvail.append(self.dataAvail)
self.onLayoutFinish.append(self.startRun)
self.onShown.append(self.setWindowTitle)
def installFinished(self):
plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
- self.container.appClosed.get().remove(self.runFinished)
- self.container.dataAvail.get().remove(self.dataAvail)
+ self.container.appClosed.remove(self.runFinished)
+ self.container.dataAvail.remove(self.dataAvail)
self.close()
def runFinished(self, retval):
def cableTransponderSearchSessionClosed(self, *val):
print "cableTransponderSearchSessionClosed, val", val
- self.cable_search_container.appClosed.get().remove(self.cableTransponderSearchClosed)
- self.cable_search_container.dataAvail.get().remove(self.getCableTransponderData)
+ self.cable_search_container.appClosed.remove(self.cableTransponderSearchClosed)
+ self.cable_search_container.dataAvail.remove(self.getCableTransponderData)
self.cable_search_container = None
self.cable_search_session = None
if val and len(val) and val[0]:
return
self.__tlist = [ ]
self.cable_search_container = eConsoleAppContainer()
- self.cable_search_container.appClosed.get().append(self.cableTransponderSearchClosed)
- self.cable_search_container.dataAvail.get().append(self.getCableTransponderData)
+ self.cable_search_container.appClosed.append(self.cableTransponderSearchClosed)
+ self.cable_search_container.dataAvail.append(self.getCableTransponderData)
cableConfig = config.Nims[nim_idx].cable
cmd = "tda1002x --init --scan --verbose --wakeup --inv 2 --bus "
#FIXMEEEEEE hardcoded i2c devices for dm7025 and dm8000