plugin to write file

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    • plugin to write file

      Hi!
      I'm a newbi about python and plugin.
      I need to write a file in my enigma box from ir-remote input.
      I have found this plugin that display an input box, how can I add this keyboard input in a file on my box?
      Spoiler anzeigen

      from Screens.Screen import Screen
      from Components.Label import Label
      from Components.ActionMap import ActionMap
      from Components.Input import Input
      from Screens.InputBox import InputBox
      from Screens.MessageBox import MessageBox
      from Plugins.Plugin import PluginDescriptor

      ###########################################################################

      class MsgInput(Screen):
      skin = """
      <screen position="130,150" size="460,150" title="Insert input" >
      <widget name="myLabel" position="10,60" size="200,40"
      font="Regular;20"/>
      </screen>"""

      def __init__(self, session, args = 0):
      self.session = session
      Screen.__init__(self, session)

      self["myLabel"] = Label(_("please press OK"))
      self["myActionMap"] = ActionMap(["SetupActions"],
      {
      "ok": self.myInput,
      "cancel": self.cancel
      }, -1)

      def myInput(self):
      self.session.openWithCallback(self.askForWord, InputBox,
      title=_("Insert input"), text=" " * 55, maxSize=55,
      type=Input.TEXT)

      def askForWord(self, word):
      if word is None:
      pass
      else:
      self.session.open(MessageBox,_(word), MessageBox.TYPE_INFO)

      def cancel(self):
      print "\n[MsgInput] cancel\n"
      self.close(None)
      ###########################################################################
      def main(session, **kwargs):
      print "\n[MsgInput] start\n"
      session.open(MsgInput)
      ###########################################################################
      def Plugins(**kwargs):
      return PluginDescriptor(
      name="Insert input",
      description="Insert input",
      where = PluginDescriptor.WHERE_PLUGINMENU,
      icon="../ihad_tut.png",
      fnc=main)

      thks!!

      Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von hgdo ()

    • Simply follow the instructions in the tutorial from where you copied the text. (It mentions to create a directory below /usr/lib/enigma2/python/Plugins/Extensions and put ypur properly formatted text [number of spaces in lines is extremly important in Python] in a file named plugin.py along with an empty __init__.py file.)

      And either make sure that the mentioned image exists (ihad_tut.png) or remove that line.
      Diskutiere nie mit einem Idioten. Er zieht dich auf sein Niveau runter und schlägt dich mit seiner Erfahrung.