playing with the indigoreqhandler

Posted on
Sun Dec 09, 2007 11:23 am
Martijn Heeroma offline
Posts: 189
Joined: Oct 24, 2007

playing with the indigoreqhandler

when you add the following after line 444 of indigoreqhandler.py
Code: Select all
def iphone_varlistpage(self, miniUI=kFalseStr, width=kEmptyStr, serverStatus=None):
      """
      Return Type: HTML page
      """
      if not cherrypy.server.indigoDb.AreControlPagesAllowed():
         return self._ReturnControlDisabled(kHtmlPageStr)
      try:
         self._ForceHeadersToNeverCache()

         devList = cherrypy.server.indigoDb.GetDevices(cherrypy.server.indigoConn, True)
         actionGroupList = cherrypy.server.indigoDb.GetActionGroups(cherrypy.server.indigoConn, True)
         variableList = cherrypy.server.indigoDb.GetVariables(cherrypy.server.indigoConn, True)
         if serverStatus == None:
            serverStatus = _kConnectedStatusStr

         if miniUI.lower() in [kTrueStr, u"yes", u"1"]:
            tmpl = self._GetGlobalTemplate('iphone_varlistpage_mini.html')
         else:
            tmpl = self._GetGlobalTemplate('iphone_varlistpage.html')
         tmpl.serverStatus = serverStatus
         tmpl.devList = devList
         tmpl.actionGroupList = actionGroupList
         tmpl.variableList = variableList
         tmpl.width = width
         return tmpl.RenderTemplate()
      except (ic.ConnError, ic.InternalError, ic.ServerError), err:
         return self._ReturnError(kHtmlPageStr, err.value)
      except idb.ControlDisabled:
         return self._ReturnControlDisabled(kHtmlPageStr)
   iphone_varlistpage.exposed = True

and add a iphone_varlistpage.html file like:


Code: Select all
#filter $indigoCheetahFilter
<ul id="list" title="Variable list">


#set $cellColorClass = u'darkRowBg'
#for $variable in $variableList
  #if $cellColorClass == u'darkRowBg'
    #set $cellColorClass = u'lightRowBg'
  #else
    #set $cellColorClass = u'darkRowBg'
  #end if
      <li>$variable.name

  #if $variable.value
               <a>$variable.value</a></li>
  #else
               <a>&nbsp;</a></li>
  #end if

#end for
</ul>


than you can make nice lists formatted for the IPhone ;)

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 6 guests