Jump to content


Photo

softcam run with python plugin


  • Please log in to reply
No replies to this topic

#1 Arsalan

  • Member
  • 1 posts

0
Neutral

Posted 15 August 2012 - 14:28

I have DM 800HD . and i installed openPLI 2.1.

I m making python plugin for execute softcam.

Example:
I want that when i click on cam one it execute this path "/etc/init.d/softcam.mgcam start"..but i want that when this execute it dose'nt show our path but it show just our own message Example (please wait , cam Loading etc).
i try it by this but it is'nt working


here is my code

from Screens.Screen import Screen
from Screens.Console import Console
from Components.MenuList import MenuList
from Components.ActionMap import ActionMap
from Screens.MessageBox import MessageBox
from Plugins.Plugin import PluginDescriptor

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

class ToolsScreen(Screen):
skin = """
<screen name="My list" position="850,50" size="520,920" title="My list">
<widget name="myMenu" position="10,15" size="550,140" />
</screen>"""

def __init__(self, session):

Screen.__init__(self, session)
self.list = []
self.list.append(("Chapter 1", "com_one"))
self.list.append(("Chapter 2", "com_two"))
self.list.append(("Chapter 3", "com_tree"))
self.list.append((_("Exit"), "exit"))
self["myMenu"] = MenuList(self.list)
self["myActionMap"] = ActionMap(["SetupActions"],
{
"ok": self.go,
"cancel": self.cancel
}, -1)

def go(self):
returnValue = self["myMenu"].l.getCurrentSelection()[1]
print "\n[ToolsScreen] returnValue: " + returnValue + "\n"

if returnValue is not None:
if returnValue is "com_one":
self.session.open(MessageBox,_("press k to Exit"),MessageBox.TYPE_INFO)
self.prombt("/etc/init.d/softcam.CCcam start")
self.session.open(MessageBox,_("please press ok for chapter one"),MessageBox.TYPE_INFO)
elif returnValue is "com_two":
self.prombt("/etc/init.d/softcam.mgcamd stop")

elif returnValue is "com_tree":
self.prombt("echo 'hello'")

else:
print "\n[ToolsScreen] cancel\n"
self.close(None)

def prombt(self, com):
self.session.open(Console,_("start shell com: %s") % (com), ["%s" % com])

def cancel(self):
print "\n[ToolsScreen] cancel\n"
self.close(None)

how can i done it Properly ..please help me .ThankYou !


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users