Permalink
Browse files

added input screen, image screen, line text, multi line text with scroll

  • Loading branch information...
1 parent 734e68f commit 8864a35ede2955f3276f5cee8c1b905c0745fd15 @ogonbat committed Mar 4, 2012
Showing with 106 additions and 14 deletions.
  1. +106 −14 django_phonehub/aastra/api.py
@@ -37,9 +37,15 @@ def setAllowXfer(self,val):
def setAllowConf(self,val):
self._list_root_options.append(' allowConf="%s"' % (val))
+
+ def setAllowDTMF(self,val):
+ self._list_root_options.append(' allowDTMF="%s"' % (val))
def setCancelAction(self,val):
self._list_root_options.append(' cancelAction="%s"' % (val))
+
+ def setDoneAction(self,val):
+ self._list_root_options.append(' doneAction="%s"' % (val))
def setWrapList(self,val):
self._list_root_options.append(' wrapList="%s"' % (val))
@@ -56,14 +62,15 @@ def setScrollUp(self,val):
def setScrollDown(self,val):
self._list_root_options.append(' scrollDown="%s"' % (val))
- def setNumberLaunch(self,val):
- self._list_root_options.append(' numberLaunch="%s"' % (val))
-
- def setDoneAction(self,val):
- self._list_root_options.append(' doneAction="%s"' % (val))
-
+ def setScrollLeft(self,val):
+ self._list_root_options.append(' scrollLeft="%s"' % (val))
+ def setScrollRight(self,val):
+ self._list_root_options.append(' scrollRight="%s"' % (val))
+ def setNumberLaunch(self,val):
+ self._list_root_options.append(' numberLaunch="%s"' % (val))
+
def content(self):
return self._content
@@ -72,15 +79,15 @@ def addSoftKeys(self,softkey_item):
for i in softkey_item.getSoftKey():
self._content += i
else:
- raise TypeError, "SoftKey Item not a SoftKey class Instance "
+ raise TypeError, "SoftKey Item not a SoftKey() class Instance "
def addIconList(self,icon):
if isinstance(icon, IconList):
self._content += '<IconList>'
for i in icon.getIcons():
self._content += i
self._content += '</IconList>'
else:
- raise TypeError, "Icon not a IconList class Instance"
+ raise TypeError, "Icon not a IconList() class Instance"
def getXMLRender(self):
self._xmlRoot = '<%s' % (self.root_name)
@@ -94,18 +101,18 @@ def getXMLRender(self):
class AastraIPPhoneTextMenu(AastraIPPhoneBase):
def __init__(self):
self.root_name = "AastraIPPhoneTextMenu"
- def addTitle(self,text="",wrap="no"):
+ def addTitle(self,text,wrap="no"):
self._content += '<Title wrap="%s">%s</Title>' % (wrap,text)
def addMenuItem(self,item):
if isinstance(item, MenuItem):
for i in item.getItems():
self._content += i
else:
- raise TypeError, "Item not a MenuItem class Instance"
-
-class AastraIPPhoneImageMenu(AastraIPPhoneBase):
+ raise TypeError, "Item not a MenuItem() class Instance"
+
+class AastraIPPhoneImageScreen(AastraIPPhoneBase):
def __init__(self):
- self.root_name = "AastraIPPhoneImageMenu"
+ self.root_name = "AastraIPPhoneImageScreen"
def setImageAction(self,val):
self._list_root_options.append(' imageAction="%s"' % (val))
def setMode(self,val):
@@ -115,6 +122,10 @@ def addImage(self,content,height,width,verticalAlign='middle',horizontalAlign='m
self._content += ' verticalAlign="%s" horizontalAlign="%s" height="%s" width="%s">'
self._content += content
self._content += '</Image>'
+
+class AastraIPPhoneImageMenu(AastraIPPhoneImageScreen):
+ def __init__(self):
+ self.root_name = "AastraIPPhoneImageMenu"
def addURLList(self,URIlist):
if isinstance(URIlist, URIList):
self._content += '<URIList%s'%(URIlist.getBase())
@@ -123,8 +134,71 @@ def addURLList(self,URIlist):
self._content += i
self._content += '</URIList>'
else:
- raise TypeError, "URI List not a URIList class Instance"
+ raise TypeError, "URI List not a URIList() class Instance"
+
+class AastraIPPhoneTextScreen(AastraIPPhoneBase):
+ def __init__(self):
+ self.root_name = "AastraIPPhoneTextScreen"
+ def addTitle(self,text,wrap="no"):
+ self._content += '<Title wrap="%s">%s</Title>' % (wrap,text)
+ def addText(self,text):
+ self._content += '<Text>%s</Text>' % (text)
+class AastraIPPhoneFormattedScreen(AastraIPPhoneBase):
+ def __init__(self):
+ self.root_name = "AastraIPPhoneFormattedScreen"
+ def addLine(self,line):
+ if isinstance(line,Line):
+ for i in line.getLine():
+ self._content += i
+ else:
+ raise TypeError, "line not a Line() class Instance"
+ def addScrollLine(self,line,height=None):
+ if isinstance(line,Line):
+ self._content += '<Scroll'
+ if height != None:
+ self._content += ' Height="%s"'%(height)
+ self._content += '>'
+ for i in line.getLine():
+ self._content += i
+ self._content += '</Scroll>'
+ else:
+ raise TypeError, "line not a Line() class Instance"
+
+class AastraIPPhoneInputScreen(AastraIPPhoneBase):
+ def __init__(self):
+ self.root_name = "AastraIPPhoneInputScreen"
+ def setLanguage(self,val="English"):
+ if val != "English":
+ self._list_root_options.append(' inputLanguage="%s"' % (val))
+ def setType(self,val="string", is_password=False):
+ if val != "string":
+ self._list_root_options.append(' type="%s"' % (val))
+ if is_password != False:
+ self._list_root_options.append(' password="yes"')
+ def addInput(self,inputItem):
+ if isinstance(inputItem, inputItem):
+ for i in inputItem.getInput():
+ self._content += i
+
+class inputItem():
+ _input_list = []
+ def addInput(self,prompt,URL,parameter,default,title=None,title_wrap="no"):
+ content = ""
+ if title != None:
+ content += '<Title'
+ if title_wrap != "no":
+ content += ' wrao="%s"'%(title_wrap)
+ content += '>%s</Title>'%(title)
+ content += '<Prompt>%s</Prompt>'%(prompt)
+ content += '<URL>%s</URL>'%(URL)
+ content += '<Parameter>%s</Parameter>'%(parameter)
+ content += '<Default>%s</Default>'%(default)
+ self._input_list.append(content)
+ def getInput(self):
+ for i in self._input_list:
+ yield i
+
class URIList():
_items_list = []
_base = ''
@@ -148,6 +222,24 @@ def __init__(self,Prompt,key):
def getContent(self):
return self._content
+class Line():
+ _line_list = []
+ def addLine(self,text,Size="normal",Align="left",Color="white"):
+ self._content = '<Line'
+ if Size != "normal":
+ self._content += ' Size="%s"'%(Size)
+ if Align != "left":
+ self._content += ' Align="%s"'%(Align)
+ if Color != "white":
+ self._content += ' Color="%s"'%(Color)
+ self._content += '>'
+ self._content += '%s'%(text)
+ self._content += '</Line>'
+ self._line_list.append(self._content)
+ def getLine(self):
+ for i in self._line_list:
+ yield i
+
class SoftKey():
_softkey_list = []
def addSoftKey(self,label,URI,index=None,icon_index=None):

0 comments on commit 8864a35

Please sign in to comment.