Reichi your code worked a charm. I implemented it and screens now close automatically one after another when i press exit plugin button.
Many thanks my friend and Danke.
Reichi your code worked a charm. I implemented it and screens now close automatically one after another when i press exit plugin button.
Many thanks my friend and Danke.
Ok i will try the new code,
The reason i need to close all screens at once is because a user e-mailed me saying they'd like to close down the plugin from an "exit plugin" button after they have zapped to a channel using my WebsiteParser plugin...i did tell him it only takes an extra 2 seconds to press exit 5 or so times but you have to keep users happy.
I will try your code and let you know the outcome reichi.
Many thankk and danke
I do not understand, i don't appear to have a callback function. When i launch TransponderChannels screen i do this code:
Shown above is the screen being opened with two parameters passed. When i close TransponderChannels from within the screen i do the code below which works fine:
So i do not get why it is now asking for a callback as i shouldn't need to give it one if it closes ok from the screen itself.
I have changed the close function in the global class so that it equals screens.close(False), the green screen here states that the first parameter should not be boolean, i then changed screens.close(TransponderChannels) and it says that it shouldn't take a type as a first parameter. I just don't see why it is not closing as i don't open the screen with a callback in the first place. Maybe you could explain another way which may work.
Thanks,
Mark
Ah, well when i open the screen i open it with a callback, so how do i get around it when wanting to close a screen, is it just Screens.close(ScreenName,True) ?
Ok i tried your suggestion and it doesn't work. For some reason the program doesn't recognise other screens open, even when i define a class to remove programs in the global scope. Here is the code i have:
#we call this local class within a screen when we wish to close both screens in the plugin
def closeplugin(self):
#this is used to close the plugin all together
screen.append(TransponderChannels)
screen.append(MainMenu)
#we call ClosePlugin here
ClosePlugin()
#a global class we call when wanting to close the plugin
def ClosePlugin():
for screens in screen:
screens.close()
del screen[:]
Alles anzeigen
The above code brings the following error in the crash log when i view it:
File "/usr/lib/enigma2/python/Components/ActionMap.py", line 46, in action
File "/usr/lib/enigma2/python/Plugins/Extensions/TheWebsiteParser/plugin.py", line 2768, in closeplugin
ClosePlugin()
File "/usr/lib/enigma2/python/Plugins/Extensions/TheWebsiteParser/plugin.py", line 8448, in ClosePlugin
screens.close()
TypeError: unbound method close() must be called with TransponderChannels instance as first argument (got nothing instead)
(PyObject_CallObject(<bound method ActionMap.action of <Components.ActionMap.ActionMap instance at 0x1e75120>>,('ColorActions', 'blue')) failed)
I have also tried to say self.session.close(MainMenu), that code goes through but the screen does not close unless you are on it.
Do you know the right way i need to write this code to close all screens? The way you suggested is not working for me.
Thanks,
Mark
Hi there,
I know that i can close a screen using self.close() and the current session will close but what code do i use to close down a plugin all together?
Example is i have a plugin that has many screens, i'd like the user to be able to exit the plugin from a screen other than the first one in the plugin to save them having to press exit many times.
If anybody knows the code then that is apprechiated
Many thanks,
Mark
Thanks martin i now get it. I don't know why it is 3600 - western position but i can see how it works now.
Cheers kidda +++
Hello there,
For a plugin i am creating i wish to include a zap to channel feature, i have got the majority of it sorted but i am having some problems with codes for western satellites after i create instance of ScanSetup file.
the eastern satellites show like this (just the satellite degrees but without the . e.g. 192 instead of 19.2:
astra1 19.2east = 192
16.0east = 160
hotbird 13.0east = 130
However i have noticed the western ones have a different code, shown below is what i mean, i expected the western ones to be e.g. "-08" for 0.8west but it shows up as 3592 instead.
8.0west = 3520
5.0west = 3550
0.8west = 3592
Can somebody tell me how these codes are generated for western satellites and if indeed the eastern ones are simply the degree position without the dot? What can i do to the western ones to make them in a more readable format such as "-08" for 0.8west or will i just have to go around the western ones and work them out individually?
The code i refer to is the code within ScanSetup file, obviously the default satellite is 19.2, when i change "orbpos" to say -08 for 0.8west it just comes up as 61west instead.
def createConfig(self, frontendData):
defaultSat = {
"orbpos": 192,
"system": eDVBFrontendParametersSatellite.System_DVB_S,
"frequency": 11836,
"inversion": eDVBFrontendParametersSatellite.Inversion_Unknown,
"symbolrate": 27500,
"polarization": eDVBFrontendParametersSatellite.Polarisation_Horizontal,
"fec": eDVBFrontendParametersSatellite.FEC_Auto,
"fec_s2": eDVBFrontendParametersSatellite.FEC_9_10,
"modulation": eDVBFrontendParametersSatellite.Modulation_QPSK }
Alles anzeigen
Thanks
Mark
Hello there,
Recently i have been trying to display some images on the screen within a menulist, i discovered that the images wouldn't display inside the menulist but any text i added would. I then tried putting a different image into the menulist and this image appeared to work fine.
I then thought that my png image might have been in the wrong format, so i tried drawing it as a Pixmap on the screen and the image draws fine...so why does it not display inside a multicontententry menu list?
Here is some code i have been working on:
def DecodePicture(self, PicInfo = ""):
#we tell a pointer to equal the data of the picture from PicLoad, we will need this when decoding the picture we want
ptr = self.PicLoad.getData()
#now we can begin adding our data from lists to our labels, everytime DecodePicture is called the Pindex will be different, i.e. a different picture from the different feeds
#we then tell an element of chartpic to set it's pixmap to the pointer. Notice that we decide which feedpic to use depending on what picturecounter equals and notice we set the instance. This is because when we created it we declared it as a widget, not specifically a Pixmap object until object assignment i.e. self["feed"] = Pixmap()
self["feedpic"].instance.setPixmap(ptr)
def ok(self):
#now that we have our picPath we can start to decode the picture and load it on screen
self.PicLoad.startDecode("/tmp/1.png")
png = LoadPixmap("/tmp/1.png")
res = []
#we then make our png a set size (this is the size of each item in menulist) and we draw it at the position within the menu list shown e.g. 10,0
res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 0), size=(270, 25), png=png ))
#we then make our png 270 by 25 (this is the size of each item in menulist) and we draw it at the position within the menu list shown e.g. 10,0
#once our image has been drawn we then draw text in a similar way, instead we allow text to be drawn for each item saying "hello", note the position of the x-axis on the text compared to picture
res.append(MultiContentEntryText(pos=(280, 0), size=(125, 25), font=0, flags = RT_HALIGN_LEFT, text="hello", color=0x00FFFFFF, color_sel=0x00FFFFFF))
self.events.append(res)
#lastly we call fillmytext
self.fillmytxt()
def fillmytxt(self):
#when fillmytxt is called we aupply mylist with the contents of self.events, this list is what held all of the information to go into our menulist
self["mylist"].l.setList(self.events)
self['mylist'].show()
Alles anzeigen
ok so basically i press the ok button and the image i wish to show inside the menulist along side the text saying "hello" is displayed inside the Pixmap "feedpic" but not inside the menulist. Can anybody figure out how i could also get this image displayed inside the menulist?
Thanks
Hi, i have created a small plugin on python but i am stuck on how i can send text from one page to another, i know that i need to use a session callback but i am not sure how to do it.
How can i send the current index from a list called "mylist" and store it's value on another screen when i press the ok button?
So far i have this:
def ok(self):
itemnumber = self["mylist"].l.getSelectedIndex(self)
self.session.open(MyTestScreen2)
So when i run that, i'd like a new session to open called MyTestScreen2 and the variable itemnumber to be passed to a label within that screen called mylistindex. How do i do this?
I know i cannot put mylistindex.text = itemnumber because itemnumber is local to the previous session only.
Thanks
EDIT i managed to solve my problem by adding in an extra parameter when setting up a new window, i supply the window with an extra parameter and it displays the right value. People who are interested in passing data between windows in future might be interested to know this.
I post my plugin once completed.
thanks man, i'll look into how that works. I sent you a pm by the way which you may find interesting.
ok it says in the crash log that no module is called subprocess, but when i run it on windows or linux it shows that they is a module called sub process. Do you think it could be to do with the version of python in which i am using? Here i use python 2.6, any idea why that code works on a pc but not dream? Is they a list of modules which work on dreambox anywhere?
Anyways here is the relivent part to what the crashlog tells me:
action -> ColorActions blue
Traceback (most recent call last):
File "/usr/lib/enigma2/python/Components/ActionMap.py", line 46, in action
res = self.actions[action]()
File "/usr/lib/enigma2/python/Plugins/Extensions/Testing/plugin.py", line 417, in ping
import subprocess
ImportError: No module named subprocess
ok i am struggling to get what is going on there with that container, i am assuming that econsole allows you to display a console window inside a container, is this correct? I then assume i type the commands i wish to use within this window and then they execute yes?
I saw a testplugin of a file browser, i am assuming that i can look at this and change the code for the dir command for a ping command or something. This is just for my practice, it's so i can get used to how enigma2 works from general linux programming.
Hi, i have written programs in python before but it seems that when i try running some on my DB 8000 it doesn't like some of the functions in which i am using. I tried to create a simple ping plugin for my own testing use and it works when i try it on winpython but when i put it onto the dreambox it comes up with a blue screen everytime i run that part of the plugin.
Basically everytime the user presses the blue button the following is to be called:
(the code below actually does get called)
def ping(self):
import subprocess
host = "www.google.com"
ping = subprocess.Popen(
["ping", host],
stdout = subprocess.PIPE,
stderr = subprocess.PIPE
)
out, error = ping.communicate()
print out
Alles anzeigen
Ok excuse the bad indentation there, the file is properly indented but that is what is called when the blue button is pressed. If i remove that code from my plugin, the plugin will compile and load properly on the dreambox, so why does my ping code not work? Does the dreambox not like import subprocesses or something? If not how could i go about doing a basic ping example on a dreambox? I'll have to get used to knowing which functions work on a dreambox and which don't from my normal way of programming within the language.
Thanks