From 63412a48810132e99e448591685e8924372b31a7 Mon Sep 17 00:00:00 2001 From: Julian Dittrich Date: Mon, 25 Jun 2007 19:05:09 +0000 Subject: [PATCH] commited for debugging with 3c5x9 --- .../src/WebComponents/Sources/WAPfunctions.py | 121 ++++++++++++++++ webinterface/src/web/wap/index.html.xml | 2 +- webinterface/src/web/wap/timeredit.html.xml | 132 ++++++++++++++++++ webinterface/src/web/wap/timerlist.html.xml | 11 +- webinterface/src/webif.py | 4 +- 5 files changed, 264 insertions(+), 6 deletions(-) create mode 100644 webinterface/src/WebComponents/Sources/WAPfunctions.py create mode 100644 webinterface/src/web/wap/timeredit.html.xml diff --git a/webinterface/src/WebComponents/Sources/WAPfunctions.py b/webinterface/src/WebComponents/Sources/WAPfunctions.py new file mode 100644 index 00000000..c3cc391d --- /dev/null +++ b/webinterface/src/WebComponents/Sources/WAPfunctions.py @@ -0,0 +1,121 @@ +Version = '$Header$'; + +from enigma import * +from Components.Sources.Source import Source + +import time, re#, sys +#import sys + +#sys.setdefaultencoding('utf8') + +class WAPfunctions( Source): + FILLOPTIONLIST = 0 + + def __init__(self, session,func = FILLOPTIONLIST): + self.func = func + Source.__init__(self) + self.session = session + self.result = False,"unknown command" + + def handleCommand(self,cmd): + print "WAPfunctions: handleCommand" + if self.func is self.FILLOPTIONLIST: + self.result = self.fillOptionList(cmd) + else: + self.result = False,"unknown command cmd(%s) self.func(%s)" % (cmd, self.func) + + def fillOptionList(self,param): + # is there an easier and better way? :\ + print "fillOptionList",param + #del param["sRef"] + + input = 0 + start = 1 + end = 1 + + timeNow = time.time() + timePlusTwo = timeNow + 7200 + + t = {} + t["sday"]=time.strftime("%d", time.localtime(timeNow)) + t["smonth"]=time.strftime("%m", time.localtime(timeNow)) + t["syear"]=time.strftime("%Y", time.localtime(timeNow)) + t["sminute"]=time.strftime("%M", time.localtime(timeNow)) + t["shour"]=time.strftime("%H", time.localtime(timeNow)) + + t["eday"]=time.strftime("%d", time.localtime(timePlusTwo)) + t["emonth"]=time.strftime("%m", time.localtime(timePlusTwo)) + t["eyear"]=time.strftime("%Y", time.localtime(timePlusTwo)) + t["eminute"]=time.strftime("%M", time.localtime(timePlusTwo)) + t["ehour"]=time.strftime("%H", time.localtime(timePlusTwo)) + + key = "" + for i in param: + p = str(i) + if p != "sRef": + key = p + + print "key: ",key + cutKey = re.sub("^[es]", "", key, 1) + print "cutKey: ",cutKey + + if cutKey == "min": + start = 0 + end = 59 + elif cutKey == "hour": + start = 1 + end = 24 + elif cutKey == "day": + start = 1 + end = 31 + elif cutKey == "month": + start = 1 + end = 12 + else: + start = int(t[key]) + end = int(t[key])+2 + + if(param[key] == "now"): + input = int(t[key]) + else: + input = int(param[key]) or 0 + + self.result = self.fillOptionListAny(input,start,end) + return self.result + + def fillOptionListAny(self,input,start,end): + returnList = [] + print input,start,end + for i in range(start,end+1,1): + returnList1 = [] + returnList1.append(i) + returnList1.append(i) + if i==input: + returnList1.append("selected") + else: + returnList1.append("") + returnList.append(returnList1) + return returnList + + def getText(self): + print self.result + (result,text) = self.result + return text + + def getList(self): + print self.result + return self.result + + text = property(getText) + + ## part for listfiller requests + def command(self): + timerlist = [] + + return timerlist + + list = property(getList) + lut = {"Name":0 + ,"Value":1 + ,"Selected":2 + } diff --git a/webinterface/src/web/wap/index.html.xml b/webinterface/src/web/wap/index.html.xml index 5a5d4b0e..018b9e71 100755 --- a/webinterface/src/web/wap/index.html.xml +++ b/webinterface/src/web/wap/index.html.xml @@ -14,7 +14,7 @@
Remote Control
- + PowerState
diff --git a/webinterface/src/web/wap/timeredit.html.xml b/webinterface/src/web/wap/timeredit.html.xml new file mode 100644 index 00000000..b0caf658 --- /dev/null +++ b/webinterface/src/web/wap/timeredit.html.xml @@ -0,0 +1,132 @@ + + + + Enigma 2 Webinterface (ALPHA) + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Action: +
Note: For recurring events start/end day/month are not required.
Start: + . + . + --- + : +
End:. + . + --- + : + +
Note: For one-time events the "days" field doesn't have to be specified.
Days: + Mo + Tu + We + Th + Fr + Sa + Su + Mo-Fr + Mo-Su
Channel:

TV

+

Radio

Channel:

+ +
Name: +
Description: +
After event do: +
+ + + +
+ + +
\ No newline at end of file diff --git a/webinterface/src/web/wap/timerlist.html.xml b/webinterface/src/web/wap/timerlist.html.xml index 994304df..b7eef711 100755 --- a/webinterface/src/web/wap/timerlist.html.xml +++ b/webinterface/src/web/wap/timerlist.html.xml @@ -1,5 +1,8 @@ <html> <head> + <meta content="text/html; charset=UTF-8" http-equiv="content-type"> <title>Enigma 2 Webinterface (ALPHA)</title> @@ -11,10 +14,10 @@ <div style="text-align: center;"> <table border="1"> <tr> - <td>Channel</td> - <td>Name</td> - <td>Description</td> - <td>Action</td> + <td><b>Channel</b></td> + <td><b>Name</b></td> + <td><b>Description</b></td> + <td><b>Action</b></td> </tr> <tr> diff --git a/webinterface/src/webif.py b/webinterface/src/webif.py index 2e6ba179..9057575c 100644 --- a/webinterface/src/webif.py +++ b/webinterface/src/webif.py @@ -1,4 +1,4 @@ -Version = '$Header$'; + # OK, this is more than a proof of concept # things to improve: @@ -32,6 +32,7 @@ from WebComponents.Sources.ParentControl import ParentControl from WebComponents.Sources.About import About from WebComponents.Sources.RequestData import RequestData from WebComponents.Sources.AudioTracks import AudioTracks +from WebComponents.Sources.WAPfunctions import WAPfunctions from Components.Sources.FrontendStatus import FrontendStatus @@ -97,6 +98,7 @@ class TestScreen(InfoBarServiceName, InfoBarEvent,InfoBarTuner, WebScreen): self["AudioTracks"] = AudioTracks(session) self["About"] = About(session) + self["WAPFillOptionList"] = WAPfunctions(session,func = WAPfunctions.FILLOPTIONLIST) def getServiceList(self, sRef): self["ServiceList"].root = sRef -- 2.20.1