[py-svn] r36645 - in py/dist/py/test/rsession: . webdata

fijal at codespeak.net fijal at codespeak.net
Sat Jan 13 13:41:32 CET 2007


Author: fijal
Date: Sat Jan 13 13:41:20 2007
New Revision: 36645

Modified:
   py/dist/py/test/rsession/web.py
   py/dist/py/test/rsession/webdata/index.html
   py/dist/py/test/rsession/webdata/source.js
   py/dist/py/test/rsession/webjs.py
Log:
Improve a bit feel of scroll-into-view. Still to be improved.


Modified: py/dist/py/test/rsession/web.py
==============================================================================
--- py/dist/py/test/rsession/web.py	(original)
+++ py/dist/py/test/rsession/web.py	Sat Jan 13 13:41:20 2007
@@ -22,7 +22,7 @@
 
 DATADIR = py.path.local(__file__).dirpath("webdata")
 FUNCTION_LIST = ["main", "show_skip", "show_traceback", "show_info", "hide_info",
-    "show_host", "hide_host"]
+    "show_host", "hide_host", "hide_messagebox"]
 
 try:
     try:

Modified: py/dist/py/test/rsession/webdata/index.html
==============================================================================
--- py/dist/py/test/rsession/webdata/index.html	(original)
+++ py/dist/py/test/rsession/webdata/index.html	Sat Jan 13 13:41:20 2007
@@ -102,7 +102,7 @@
     <table id="main_table">
     </table>
     <fieldset id="messagebox_fieldset">
-      <legend><b>Data:</b></legend>
+      <legend><b>Data [<a href="javascript:hide_messagebox()">hide</a>]:</b></legend>
       <a name="message">
         <div id="messagebox"></div>
       </a>

Modified: py/dist/py/test/rsession/webdata/source.js
==============================================================================
Binary files. No diff available.

Modified: py/dist/py/test/rsession/webjs.py
==============================================================================
--- py/dist/py/test/rsession/webjs.py	(original)
+++ py/dist/py/test/rsession/webjs.py	Sat Jan 13 13:41:20 2007
@@ -62,6 +62,17 @@
     info = dom.document.getElementById("info")
     info.style.visibility = "hidden"
 
+SCROLL_LINES = 50
+
+def scroll_down_if_needed(mbox):
+    if dom.window.scrollMaxY - dom.window.scrollY < SCROLL_LINES:
+        mbox.parentNode.scrollIntoView()
+
+def hide_messagebox():
+    mbox = dom.document.getElementById("messagebox")
+    while mbox.childNodes:
+        mbox.removeChild(mbox.childNodes[0])
+
 def make_module_box(msg):
     tr = create_elem("tr")
     td = create_elem("td")
@@ -75,8 +86,7 @@
     td.setAttribute("onmouseover",
     "show_info('%s')" % (msg['fullitemname'],))
     td.setAttribute("onmouseout", "hide_info()")
-    
-    td2 = create_elem('td')
+        td2 = create_elem('td')
     tr.appendChild(td2)
     table = create_elem("table")
     td2.appendChild(table)
@@ -194,7 +204,7 @@
         glob.rsync_done = True
     if glob.data_empty:
         mbox = dom.document.getElementById('messagebox')
-        mbox.parentNode.scrollIntoView()
+        scroll_down_if_needed(mbox)
     return True
 
 def show_skip(item_name="aa"):



More information about the pytest-commit mailing list