Hello.
Please help. Help the beginner Enigma2 developer.
I've discovered a 'ihash tutorial' designed for the basic Plugins creation with code examples. One example is the one that serves to display the image file. The rendering of the image is done using the SKIN / XML function (Python module - Screens.Screen).
Unfortunately, I still do not know how to use this code outside the plugin, in a separate script. I do not know how to modify this code to work outside this plugin (located in the Python Enigma core).
Where can I find some explanation of the 'Screens.Screen' enigma / python module (except for lengthy code study from Git-Hub servers, of course)? Some examples of practical, but understandable use of the 'Screens.Screen' module for rendering an image file would help. It is sad that the explanations and comments (bounded by separator """) for all functions, objects, classes, etc. ... are not used in the source code of Enigma and its modules.
Studying the code itself is quite difficult and lengthy for a novice developer. A good enigma2 developer must know the principle of the enigma2 system. Unfortunately, I did not grow on Enigma 1.x up to the current version 2.x, but I grew up with other systems and platforms (also as a programmer). Similarly, Python code programming is not yet an expert.
Thanks.
- content of the file /usr/lib/enigma2/python/Plugins/Extensions/lesson_07/plugin.py :
# Ihad.tv enigma2-plugin tutorial 2010 # lesson 7 # by emanuel from Screens.Screen import Screen from Components.Label import Label from Components.Pixmap import Pixmap from Components.AVSwitch import AVSwitch from Components.ActionMap import ActionMap from Plugins.Plugin import PluginDescriptor from enigma import ePicLoad ########################################################################### class PictureScreen(Screen): skin=""" <screen name="PictureScreen" position="0,0" size="1280,720" title="Picture Screen" flags="wfNoBorder" backgroundColor="#002C2C39"> <widget name="myPic" position="center,center" size="1280,720" zPosition="1" alphatest="on" /> </screen>""" def __init__(self, session, picPath = None): Screen.__init__(self, session) print "[PictureScreen] __init__\n" self.picPath = picPath self.Scale = AVSwitch().getFramebufferScale() self.PicLoad = ePicLoad() self["myPic"] = Pixmap() self["myActionMap"] = ActionMap(["SetupActions"], { "ok": self.cancel, "cancel": self.cancel }, -1) self.PicLoad.PictureData.get().append(self.DecodePicture) self.onLayoutFinish.append(self.ShowPicture) def ShowPicture(self): if self.picPath is not None: self.PicLoad.setPara([ self["myPic"].instance.size().width(), self["myPic"].instance.size().height(), self.Scale[0], self.Scale[1], 0, 1, "#002C2C39"]) self.PicLoad.startDecode(self.picPath) def DecodePicture(self, PicInfo = ""): if self.picPath is not None: ptr = self.PicLoad.getData() self["myPic"].instance.setPixmap(ptr) def cancel(self): print "[PictureScreen] - cancel\n" self.close(None) ########################################################################### def main(session, **kwargs): session.open(PictureScreen, picPath = "/usr/share/enigma2/skin_default/testscreen.png") ########################################################################### def Plugins(**kwargs): return PluginDescriptor( name="07 View a picture", description="lesson 7 - Ihad.tv e2-tutorial", where = PluginDescriptor.WHERE_PLUGINMENU, icon="../lesson_01/ihad_tut.png", fnc=main)