--------
делаю миниплаг для показа фотки с иптв камеры
Код:
from Screens.Screen import Screen from Components.ActionMap import NumberActionMap from Components.Pixmap import Pixmap from Plugins.Plugin import PluginDescriptor import os from Tools.LoadPixmap import LoadPixmap class IPcam(Screen): skin = """ <screen position="100,100" size="640,520" title="IPcam" > <widget name="webpic" position="0,20" size="640,480" /> <!-- <ePixmap position="0,20" size="640,480" pixmap="/tmp/webcam.jpg" zPosition="1" transparent="1" alphatest="blend" /> --> </screen>""" def __init__(self, session, args = None): self.skin = IPcam.skin Screen.__init__(self, session) self["webpic"] = Pixmap() self["actions"] = NumberActionMap(["WizardActions", "InputActions"], { "ok": self.ok, "back": self.back }, -1) def ok(self): cmd = "wget http://192.168.178.38/img/snapshot.c...&quality=1 -O /tmp/webcam.jpg" self.setTitle("ok") os.system(cmd) #pngs only self["webpic"].instance.setPixmapFromFile("/tmp/webcam.jpg") self["webpic"].instance.LoadPixmap("/tmp/webcam.jpg") self.setTitle("showwww") def back(self): self.setTitle(_("back")) self.close() def main(session, **kwargs): session.open(IPcam) def Plugins(**kwargs): return [ PluginDescriptor(name="IPcam", description="plugin to watch ipcam image", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main, icon="plugin.png")]
---------
http://www.linksysbycisco.com/DE/de/support/WVC54GCA
Комментарий