Thanks lupomeo, but that did not help. I still get the following error:
ntp server name is: dk.pool.ntp.org
Traceback (most recent call last):
File "/home/tux/dm7025/dm7025_07/build/tmp/work/gemini2-3.8.0+cvs20081009-r22/image/usr/lib/enigma2/python/Components/ActionMap.py", line 46, in action
File "/usr/lib/enigma2/python/Plugins/Extensions/NTPUpdateManager/plugin.py", line 56, in selCountry
mybox = self.session.openWithCallback(self.close_session, MessageBox, message, MessageBox.TYPE_INFO, timeout=5)
File "/usr/lib/enigma2/python/mytest.py", line 271, in openWithCallback
dlg = self.open(screen, *arguments, **kwargs)
File "/usr/lib/enigma2/python/mytest.py", line 281, in open
dlg = self.current_dialog = self.instantiateDialog(screen, *arguments, **kwargs)
File "/usr/lib/enigma2/python/mytest.py", line 216, in instantiateDialog
return self.doInstantiateDialog(screen, arguments, kwargs, self.desktop)
File "/usr/lib/enigma2/python/mytest.py", line 247, in doInstantiateDialog
dlg.applySkin()
File "/home/tux/dm7025/dm7025_07/build/tmp/work/gemini2-3.8.0+cvs20081009-r22/image/usr/lib/enigma2/python/Components/GUISkin.py", line 90, in applySkin
File "/home/tux/dm7025/dm7025_07/build/tmp/work/gemini2-3.8.0+cvs20081009-r22/image/usr/lib/enigma2/python/Components/GUISkin.py", line 26, in createGUIScreen
File "/home/tux/dm7025/dm7025_07/build/tmp/work/gemini2-3.8.0+cvs20081009-r22/image/usr/lib/enigma2/python/Components/GUIComponent.py", line 108, in GUIcreate
File "/home/tux/dm7025/dm7025_07/build/tmp/work/gemini2-3.8.0+cvs20081009-r22/image/usr/lib/enigma2/python/Components/VariableText.py", line 24, in postWidgetCreate
TypeError: in method 'eLabel_setText', argument 2 of type 'std::string const &'
(PyObject_CallObject(<bound method ActionMap.action of <Components.ActionMap.ActionMap instance at 0x2f4a2fa8>>,('SetupActions', 'ok')) failed)
Alles anzeigen
The code looks like this now:
from Screens.Screen import Screen
from Plugins.Plugin import PluginDescriptor
from Components.ActionMap import ActionMap
from Components.MenuList import MenuList
import xml.dom.minidom
import os
from Screens.MessageBox import MessageBox
class SelectCountry(Screen):
skin = """
<screen position="90,95" size="560,430" title="NTP Update Manager" >
<widget name="countrymenu" position="10,0" size="550,420" scrollbarMode="showOnDemand" />
</screen>
"""
def __init__(self, session, xmlparse, selection):
self.skin = SelectCountry.skin
Screen.__init__(self,session)
self.xmlparse = xmlparse
self.selection = selection
list = []
for contenant in self.xmlparse.getElementsByTagName("contenant"):
if contenant.getAttribute("cont").encode("utf8") == self.selection:
for country in contenant.getElementsByTagName("country"):
list.append(country.getAttribute("name").encode("utf8"))
self["countrymenu"] = MenuList(list)
self["actions"] = ActionMap(["SetupActions"],
{
"ok" : self.selCountry,
"cancel" : self.close_session,
}, -2)
def selCountry(self):
if os.path.isfile("/etc/init.d/ntpupdate.sh"):
selection_country = self["countrymenu"].getCurrent()
for contenant in self.xmlparse.getElementsByTagName("contenant"):
if contenant.getAttribute("cont").encode("utf8") == self.selection:
for country in contenant.getElementsByTagName("country"):
if country.getAttribute("name").encode("utf8") == selection_country:
ntpServer = country.getElementsByTagName("ntp")[0].childNodes[0].data
print "ntp server name is: ", ntpServer
cmd = "echo " + ntpServer + " >/etc/ntpserver"
os.system(cmd)
cmd = '/etc/init.d/ntpupdate.sh start'
os.system(cmd)
self.close_session
else:
self.close_session
message = "NTP server " + ntpServer + " is activated"
mybox = self.session.openWithCallback(self.close_session, MessageBox, message, MessageBox.TYPE_INFO, timeout=5)
mybox.setTitle(_("Ntp Update Manager"))
def close_session(self):
self.close()
class NTPManager(Screen):
skin = """
<screen position="90,95" size="560,430" title="NTP Update Manager" >
<widget name="menu" position="10,0" size="550,420" scrollbarMode="showOnDemand" />
</screen>
"""
def __init__(self, session):
self.skin = NTPManager.skin
Screen.__init__(self,session)
list = []
xmlfile = "/usr/lib/enigma2/python/Plugins/Extensions/NTPUpdateManager/ntpurls.xml"
if os.path.isfile(xmlfile):
xmlparse = xml.dom.minidom.parse(xmlfile)
for contenant in xmlparse.getElementsByTagName("contenant"):
list.append(contenant.getAttribute("cont").encode("utf8"))
self.xmlparse = xmlparse
self["menu"] = MenuList(list)
self["actions"] = ActionMap(["SetupActions"],
{
"ok" : self.selContenant,
"cancel" : self.close,
}, -2)
else:
self.close
def selContenant(self):
selection = self["menu"].getCurrent()
self.session.open(SelectCountry, self.xmlparse, selection)
def main(session, **kwargs):
session.open(NTPManager)
def Plugins(**kwargs):
return PluginDescriptor(
name="NTP Update Manager",
description=_("Select the NTP server and start NTPupdate"),
where = [ PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_PLUGINMENU ],
icon = "plugin.png", fnc = main)
Alles anzeigen
Please note that I have copied the plugin directory directly to the dreambox, deleted the .pyc files and restarted it the box to generate them again, that should not be a problem should it? i.e. I did not use the install plugin to install it.