PDA

View Full Version : How to write your first enigma2 plugin



hda5
27-06-2012, 01:05 PM
I found the following information on the net and thought I'd post it here for those who are interested in writing their own Enigma 2 Plugins.

How to:Write your first enigma2 plugin

Enigma2 plugins programming is not difficult job and any one with any programming experience can write plugin
requirement:
basic knowldge in python programming language
basic knowldge in how enigma2 working

learning basic of python programming is not difficult and web is full of tutorials explaining how to start
start from site for python wiki.python.org/moin/BeginnersGuide/Programmers (http://wiki.python.org/moin/BeginnersGuide/Programmers)
python version used with enigma2 is version 2.6 usually
no need to know c++ language
plugin file usually put in this folder in dreambox
user/lib/enigma2/python/plugins/extensions and the main file is plugin.py

what you need to write plugin
text editor like notepad ++
ftp program
program dcc can offer both and it is very practical and easy to use

in the attachment pdf file for step by step to teach plugin programming,also available ipk file to install 10 lessons to your dreambox .

hda5
27-06-2012, 01:12 PM
More info available here
_http://al3z77.altervista.org/dokuwiki/doku.php?id=vuplusduo:vuplusduode velopment:start

donki
27-06-2012, 01:46 PM
The hardest part for me would be to work out what I'd like to see that isn't already available. :)

saintomer1866
27-06-2012, 05:08 PM
thanks hda5,
you come up trumps as usual planting that seed ;)
I'll try and start having a look at this at the weekend, hopefully a few others (inc oldfart) will too
just to point out the usual site formating error, there shouldn't be a gap between the e and v in development in your line above

St.O

oldfart
28-06-2012, 06:12 PM
Had another play with emanuel's (ihad) guide - got the first example working.
create a directory in

/usr/lib/enigma2/python/Plugins/Extensions
I used tutorial1 for the directory name

two files go into the directory
__init.py__
and
plugin.py

then use the menu & 'restart gui' so the plugins menu picks up the new plugin
or
from telnet - init 4 , wait 4 seconds (or so) then init 3

oldfart
28-06-2012, 06:19 PM
# Ihad.tv enigma2-plugin tutorial 2010
# lesson 01
# by emanuel
################################# ################################# #########

from Screens.Screen import Screen
from Components.Label import Label
from Components.ActionMap import ActionMap
from Plugins.Plugin import PluginDescriptor

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

class HalloWorldScreen(Screen):
skin = """
<screen position="130,150" size="460,150" title="Ihad.tv e2-tutorial lesson 1" >
<widget name="myLabel" position="10,60" size="200,40" font="Regular;20"/>
</screen>"""

def __init__(self, session, args = None):
self.session = session

Screen.__init__(self, session)
self["myLabel"] = Label(_("Hello World ;-)"))
self["myActionMap"] = ActionMap(["SetupActions"],
{
"cancel": self.close # add the RC Command "cancel" to close your Screen
}, -1)


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

def main(session, **kwargs):
print "\n[Hallo World] start\n"

session.open(HalloWorldScreen)

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

def Plugins(**kwargs):
return PluginDescriptor(
name="01 Hallo World",
description="lesson 1 - Ihad.tv e2-tutorial",
where = PluginDescriptor.WHERE_PLUGINMENU ,
icon="../ihad_tut.png",
fnc=main)

oldfart
28-06-2012, 06:20 PM
the CODE window isn't big enough!!!!

wildshovelbill
07-08-2012, 03:18 AM
im in take me awhile to catch up but wth

zeros
07-08-2012, 06:34 AM
Hi,
I have installed Wing IDE 4.1 but now the License is expired. Is it good for developing so I'm redy to buy License if that is good.
Also I have installed the Python 3.2 but You write that enigma2 is version 2.6 usually. So need I downgrade it?
Thanks,
Z

Eugenie
07-08-2012, 12:52 PM
Current Python version in E2 is 2.7.2...so your Python code needs to be compliant with this.



opendreambox 2.0.0 dm800


dm800 login: root
root@dm800:~# python
Python 2.7.2 (default, May 8 2012, 18:47:29)
[GCC 4.6.4 20120303 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
****>

jimrare
07-08-2012, 01:15 PM
I have installed Wing IDE 4.1 but now the License is expired
You dont need any licenses, if you want to develop from your pc, simply download from the official python website _http://www.python.org/download/ There is some great do***entation as well.

zeros
10-08-2012, 06:52 PM
Thanks to all!
I still purchased the license to Wing IDE:
_http://wingware.com/downloads
so I'm ready now for trying development. :-)

oldfart
11-08-2012, 05:56 PM
away you go then ......

zeros
14-08-2012, 05:46 PM
Does anyone else have these exercises done? If YES then which boxes You are used. I will try with qboxhd and still working on it. :-)
Thanks to Mr. oldfart for helping us, it has many benefits.

zeros
23-08-2012, 05:34 AM
Thanks Eugenie! qboxhd using Python version:

Welcome to QBoxHD
root@qboxhd# python
Python 2.6.1 (r261:67515, Jan 1 2000, 02:33:26)
[GCC 4.2.3 (snapshot) (STMicroelectronics/Linux Base 4.2.3-43)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
****>

Please download Python 2.6.6 instead.
_http://www.python.org/download/releases/2.6.6/

So I lowered my Python version to 2.6.6. The tasks are solved in part.

zeros
28-10-2012, 06:47 PM
Finally I get all lessons working with my qboxhd. Many thanks, all they are very useful. Can I add them to the Estonian unofficial software? Emanuel would probably be necessary to allow that. Does anyone have his contact?
I will add Estonian language (multilanguage support). Without Emanuel permission, I do not dare to make big changes there.

sayguy
05-12-2017, 02:14 PM
Hi @hda5 I’m interested in making my own plugin to share with everyone on enigma2 devices it’s going to be a streaming plugin which users will be able to watch movies and tv series with URL links from sites. I just need to know which files and folders will I need to get the plugin up and running for this to work ?