Hi guys.
A hope someone can help me.
I'm trying to make a plugin for settings and a can't get, how to open a third window? I don't know how to get the data from the server (.xml) in the third window.
I'm not a coder, just testing :)
Thanks
1. window = Settings E2
2. window = One, Two, ....
3. window = Motor, Multifeed
plugin.py
Python
class Other(Screen):
skin = '''
<screen position="center,center" size="800,510" title="Other Addons Download" backgroundColor="#000000" >\
<widget name="list" position="10,110" size="750,405" scrollbarMode="showOnDemand" zPosition="2" backgroundColor="#000000"/>\
<widget name="info" position="250,200" zPosition="4" size="300,300" font="Regular;24" foregroundColor="#ffffff" transparent="1" halign="center" valign="center" backgroundColor="#000000" />\
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/" position="0,0" size="1000,570" zPosition="-1"/>\
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/" position="0,0" size="1000,100" zPosition="-1"/>\
</screen>'''
def __init__(self, session):
self.skin = Other.skin
Screen.__init__(self, session)
self.list = []
self['list'] = MenuList([])
self['info'] = Label()
self['fspace'] = Label()
self.addon = 'emu'
self.icount = 0
self.downloading = False
self['info'].setText('Downloading addons, Please wait...')
self.timer = eTimer()
self.timer.callback.append(self.downloadxmlpage)
self.timer.start(100, 1)
self['actions'] = ActionMap(['SetupActions', 'ColorActions'], {'ok': self.okClicked,
'cancel': self.close}, -2)
def downloadxmlpage(self):
url = ''
getPage(url).addCallback(self._gotPageLoad).addErrback(self.errorLoad)
def errorLoad(self, error):
print str(error)
self['info'].setText('Please check internet connection or server is offline !')
self.downloading = False
def _gotPageLoad(self, data):
self.xml = data
try:
if self.xml:
xmlstr = minidom.parseString(self.xml)
else:
self.downloading = False
self['info'].setText('Please check internet connection or server is offline !')
return
self.data = []
self.names = []
icount = 0
list = []
xmlparse = xmlstr
self.xmlparse = xmlstr
for plugins in xmlstr.getElementsByTagName('plugins'):
self.names.append(plugins.getAttribute('cont').encode('utf8'))
self.list = list
self['info'].setText('')
self['list'].setList(self.names)
self.downloading = True
except:
self.downloading = False
self['info'].setText('Error processing server addons data.')
def okClicked(self):
if self.downloading == True:
try:
selection = str(self['list'].getCurrent())
self.session.open(Installall, self.xmlparse, selection)
except:
return
else:
self.close
class Installall(Screen):
skin = '''
<screen position="center,center" size="800,510" title="Please select ..." backgroundColor="#000000" >\
<widget name="countrymenu" position="25,110" size="750,405" scrollbarMode="showOnDemand" zPosition="2" backgroundColor="#000000" />\
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/" position="0,0" size="1000,100" zPosition="-1"/>\
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/" position="0,0" size="1000,570" zPosition="-3"/>\
</screen>'''
def __init__(self, session, xmlparse, selection):
self.skin = Installall.skin
Screen.__init__(self, session)
self.xmlparse = xmlparse
self.selection = selection
list = []
for plugins in self.xmlparse.getElementsByTagName('plugins'):
if str(plugins.getAttribute('cont').encode('utf8')) == self.selection:
for plugin in plugins.getElementsByTagName('plugin'):
list.append(plugin.getAttribute('name').encode('utf8'))
list.sort()
self['countrymenu'] = MenuList(list)
self['actions'] = ActionMap(['SetupActions'], {'ok': self.selclicked,
'cancel': self.close}, -2)
def selclicked(self):
try:
selection_country = self['countrymenu'].getCurrent()
except:
return
for plugins in self.xmlparse.getElementsByTagName('plugins'):
if str(plugins.getAttribute('cont').encode('utf8')) == self.selection:
for plugin in plugins.getElementsByTagName('plugin'):
if plugin.getAttribute('name').encode('utf8') == selection_country:
urlserver = str(plugin.getElementsByTagName('url')[0].childNodes[0].data)
pluginname = plugin.getAttribute('name').encode('utf8')
self.prombt(urlserver, pluginname)
def prombt(self, com, dom):
self.com = com
self.dom = dom
if self.selection == '':
self.session.openWithCallback(self.callMyMsg, MessageBox, _(''), MessageBox.TYPE_YESNO)
else:
self.session.open(Console, _('downloading-installing: %s') % dom, ['opkg install -force-overwrite %s' % com])
def callMyMsg(self, result):
if result:
dom = self.dom
com = self.com
self.session.open(Console, _('downloading-installing: %s') % dom, ['ipkg install -force-overwrite %s' % com])
Display More
xml
XML
<?xml version="1.0" encoding="UTF-8" ?>
<xml>
<plugins cont = " Settings E2">
<plugin name = " One">
<pluginss id=" Motor">
<url>""</url>
</pluginss>
<pluginss id=" Multifeed">
<url>""</url>
</pluginss>
</plugin>
<plugin name = " Two">
<pluginss id=" Motor">
<url>""</url>
</pluginss>
<pluginss id=" Multifeed">
<url>""</url>
</pluginss>
</plugin>
</plugins>
</xml>
Display More