Cannot send a MessageBox ...

  • Hi,


    I'm new in this and I've been working on a small plugin, I'm facing a problem with opening a screen with message box. Enigma2 is carshing and I get the following on the error log:


    Here is the code, note that the message box is on line 54: (I tried to replace it with session.open and move the call back function under but that did not help)


    Anyone could tell me why is it failing to open the screen?

    Einmal editiert, zuletzt von laith.said ()

  • Zitat

    Originally posted by laith.said
    self.session.openWithCallback(self.close_session, MessageBox, _("NTP Update Manager:\nNTP server %s is activated" % ((ntpServer))), MessageBox.TYPE_INFO, timeout = 5)


    Anyone could tell me why is it failing to open the screen?



    Here is the error: _("NTP Update Manager:\nNTP server %s is activated" % ((ntpServer)))
    Use this code:


    Code
    message = "NTP Update Manager:\nNTP server " + ntpServer + " is activated" 
    mybox = self.session.openWithCallback(self.close_session, MessageBox, message, MessageBox.TYPE_INFO, timeout=5)
    mybox.setTitle(_("Ntp Update"))

    127.0.0.1 sweet 127.0.0.1

    Einmal editiert, zuletzt von lupomeo ()

  • Thanks lupomeo, but that did not help. I still get the following error:


    The code looks like this now:


    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.

    Einmal editiert, zuletzt von laith.said ()

  • Uhmm strange.....
    try to change:


    Code
    message = "NTP server " + ntpServer + " is activated"


    in


    Code
    message = "NTP server " + str(ntpServer) + " is activated"

    127.0.0.1 sweet 127.0.0.1

  • Maybe you need to cast ntpServer to a string.


    Try the following code in line 44:
    ntpServer = str(country.getElementsByTagName("ntp")[0].childNodes[0].data)


    Good luck.

    MfG Ali

    DM8000 | DM8000 | DM500HD | DM500HD | DM7020S


    Bash
    #!/bin/sh
    while [ 1 ]
    do
    	echo "i love my dreams!!!"
    	sleep 1
    done
  • The solution to use a string cast is the same of my previous post.


    Zitat

    Originally posted by laith.said
    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.


    You don't need to delete the .pyc files. You can simply upload your new .py file and restart Enigma2


    Ciao.

    127.0.0.1 sweet 127.0.0.1

    Einmal editiert, zuletzt von lupomeo ()