[Yt-svn] commit/yt: 151 new changesets

Bitbucket commits-noreply at bitbucket.org
Thu Mar 31 08:55:26 PDT 2011


151 new changesets in yt:

http://bitbucket.org/yt_analysis/yt/changeset/12b909635ee2/
changeset:   r3906:12b909635ee2
branch:      yt
user:        MatthewTurk
date:        2011-03-26 16:34:05
summary:     Fixing some errors with the HTTP REPL
affected #:  2 files (412 bytes)

--- a/yt/gui/reason/bottle_mods.py	Wed Mar 23 19:53:53 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Sat Mar 26 11:34:05 2011 -0400
@@ -24,7 +24,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
-from .bottle import server_names, debug, route
+from .bottle import server_names, debug, route, run
 import uuid
 
 route_functions = {}
@@ -35,7 +35,8 @@
         return func
     return router
 
-def uuid_serve_functions(pre_routed, open_browser=False):
+def uuid_serve_functions(pre_routed = None, open_browser=False):
+    if pre_routed == None: pre_routed = route_functions
     debug(mode=True)
     token = uuid.uuid1()
     for r in pre_routed:
@@ -60,7 +61,7 @@
             import webbrowser, threading
             def _local_browse():
                 webbrowser.open('http://localhost:%s/%s/' % (8080, token))
-            thread = threading.Timer(0.5, _open_browser)
+            thread = threading.Timer(0.5, _local_browse)
             thread.start()
         local_browse()
     # Right now we only really support the built-in wsgiref, but this may


--- a/yt/gui/reason/http_repl.py	Wed Mar 23 19:53:53 2011 -0400
+++ b/yt/gui/reason/http_repl.py	Sat Mar 26 11:34:05 2011 -0400
@@ -30,6 +30,8 @@
 from .bottle_mods import preroute
 from .basic_repl import ProgrammaticREPL
 
+local_dir = os.path.dirname(__file__)
+
 class HTTPREPL(ProgrammaticREPL):
 
     def __init__(self, locals=None):
@@ -43,15 +45,17 @@
         preroute_table = dict(index = ("/", "GET"),
                               push = ("/push", "POST"),
                               dir = ("/dir", "GET"),
-                              doc = ("/doc", "GET"))
-        for v, args in preroute_table:
+                              doc = ("/doc", "GET"),
+                              resources = ("/resources/:val", "GET"))
+        for v, args in preroute_table.items():
             preroute(args[0], method=args[1])(getattr(self, v))
 
     def index(self):
         """Return an HTTP-based Read-Eval-Print-Loop terminal."""
         # For now this doesn't work!  We will need to move to a better method
         # for this.
-        return open(os.path.join(localDir, "httprepl.html")).read()
+        vals = open(os.path.join(local_dir, "httprepl.html")).read()
+        return vals
         
     def push(self):
         """Push 'line' and return exec results as a bare response."""
@@ -79,3 +83,11 @@
         if not result:
             response.status = 204
         return result
+
+    def resources(self, val):
+        pp = os.path.join(local_dir, "resources", val)
+        if not os.path.exists(pp):
+            response.status = 404
+            return
+        return open(pp).read()
+


http://bitbucket.org/yt_analysis/yt/changeset/7edc7a29f304/
changeset:   r3907:7edc7a29f304
branch:      yt
user:        MatthewTurk
date:        2011-03-26 23:16:56
summary:     Adding support for exposing RPC using ExtDirect through Bottle.
affected #:  2 files (6.5 KB)

--- a/yt/gui/reason/bottle_mods.py	Sat Mar 26 11:34:05 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Sat Mar 26 18:16:56 2011 -0400
@@ -24,8 +24,9 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
-from .bottle import server_names, debug, route, run
+from .bottle import server_names, debug, route, run, request
 import uuid
+from extdirect_router import DirectRouter
 
 route_functions = {}
 
@@ -35,6 +36,22 @@
         return func
     return router
 
+class BottleDirectRouter(DirectRouter):
+    # This class implements a mechanism for auto-routing an ExtDirect-callable
+    # object through Bottle.  It should be used as a base class of an object,
+    # and the __init__ function will need to include the keyword argument
+    # 'route' for it to work.
+    def __init__(self, *args, **kwargs):
+        route = kwargs.pop("route")
+        super(BottleDirectRouter, self).__init__(*args, **kwargs)
+        self.__name__ = ""
+        bottle.route(route, method="POST")(self)
+
+    def __call__(self):
+        val = request.body.read()
+        rv = super(BottleDirectRouter, self).__call__(val)
+        return rv
+
 def uuid_serve_functions(pre_routed = None, open_browser=False):
     if pre_routed == None: pre_routed = route_functions
     debug(mode=True)


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/extdirect_router.py	Sat Mar 26 18:16:56 2011 -0400
@@ -0,0 +1,179 @@
+"""
+This is code from the extdirect package:
+
+http://pypi.python.org/pypi/extdirect/0.3
+https://github.com/iancmcc/extdirect
+
+written by Ian McCracken
+
+This code was released under the BSD License.
+"""
+
+import inspect
+
+class DirectException(Exception):
+    pass
+
+
+try:
+    import json
+except ImportError:
+    try:
+        import simplejson as json
+    except ImportError:
+        raise DirectException("No JSON library available. Please install"
+                              " simplejson or upgrade to Python 2.6.")
+
+
+class DirectRouter(object):
+    """
+    Basic Ext.Direct router class.
+
+    Ext.Direct allows one to create an API that communicates with a single URL,
+    which then routes requests to the appropriate method. The client-side API
+    object matches the server-side API object.
+
+    This base class parses an Ext.Direct request, which contains the name of
+    the method and any data that should be passed, and routes the data to the
+    approriate method. It then receives the output of that call and puts it
+    into the data structure expected by Ext.Direct.
+
+    Call an instance of this class with the JSON from an Ext.Direct request.
+    """
+    def __call__(self, body):
+        """
+        """
+        # Decode the request data
+        body = json.loads(body)
+        self._body = body
+
+        if isinstance(body, list):
+            directRequests = body
+        elif isinstance(body, dict):
+            directRequests = [body]
+        else:
+            raise DirectException("Body is not a support type: %s" % body)
+
+        responses = []
+
+        for req in directRequests:
+            responses.append(self._doRequest(req))
+
+        if len(responses) == 1:
+            responses = responses[0]
+
+        return json.dumps(responses)
+
+    def _doRequest(self, request):
+
+        # Double-check that this request is meant for this class
+        action = request.get('action')
+        clsname = self.__class__.__name__
+        if action != clsname:
+            raise DirectException(("Action specified in request ('%s') is"
+                                  " not named %s.") % (action, clsname))
+
+        # Pull out the method name and make sure it exists on this class
+        method = request.get('method')
+        if not method:
+            raise DirectException("No method specified. Is this a valid"
+                                  " Ext.Direct request?")
+        try:
+            _targetfn = getattr(self, method)
+        except AttributeError:
+            raise DirectException("'%s' is not the name of a method on %s" % (
+                method, clsname
+            ))
+
+        # Pull out any arguments. Sent as an array containing a hash map, so
+        # get the first member.
+        data = request.get('data')
+        if not data:
+            data = {}
+        else:
+            data = data[0]
+
+        # Cast all keys as strings, in case of encoding or other wrinkles
+        data = dict((str(k), v) for k,v in data.iteritems())
+        self._data = data
+
+        # Finally, call the target method, passing in the data
+        result = _targetfn(**data)
+
+        return {
+            'type':'rpc',
+            'tid': request['tid'],
+            'action': action,
+            'method': method,
+            'result': result
+        }
+
+
+class DirectProviderDefinition(object):
+    """
+    Turns a L{DirectRouter} subclass into JavaScript object representing the
+    config of the client-side API.
+
+    Inspects the given subclass and retrieves the names of all public methods,
+    then defines those as actions on the Ext.Direct provider, and creates the
+    JS that adds the provider.
+
+    See http://extjs.com/products/extjs/direct.php for a full explanation of
+    protocols and features of Ext.Direct.
+    """
+    def __init__(self, routercls, url, ns=None, timeout=None):
+        """
+        @param routercls: A L{DirectRouter} subclass
+        @type routercls: class
+        @param url: The url at which C{routercls} is available
+        @type url: str
+        @param ns: The client-side namespace in which the provider should live.
+                   The provider will be available at [ns].[routercls.__name__].
+                   For example, if ns is 'Zenoss.remote' and routercls is named
+                   'EventConsole', client-side code would call
+                   C{Zenoss.remote.EventConsole.my_method(params, callback)}.
+        """
+        self.routercls = routercls
+        self.url = url
+        self.ns = ns
+        self.timeout = timeout
+
+    def _config(self):
+        actions = []
+        for name, value in inspect.getmembers(self.routercls):
+            if name.startswith("_"):
+                continue
+            if inspect.ismethod(value):
+
+                ## Update this when extdirect doesn't freak out when you specify
+                ## actual lens (we're passing them all in as a single dict, so
+                ## from the perspective of Ext.Direct they are all len 1)
+                #args = inspect.getargspec(value)[0]
+                #args.remove('self')
+                #arglen = len(args)
+                arglen = 1
+
+                actions.append({'name':name, 'len':arglen})
+        config = {
+            'id': self.routercls.__name__,
+            'type': 'remoting',
+            'url': self.url,
+            'actions': {
+                self.routercls.__name__: actions
+            }
+        }
+        if self.timeout:
+            config['timeout'] = self.timeout
+        if self.ns:
+            config['namespace'] = self.ns
+        return config
+
+    def render(self):
+        """
+        Generate and return an Ext.Direct provider definition, wrapped in a
+        <script> tag and ready for inclusion in an HTML document.
+        """
+        config = self._config()
+        source = "Ext.Direct.addProvider(%s);" % json.dumps(config)
+        return '<script type="text/javascript"> %s </script>' % source.strip()
+


http://bitbucket.org/yt_analysis/yt/changeset/2595a6f9dded/
changeset:   r3908:2595a6f9dded
branch:      yt
user:        MatthewTurk
date:        2011-03-26 23:43:02
summary:     Initial import of the ExtDirectREPL.
affected #:  2 files (2.5 KB)

--- a/yt/gui/reason/bottle_mods.py	Sat Mar 26 18:16:56 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Sat Mar 26 18:43:02 2011 -0400
@@ -42,10 +42,10 @@
     # and the __init__ function will need to include the keyword argument
     # 'route' for it to work.
     def __init__(self, *args, **kwargs):
-        route = kwargs.pop("route")
+        future_route = kwargs.pop("route")
         super(BottleDirectRouter, self).__init__(*args, **kwargs)
         self.__name__ = ""
-        bottle.route(route, method="POST")(self)
+        route_functions[future_route] = ((), {'method':"POST"}, self)
 
     def __call__(self):
         val = request.body.read()


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/extdirect_repl.py	Sat Mar 26 18:43:02 2011 -0400
@@ -0,0 +1,65 @@
+"""
+A read-eval-print-loop that is served up through Bottle and accepts its
+commands through ExtDirect calls
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: NSF / Columbia
+Homepage: http://yt.enzotools.org/
+License:
+  Copyright (C) 2011 Matthew Turk.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+import json
+import os
+
+from .bottle_mods import preroute, BottleDirectRouter
+from .basic_repl import ProgrammaticREPL
+
+local_dir = os.path.dirname(__file__)
+
+class ExtDirectREPL(ProgrammaticREPL, BottleDirectRouter):
+    _skip_expost = ('index', 'resources')
+
+    def __init__(self, locals=None, route = None):
+        # First we do the standard initialization
+        ProgrammaticREPL.__init__(self, locals)
+        # Now, since we want to only preroute functions we know about, and
+        # since they have different arguments, and most of all because we only
+        # want to add them to the routing tables (which are a singleton for the
+        # entire interpreter state) we apply all the pre-routing now, rather
+        # than through metaclasses or other fancy decorating.
+        preroute_table = dict(index = ("/", "GET"),
+                              resources = ("/resources/:val", "GET"),
+                              )
+        for v, args in preroute_table.items():
+            preroute(args[0], method=args[1])(getattr(self, v))
+        BottleDirectRouter.__init__(self, route=route)
+
+    def index(self):
+        """Return an HTTP-based Read-Eval-Print-Loop terminal."""
+        # For now this doesn't work!  We will need to move to a better method
+        # for this.
+        vals = open(os.path.join(local_dir, "httprepl.html")).read()
+        return vals
+
+    def resources(self, val):
+        pp = os.path.join(local_dir, "resources", val)
+        if not os.path.exists(pp):
+            response.status = 404
+            return
+        return open(pp).read()


http://bitbucket.org/yt_analysis/yt/changeset/29751dc05ef8/
changeset:   r3909:29751dc05ef8
branch:      yt
user:        MatthewTurk
date:        2011-03-26 23:56:36
summary:     Fixing API routing, etc.
affected #:  2 files (283 bytes)

--- a/yt/gui/reason/bottle_mods.py	Sat Mar 26 18:43:02 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Sat Mar 26 18:56:36 2011 -0400
@@ -26,7 +26,7 @@
 
 from .bottle import server_names, debug, route, run, request
 import uuid
-from extdirect_router import DirectRouter
+from extdirect_router import DirectRouter, DirectProviderDefinition
 
 route_functions = {}
 
@@ -47,6 +47,10 @@
         self.__name__ = ""
         route_functions[future_route] = ((), {'method':"POST"}, self)
 
+    def _myapi(self):
+        dpd = DirectProviderDefinition(self, self.api_url)
+        return dpd.render()
+
     def __call__(self):
         val = request.body.read()
         rv = super(BottleDirectRouter, self).__call__(val)
@@ -60,7 +64,8 @@
         args, kwargs, f = pre_routed[r]
         if r[0] == "/": r = r[1:]
         rp = "/%s/%s" % (token, r)
-        print "Routing from %s => %s" % (rp, f.func_name)
+        func_name = getattr(f, 'func_name', str(f))
+        print "Routing from %s => %s" % (rp, func_name)
         route(rp, *args, **kwargs)(f)
     print "Greetings! Your private token is %s ." % token
     print


--- a/yt/gui/reason/extdirect_repl.py	Sat Mar 26 18:43:02 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sat Mar 26 18:56:36 2011 -0400
@@ -35,7 +35,7 @@
 class ExtDirectREPL(ProgrammaticREPL, BottleDirectRouter):
     _skip_expost = ('index', 'resources')
 
-    def __init__(self, locals=None, route = None):
+    def __init__(self, locals=None):
         # First we do the standard initialization
         ProgrammaticREPL.__init__(self, locals)
         # Now, since we want to only preroute functions we know about, and
@@ -44,11 +44,13 @@
         # entire interpreter state) we apply all the pre-routing now, rather
         # than through metaclasses or other fancy decorating.
         preroute_table = dict(index = ("/", "GET"),
+                              _myapi = ("/resources/ext-repl-api.js", "GET"),
                               resources = ("/resources/:val", "GET"),
                               )
         for v, args in preroute_table.items():
             preroute(args[0], method=args[1])(getattr(self, v))
-        BottleDirectRouter.__init__(self, route=route)
+        self.api_url = "/repl"
+        BottleDirectRouter.__init__(self, route="/repl")
 
     def index(self):
         """Return an HTTP-based Read-Eval-Print-Loop terminal."""


http://bitbucket.org/yt_analysis/yt/changeset/a6f70d13a6dc/
changeset:   r3910:a6f70d13a6dc
branch:      yt
user:        MatthewTurk
date:        2011-03-27 07:40:19
summary:     Fixing up the RPC.  Can now be called from within the browser ... Fixed up
Browser to work with ExtDirect.
affected #:  3 files (4.8 KB)

--- a/yt/gui/reason/bottle_mods.py	Sat Mar 26 18:56:36 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Sun Mar 27 01:40:19 2011 -0400
@@ -27,8 +27,10 @@
 from .bottle import server_names, debug, route, run, request
 import uuid
 from extdirect_router import DirectRouter, DirectProviderDefinition
+import json
 
 route_functions = {}
+route_watchers = []
 
 def preroute(future_route, *args, **kwargs):
     def router(func):
@@ -36,24 +38,34 @@
         return func
     return router
 
+def notify_route(watcher):
+    route_watchers.append(watcher)
+
 class BottleDirectRouter(DirectRouter):
     # This class implements a mechanism for auto-routing an ExtDirect-callable
     # object through Bottle.  It should be used as a base class of an object,
     # and the __init__ function will need to include the keyword argument
     # 'route' for it to work.
+    _route_prefix = None
     def __init__(self, *args, **kwargs):
         future_route = kwargs.pop("route")
         super(BottleDirectRouter, self).__init__(*args, **kwargs)
-        self.__name__ = ""
+        self.__name__ = str(self.my_name)
         route_functions[future_route] = ((), {'method':"POST"}, self)
+        notify_route(self)
 
     def _myapi(self):
-        dpd = DirectProviderDefinition(self, self.api_url)
-        return dpd.render()
+        dpd = DirectProviderDefinition(self, self.api_url, ns="yt_rpc")
+        source = "Ext.Direct.addProvider(%s);" % json.dumps(dpd._config())
+        return source
 
     def __call__(self):
+        print "Hi there, I just got this request:",
         val = request.body.read()
+        print val
+        #import pdb;pdb.set_trace()
         rv = super(BottleDirectRouter, self).__call__(val)
+        print "With this response:", rv
         return rv
 
 def uuid_serve_functions(pre_routed = None, open_browser=False):
@@ -67,6 +79,11 @@
         func_name = getattr(f, 'func_name', str(f))
         print "Routing from %s => %s" % (rp, func_name)
         route(rp, *args, **kwargs)(f)
+    for w in route_watchers:
+        if not hasattr(w, "_route_prefix"):
+            print "WARNING: %s has no _route_prefix attribute.  Not notifying."
+            continue
+            w._route_prefix = token
     print "Greetings! Your private token is %s ." % token
     print
     print "Please direct your browser to:"


--- a/yt/gui/reason/extdirect_repl.py	Sat Mar 26 18:56:36 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sun Mar 27 01:40:19 2011 -0400
@@ -27,13 +27,14 @@
 import json
 import os
 
-from .bottle_mods import preroute, BottleDirectRouter
+from .bottle_mods import preroute, BottleDirectRouter, notify_route
 from .basic_repl import ProgrammaticREPL
 
 local_dir = os.path.dirname(__file__)
 
 class ExtDirectREPL(ProgrammaticREPL, BottleDirectRouter):
-    _skip_expost = ('index', 'resources')
+    _skip_expose = ('index', 'resources')
+    my_name = "ExtDirectREPL"
 
     def __init__(self, locals=None):
         # First we do the standard initialization
@@ -49,7 +50,8 @@
                               )
         for v, args in preroute_table.items():
             preroute(args[0], method=args[1])(getattr(self, v))
-        self.api_url = "/repl"
+        notify_route(self)
+        self.api_url = "repl"
         BottleDirectRouter.__init__(self, route="/repl")
 
     def index(self):


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/httprepl.html	Sun Mar 27 01:40:19 2011 -0400
@@ -0,0 +1,136 @@
+<html>
+<head>
+  <title>yt</title>
+	<link rel="stylesheet" type="text/css" href="resources/ext-all.css" />
+
+    <!-- GC -->
+ 	<!-- LIBS -->
+ 	<script type="text/javascript" src="resources/ext-base.js"></script>
+ 	<!-- ENDLIBS -->
+
+    <script type="text/javascript" src="resources/ext-all.js"></script>
+    <script type="text/javascript" src="resources/ext-repl-api.js"></script>
+
+	<style type="text/css">
+	html, body {
+        font:normal 12px verdana;
+        margin:0;
+        padding:0;
+        border:0 none;
+        overflow:hidden;
+        height:100%;
+    }
+	.x-panel-body p {
+	    margin:5px;
+	}
+    .x-column-layout-ct .x-panel {
+        margin-bottom:5px;
+    }
+    .x-column-layout-ct .x-panel-dd-spacer {
+        margin-bottom:5px;
+    }
+    .settings {
+        background-image:url(resources/folder_wrench.png) !important;
+    }
+    .nav {
+        background-image:url(resources/folder_go.png) !important;
+    }
+    </style>
+	<script type="text/javascript">
+    var res;
+
+    var handle_result = function(f, a) {
+        Ext.get("output").dom.innerHTML +=
+        text = a.result.replace(/\n/g,"<br/>");
+        '>>> ' + repl_input.get("input_line").getValue() + '<br/>' + text + '<br/>';
+        repl_input.get("input_line").setValue("");
+        res = a
+        /*eval(a.result.execute);*/
+    }
+
+    var repl_input = new Ext.FormPanel({
+        url: 'push',
+        items: [{
+            id: 'input_line',
+            xtype: 'textfield',
+            fieldLabel: '>>>',
+            name: 'line',
+            allowBlank: 'True',
+            bodyStyle: 'font-family: monospace;',
+            listeners: {
+                specialkey: function(f, e){
+                    if (e.getKey() == e.ENTER) {
+                        yt_rpc.ExtDirectREPL.push({
+                            line:repl_input.get('input_line').getValue()},
+                            handle_result);
+                    }
+                }
+            },
+        },],
+    });
+
+    Ext.onReady(function(){
+
+       // NOTE: This is an example showing simple state management. During development,
+       // it is generally best to disable state management as dynamically-generated ids
+       // can change across page loads, leading to unpredictable results.  The developer
+       // should ensure that stable state ids are set for stateful components in real apps.
+       Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
+
+       var viewport = new Ext.Viewport({
+            layout:'border',
+            items:[{
+                region:'west',
+                id:'west-panel',
+                title:'West',
+                split:true,
+                width: 200,
+                minSize: 175,
+                maxSize: 400,
+                collapsible: true,
+                margins:'35 0 5 5',
+                cmargins:'35 5 5 5',
+                layout:'accordion',
+                layoutConfig:{
+                    animate:true
+                },
+                items: [{
+                    html: Ext.example.shortBogusMarkup,
+                    title:'Navigation',
+                    autoScroll:true,
+                    border:false,
+                    iconCls:'nav'
+                },{
+                    title:'Settings',
+                    html: Ext.example.shortBogusMarkup,
+                    border:false,
+                    autoScroll:true,
+                    iconCls:'settings'
+                }]
+            },{
+                region:'center',
+                margins:'35 5 5 0',
+                layout:'column',
+                autoScroll:true,
+                items:[{
+                    columnWidth:1.0,
+                    baseCls:'x-plain',
+                    bodyStyle:'padding:5px 0 5px 5px; font-family: monospace;',
+                    items:[{
+                       title: 'Output',
+                       html: "",
+                       id: "output",
+                    }, repl_input, ]
+                },]
+            }]
+        });
+    Ext.get("output").dom.innerHTML += 'Welcome to the yt web interface.<br/>';
+    }
+    
+    );
+	</script>
+</head>
+<body>
+<script type="text/javascript" src="resources/examples.js"></script><!-- EXAMPLES -->
+  </body>
+</html>


http://bitbucket.org/yt_analysis/yt/changeset/e00b347b1153/
changeset:   r3911:e00b347b1153
branch:      yt
user:        MatthewTurk
date:        2011-03-27 15:36:48
summary:     Switched to multi-line input.
affected #:  2 files (591 bytes)

--- a/yt/gui/reason/basic_repl.py	Sun Mar 27 01:40:19 2011 -0400
+++ b/yt/gui/reason/basic_repl.py	Sun Mar 27 09:36:48 2011 -0400
@@ -42,6 +42,18 @@
         self.buffer = []
         # Nominally at this point we could populate our namespace with widgets
         # or other useful functions.  We aren't really ready for that just yet.
+
+    def evaluate_cell(self, input):
+        result = []
+        for line in input.split("\n"):
+            r = self.push(line)
+            if r is not None: result.append(r)
+        # To catch if people leave a little bit at the end for us
+        if r is None:
+            r = self.push("\n")
+            if r is not None: result.append(r)
+        # Usually they have \n already
+        return "".join(result)
     
     def push(self, line):
         """Push 'line' and return exec results (None if more input needed)."""


--- a/yt/gui/reason/httprepl.html	Sun Mar 27 01:40:19 2011 -0400
+++ b/yt/gui/reason/httprepl.html	Sun Mar 27 09:36:48 2011 -0400
@@ -40,19 +40,25 @@
     var res;
 
     var handle_result = function(f, a) {
-        Ext.get("output").dom.innerHTML +=
-        text = a.result.replace(/\n/g,"<br/>");
-        '>>> ' + repl_input.get("input_line").getValue() + '<br/>' + text + '<br/>';
-        repl_input.get("input_line").setValue("");
-        res = a
-        /*eval(a.result.execute);*/
+        var input_line = repl_input.get("input_line")
+        if (a.result == null) {
+            Ext.get("output").dom.innertHTML += 
+j       } else {
+            text = a.result.replace(/\n/g,"<br/>");
+            Ext.get("output").dom.innerHTML +=
+            '>>> ' + input_line.getValue() + '<br/>' + text + '<br/>';
+            input_line.setValue("");
+            res = a
+            /*eval(a.result.execute);*/
+        }
     }
 
     var repl_input = new Ext.FormPanel({
         url: 'push',
         items: [{
             id: 'input_line',
-            xtype: 'textfield',
+            xtype: 'textarea',
+            width: '100%',
             fieldLabel: '>>>',
             name: 'line',
             allowBlank: 'True',
@@ -60,8 +66,8 @@
             listeners: {
                 specialkey: function(f, e){
                     if (e.getKey() == e.ENTER) {
-                        yt_rpc.ExtDirectREPL.push({
-                            line:repl_input.get('input_line').getValue()},
+                        yt_rpc.ExtDirectREPL.execute({
+                            code:repl_input.get('input_line').getValue()},
                             handle_result);
                     }
                 }


http://bitbucket.org/yt_analysis/yt/changeset/47fff8297c70/
changeset:   r3912:47fff8297c70
branch:      yt
user:        MatthewTurk
date:        2011-03-27 15:57:05
summary:     Fix the monospace style application
affected #:  1 file (58 bytes)

--- a/yt/gui/reason/httprepl.html	Sun Mar 27 09:36:48 2011 -0400
+++ b/yt/gui/reason/httprepl.html	Sun Mar 27 09:57:05 2011 -0400
@@ -35,6 +35,9 @@
     .nav {
         background-image:url(resources/folder_go.png) !important;
     }
+    #input_line {
+        font-family: monospace;
+    }
     </style><script type="text/javascript">
     var res;
@@ -62,7 +65,7 @@
             fieldLabel: '>>>',
             name: 'line',
             allowBlank: 'True',
-            bodyStyle: 'font-family: monospace;',
+            bodyStyle: 'font-family: "monospace";',
             listeners: {
                 specialkey: function(f, e){
                     if (e.getKey() == e.ENTER) {


http://bitbucket.org/yt_analysis/yt/changeset/36d3867ee22c/
changeset:   r3913:36d3867ee22c
branch:      yt
user:        brittonsmith
date:        2011-03-27 16:34:13
summary:     Added initial front page.
affected #:  1 file (12.3 KB)

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 10:34:13 2011 -0400
@@ -0,0 +1,142 @@
+<html>
+<head>
+  <title>Complex Layout</title>
+    <link rel="stylesheet" type="text/css" href="../ext/ext-3.3.1/resources/css/ext-all.css" />
+    
+    <style type="text/css">
+    html, body {
+        font:normal 12px verdana;
+        margin:0;
+        padding:0;
+        border:0 none;
+        overflow:hidden;
+        height:100%;
+    }
+    p {
+        margin:5px;
+    }
+    .settings {
+        background-image:url(../ext/ext-3.3.1/examples/shared/icons/fam/folder_wrench.png);
+    }
+    .nav {
+        background-image:url(../ext/ext-3.3.1/examples/shared/icons/fam/folder_go.png);
+    }
+    </style>
+
+    <!-- GC -->
+    <!-- LIBS -->
+    <script type="text/javascript" src="../ext/ext-3.3.1/adapter/ext/ext-base.js"></script>
+    <!-- ENDLIBS -->
+
+    <script type="text/javascript" src="../ext/ext-3.3.1/ext-all.js"></script>
+
+    <!-- EXAMPLES -->
+    <script type="text/javascript" src="../ext/ext-3.3.1/examples/shared/examples.js"></script>
+  
+    <script type="text/javascript">
+    Ext.onReady(function(){
+    
+        // NOTE: This is an example showing simple state management. During development,
+        // it is generally best to disable state management as dynamically-generated ids
+        // can change across page loads, leading to unpredictable results.  The developer
+        // should ensure that stable state ids are set for stateful components in real apps.
+        Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
+        
+        var viewport = new Ext.Viewport({
+            layout: 'border',
+            items: [
+            {
+                // lazily created panel (xtype:'panel' is default)
+                region: 'south',
+                contentEl: 'south',
+                split: true,
+                height: 100,
+                minSize: 100,
+                maxSize: 200,
+                collapsible: true,
+                title: 'Status',
+                margins: '0 0 0 0'
+            }, {
+                region: 'west',
+                id: 'west-panel', // see Ext.getCmp() below
+                title: 'BETA Sequences',
+                split: true,
+                width: 200,
+                minSize: 175,
+                maxSize: 400,
+                collapsible: true,
+                margins: '0 0 0 5',
+                layout: {
+                    type: 'accordion',
+                    animate: true
+                },
+                items: [{
+                    contentEl: 'west',
+                    title: 'Objects',
+                    border: false,
+                    iconCls: 'nav' // see the HEAD section for style used
+                }]
+            },
+            // in this instance the TabPanel is not wrapped by another panel
+            // since no title is needed, this Panel is added directly
+            // as a Container
+            new Ext.TabPanel({
+                region: 'center', // a center region is ALWAYS required for border layout
+                deferredRender: false,
+                activeTab: 0,     // first tab initially active
+                items: [{
+                    contentEl: 'center1',
+                    title: 'YT',
+                    closable: false,
+                    autoScroll: true
+                }, {
+                    contentEl: 'center2',
+                    title: 'Widget 1',
+                    closable: true,
+                    autoScroll: true
+                }]
+            })]
+        });
+        // get a reference to the HTML element with id "hideit" and add a click listener to it 
+        Ext.get("hideit").on('click', function(){
+            // get a reference to the Panel that was created with id = 'west-panel' 
+            var w = Ext.getCmp('west-panel');
+            // expand or collapse that Panel based on its collapsed property state
+            w.collapsed ? w.expand() : w.collapse();
+        });
+    });
+    </script>
+</head>
+<body>
+    <!-- use class="x-hide-display" to prevent a brief flicker of the content -->
+    <div id="west" class="x-hide-display">
+        <p>Hi. I'm the west panel.</p>
+    </div>
+    <div id="center2" class="x-hide-display">
+        <a id="hideit" href="#">Toggle the west region</a>
+        <p>My closable attribute is set to false so you can't close me. The other center panels can be closed.</p>
+        <p>The center panel automatically grows to fit the remaining space in the container that isn't taken up by the border regions.</p>
+        <hr>
+        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna. Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit. Quisque dolor magna, ornare sed, elementum porta, luctus in, leo.</p>
+        <p>Donec quis dui. Sed imperdiet. Nunc consequat, est eu sollicitudin gravida, mauris ligula lacinia mauris, eu porta dui nisl in velit. Nam congue, odio id auctor nonummy, augue lectus euismod nunc, in tristique turpis dolor sed urna. Donec sit amet quam eget diam fermentum pharetra. Integer tincidunt arcu ut purus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla blandit malesuada odio. Nam augue. Aenean molestie sapien in mi. Suspendisse tincidunt. Pellentesque tempus dui vitae sapien. Donec aliquam ipsum sit amet pede. Sed scelerisque mi a erat. Curabitur rutrum ullamcorper risus. Maecenas et lorem ut felis dictum viverra. Fusce sem. Donec pharetra nibh sit amet sapien.</p>
+        <p>Aenean ut orci sed ligula consectetuer pretium. Aliquam odio. Nam pellentesque enim. Nam tincidunt condimentum nisi. Maecenas convallis luctus ligula. Donec accumsan ornare risus. Vestibulum id magna a nunc posuere laoreet. Integer iaculis leo vitae nibh. Nam vulputate, mauris vitae luctus pharetra, pede neque bibendum tellus, facilisis commodo diam nisi eget lacus. Duis consectetuer pulvinar nisi. Cras interdum ultricies sem. Nullam tristique. Suspendisse elementum purus eu nisl. Nulla facilisi. Phasellus ultricies ullamcorper lorem. Sed euismod ante vitae lacus. Nam nunc leo, congue vehicula, luctus ac, tempus non, ante. Morbi suscipit purus a nulla. Sed eu diam.</p>
+        <p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras imperdiet felis id velit. Ut non quam at sem dictum ullamcorper. Vestibulum pharetra purus sed pede. Aliquam ultrices, nunc in varius mattis, felis justo pretium magna, eget laoreet justo eros id eros. Aliquam elementum diam fringilla nulla. Praesent laoreet sapien vel metus. Cras tempus, sapien condimentum dictum dapibus, lorem augue fringilla orci, ut tincidunt eros nisi eget turpis. Nullam nunc nunc, eleifend et, dictum et, pharetra a, neque. Ut feugiat. Aliquam erat volutpat. Donec pretium odio nec felis. Phasellus sagittis lacus eget sapien. Donec est. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p>
+        <p>Vestibulum semper. Nullam non odio. Aliquam quam. Mauris eu lectus non nunc auctor ullamcorper. Sed tincidunt molestie enim. Phasellus lobortis justo sit amet quam. Duis nulla erat, varius a, cursus in, tempor sollicitudin, mauris. Aliquam mi velit, consectetuer mattis, consequat tristique, pulvinar ac, nisl. Aliquam mattis vehicula elit. Proin quis leo sed tellus scelerisque molestie. Quisque luctus. Integer mattis. Donec id augue sed leo aliquam egestas. Quisque in sem. Donec dictum enim in dolor. Praesent non erat. Nulla ultrices vestibulum quam.</p>
+        <p>Duis hendrerit, est vel lobortis sagittis, tortor erat scelerisque tortor, sed pellentesque sem enim id metus. Maecenas at pede. Nulla velit libero, dictum at, mattis quis, sagittis vel, ante. Phasellus faucibus rutrum dui. Cras mauris elit, bibendum at, feugiat non, porta id, neque. Nulla et felis nec odio mollis vehicula. Donec elementum tincidunt mauris. Duis vel dui. Fusce iaculis enim ac nulla. In risus.</p>
+        <p>Donec gravida. Donec et enim. Morbi sollicitudin, lacus a facilisis pulvinar, odio turpis dapibus elit, in tincidunt turpis felis nec libero. Nam vestibulum tempus ipsum. In hac habitasse platea dictumst. Nulla facilisi. Donec semper ligula. Donec commodo tortor in quam. Etiam massa. Ut tempus ligula eget tellus. Curabitur id velit ut velit varius commodo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla facilisi. Fusce ornare pellentesque libero. Nunc rhoncus. Suspendisse potenti. Ut consequat, leo eu accumsan vehicula, justo sem lobortis elit, ac sollicitudin ipsum neque nec ante.</p>
+        <p>Aliquam elementum mauris id sem. Vivamus varius, est ut nonummy consectetuer, nulla quam bibendum velit, ac gravida nisi felis sit amet urna. Aliquam nec risus. Maecenas lacinia purus ut velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse sit amet dui vitae lacus fermentum sodales. Donec varius dapibus nisl. Praesent at velit id risus convallis bibendum. Aliquam felis nibh, rutrum nec, blandit non, mattis sit amet, magna. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam varius dignissim nibh. Quisque id orci ac ante hendrerit molestie. Aliquam malesuada enim non neque.</p>
+    </div>
+    <div id="center1" class="x-hide-display">
+        <p><b>Done reading me? Close me by clicking the X in the top right corner.</b></p>
+        <p>Vestibulum semper. Nullam non odio. Aliquam quam. Mauris eu lectus non nunc auctor ullamcorper. Sed tincidunt molestie enim. Phasellus lobortis justo sit amet quam. Duis nulla erat, varius a, cursus in, tempor sollicitudin, mauris. Aliquam mi velit, consectetuer mattis, consequat tristique, pulvinar ac, nisl. Aliquam mattis vehicula elit. Proin quis leo sed tellus scelerisque molestie. Quisque luctus. Integer mattis. Donec id augue sed leo aliquam egestas. Quisque in sem. Donec dictum enim in dolor. Praesent non erat. Nulla ultrices vestibulum quam.</p>
+        <p>Duis hendrerit, est vel lobortis sagittis, tortor erat scelerisque tortor, sed pellentesque sem enim id metus. Maecenas at pede. Nulla velit libero, dictum at, mattis quis, sagittis vel, ante. Phasellus faucibus rutrum dui. Cras mauris elit, bibendum at, feugiat non, porta id, neque. Nulla et felis nec odio mollis vehicula. Donec elementum tincidunt mauris. Duis vel dui. Fusce iaculis enim ac nulla. In risus.</p>
+        <p>Donec gravida. Donec et enim. Morbi sollicitudin, lacus a facilisis pulvinar, odio turpis dapibus elit, in tincidunt turpis felis nec libero. Nam vestibulum tempus ipsum. In hac habitasse platea dictumst. Nulla facilisi. Donec semper ligula. Donec commodo tortor in quam. Etiam massa. Ut tempus ligula eget tellus. Curabitur id velit ut velit varius commodo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla facilisi. Fusce ornare pellentesque libero. Nunc rhoncus. Suspendisse potenti. Ut consequat, leo eu accumsan vehicula, justo sem lobortis elit, ac sollicitudin ipsum neque nec ante.</p>
+        <p>Aliquam elementum mauris id sem. Vivamus varius, est ut nonummy consectetuer, nulla quam bibendum velit, ac gravida nisi felis sit amet urna. Aliquam nec risus. Maecenas lacinia purus ut velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse sit amet dui vitae lacus fermentum sodales. Donec varius dapibus nisl. Praesent at velit id risus convallis bibendum. Aliquam felis nibh, rutrum nec, blandit non, mattis sit amet, magna. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam varius dignissim nibh. Quisque id orci ac ante hendrerit molestie. Aliquam malesuada enim non neque.</p>
+    </div>
+    <div id="props-panel" class="x-hide-display" style="width:200px;height:200px;overflow:hidden;">
+    </div>
+    <div id="south" class="x-hide-display">
+        <p>4d3d3d3 engaged.</p>
+    </div>
+</body>
+</html>
\ No newline at end of file


http://bitbucket.org/yt_analysis/yt/changeset/237f168e7e76/
changeset:   r3914:237f168e7e76
branch:      yt
user:        MatthewTurk
date:        2011-03-27 16:36:58
summary:     Changing scope of 'viewport' and adding an id for the center panel
affected #:  1 file (55 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 10:34:13 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 10:36:58 2011 -0400
@@ -34,6 +34,7 @@
     <script type="text/javascript" src="../ext/ext-3.3.1/examples/shared/examples.js"></script><script type="text/javascript">
+    var viewport;
     Ext.onReady(function(){
     
         // NOTE: This is an example showing simple state management. During development,
@@ -82,6 +83,7 @@
             // as a Container
             new Ext.TabPanel({
                 region: 'center', // a center region is ALWAYS required for border layout
+                id: 'center-panel',
                 deferredRender: false,
                 activeTab: 0,     // first tab initially active
                 items: [{
@@ -139,4 +141,4 @@
         <p>4d3d3d3 engaged.</p></div></body>
-</html>
\ No newline at end of file
+</html>


http://bitbucket.org/yt_analysis/yt/changeset/d598a5818e30/
changeset:   r3915:d598a5818e30
branch:      yt
user:        brittonsmith
date:        2011-03-27 16:38:28
summary:     Fixed paths in index.
affected #:  1 file (102 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 10:36:58 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 10:38:28 2011 -0400
@@ -1,7 +1,7 @@
 <html><head><title>Complex Layout</title>
-    <link rel="stylesheet" type="text/css" href="../ext/ext-3.3.1/resources/css/ext-all.css" />
+    <link rel="stylesheet" type="text/css" href="../../../../../misc/ext/ext-3.3.1/resources/css/ext-all.css" /><style type="text/css">
     html, body {
@@ -16,22 +16,22 @@
         margin:5px;
     }
     .settings {
-        background-image:url(../ext/ext-3.3.1/examples/shared/icons/fam/folder_wrench.png);
+        background-image:url(../../../../../misc/ext/ext-3.3.1/examples/shared/icons/fam/folder_wrench.png);
     }
     .nav {
-        background-image:url(../ext/ext-3.3.1/examples/shared/icons/fam/folder_go.png);
+        background-image:url(../../../../../misc/ext/ext-3.3.1/examples/shared/icons/fam/folder_go.png);
     }
     </style><!-- GC --><!-- LIBS -->
-    <script type="text/javascript" src="../ext/ext-3.3.1/adapter/ext/ext-base.js"></script>
+    <script type="text/javascript" src="../../../../../misc/ext/ext-3.3.1/adapter/ext/ext-base.js"></script><!-- ENDLIBS -->
 
-    <script type="text/javascript" src="../ext/ext-3.3.1/ext-all.js"></script>
+    <script type="text/javascript" src="../../../../../misc/ext/ext-3.3.1/ext-all.js"></script><!-- EXAMPLES -->
-    <script type="text/javascript" src="../ext/ext-3.3.1/examples/shared/examples.js"></script>
+    <script type="text/javascript" src="../../../../../misc/ext/ext-3.3.1/examples/shared/examples.js"></script><script type="text/javascript">
     var viewport;


http://bitbucket.org/yt_analysis/yt/changeset/f523966c6d96/
changeset:   r3916:f523966c6d96
branch:      yt
user:        MatthewTurk
date:        2011-03-27 16:39:40
summary:     Minor typo on my part
affected #:  2 files (144 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 10:38:28 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 10:39:40 2011 -0400
@@ -43,7 +43,7 @@
         // should ensure that stable state ids are set for stateful components in real apps.
         Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
         
-        var viewport = new Ext.Viewport({
+        viewport = new Ext.Viewport({
             layout: 'border',
             items: [
             {


--- a/yt/gui/reason/httprepl.html	Sun Mar 27 10:38:28 2011 -0400
+++ b/yt/gui/reason/httprepl.html	Sun Mar 27 10:39:40 2011 -0400
@@ -40,20 +40,25 @@
     }
     </style><script type="text/javascript">
-    var res;
+    function cell_sent() {
+        repl_input.get('input_line').setReadOnly(true);
+    }
+
+    function cell_finished() {
+        repl_input.get('input_line').setReadOnly(false);
+    }
 
     var handle_result = function(f, a) {
         var input_line = repl_input.get("input_line")
         if (a.result == null) {
-            Ext.get("output").dom.innertHTML += 
-j       } else {
+            text = "ERROR";
+        } else {
             text = a.result.replace(/\n/g,"<br/>");
-            Ext.get("output").dom.innerHTML +=
-            '>>> ' + input_line.getValue() + '<br/>' + text + '<br/>';
-            input_line.setValue("");
-            res = a
-            /*eval(a.result.execute);*/
         }
+        Ext.get("output").dom.innerHTML +=
+        '>>> ' + input_line.getValue() + '<br/>' + text + '<br/>';
+        input_line.setValue("");
+        cell_finished();
     }
 
     var repl_input = new Ext.FormPanel({
@@ -69,6 +74,7 @@
             listeners: {
                 specialkey: function(f, e){
                     if (e.getKey() == e.ENTER) {
+                        cell_sent();
                         yt_rpc.ExtDirectREPL.execute({
                             code:repl_input.get('input_line').getValue()},
                             handle_result);


http://bitbucket.org/yt_analysis/yt/changeset/d11edefd3792/
changeset:   r3917:d11edefd3792
branch:      yt
user:        jsoishi
date:        2011-03-26 17:30:09
summary:     reorganized PlotWindow to make it a literal window onto a 2D data buffer. Created the PlotWindowViewer, which adds plots (currently using matplotlib via the YtPlot object). some minor reorganization and documentation
affected #:  1 file (950 bytes)

--- a/yt/visualization/plot_window.py	Wed Mar 23 19:53:53 2011 -0400
+++ b/yt/visualization/plot_window.py	Sat Mar 26 09:30:09 2011 -0700
@@ -60,6 +60,23 @@
         invalidated as the object is modified.
         
         Data is handled by a FixedResolutionBuffer object.
+
+        Parameters
+        ----------
+        data_source : :class:`yt.data_objects.data_containers.AMRProjBase` or :class:`yt.data_objects.data_containers.AMRSliceBase`
+            This is the source to be pixelized, which can be a projection or a
+            slice.  (For cutting planes, see
+            `yt.visualization.fixed_resolution.ObliqueFixedResolutionBuffer`.)
+        bounds : sequence of floats
+            Bounds are the min and max in the image plane that we want our
+            image to cover.  It's in the order of (xmin, xmax, ymin, ymax),
+            where the coordinates are all in the appropriate code units.
+        buff_size : sequence of ints
+            The size of the image to generate.
+        antialias : boolean
+            This can be true or false.  It determines whether or not sub-pixel
+            rendering is used during data deposition.
+
         """
         self.plots = {}
         self.data_source = data_source
@@ -80,25 +97,14 @@
             raise RuntimeError("Failed to repixelize.")
         self._frb._get_data_source_fields()
         self._data_valid = True
-
-    def _setup_plots(self):
-        for f in self.fields:
-            self.plots[f] = YtWindowPlot(self._frb[f])
-        self._plot_valid = True
+        
+    def _setup_plot(self):
+        pass
 
     @property
     def fields(self):
         return self._frb.data.keys()
 
-    def save(self,name):
-        for k,v in self.plots.iteritems():
-            n = "%s_%s" % (name, k)
-            v.save(n)
-
-    @invalidate_data
-    def pan(self):
-        pass
-
     @property
     def width(self):
         Wx = self.xlim[1] - self.xlim[0]
@@ -131,10 +137,6 @@
         self.xlim = (self.xlim[0] + deltas[0], self.xlim[1] + deltas[0])
         self.ylim = (self.ylim[0] + deltas[1], self.ylim[1] + deltas[1])
 
-    @invalidate_plot
-    def set_cmap(self):
-        pass
-
     @invalidate_data
     def set_field(self):
         pass
@@ -147,20 +149,41 @@
     @invalidate_data
     def set_width(self):
         pass
+
     @property
     def width(self):
         Wx = self.xlim[1] - self.xlim[0]
         Wy = self.ylim[1] - self.ylim[0]
         return (Wx, Wy)
 
-    # @invalidate_plot
-    # def set_zlim(self):
-    #     pass
-
     @invalidate_data
     def set_antialias(self,aa):
         self.antialias = aa
 
+
+class PlotWindowViewer(PlotWindow):
+    """A viewer for PlotWindows.
+
+
+    """
+    def _setup_plots(self):
+        for f in self.fields:
+            self.plots[f] = YtWindowPlot(self._frb[f])
+        self._plot_valid = True
+
+    def save(self,name):
+        for k,v in self.plots.iteritems():
+            n = "%s_%s" % (name, k)
+            v.save(n)
+    @invalidate_plot
+    def set_cmap(self):
+        pass
+    @invalidate_plot
+    def set_zlim(self):
+        pass
+
+
+
 class YtPlot(object):
     """A base class for all yt plots. It should abstract the actual
     plotting engine completely, allowing plotting even without matplotlib. 


http://bitbucket.org/yt_analysis/yt/changeset/1c797b6d4e7b/
changeset:   r3918:1c797b6d4e7b
branch:      yt
user:        jsoishi
date:        2011-03-27 16:54:35
summary:     refactored a few functions; added optional transform function to image buffers (log, sqrt, etc.)...
affected #:  2 files (2.3 KB)

--- a/yt/visualization/image_writer.py	Sat Mar 26 09:30:09 2011 -0700
+++ b/yt/visualization/image_writer.py	Sun Mar 27 07:54:35 2011 -0700
@@ -137,7 +137,7 @@
     au.write_png(bitmap_array.copy(), filename)
     return bitmap_array
 
-def write_image(image, filename, color_bounds = None, cmap_name = "algae"):
+def write_image(image, filename, color_bounds = None, cmap_name = "algae", func = lambda x: x):
     r"""Write out a floating point array directly to a PNG file, scaling it and
     applying a colormap.
 
@@ -157,7 +157,9 @@
     cmap_name : string, optional
         An acceptable colormap.  See either yt.visualization.color_maps or
         http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps .
-        
+    func : function, optional
+        A function to transform the buffer before applying a colormap. 
+
     Returns
     -------
     scaled_image : uint8 image that has been saved
@@ -173,6 +175,36 @@
     if len(image.shape) == 3:
         mylog.info("Using only channel 1 of supplied image")
         image = image[:,:,0]
+    to_plot = apply_colormap(image, color_bounds = color_bounds, cmap_name = cmap_name)
+    au.write_png(to_plot, filename)
+    return to_plot
+
+def apply_colormap(image, color_bounds = None, cmap_name = 'algae', func=lambda x: x):
+    r"""Apply a colormap to a floating point image, scaling to uint8.
+
+    This function will scale an image and directly call libpng to write out a
+    colormapped version of that image.  It is designed for rapid-fire saving of
+    image buffers generated using `yt.visualization.api.FixedResolutionBuffers` and the like.
+
+    Parameters
+    ----------
+    image : array_like
+        This is an (unscaled) array of floating point values, shape (N,N,) to
+        save in a PNG file.
+    color_bounds : tuple of floats, optional
+        The min and max to scale between.  Outlying values will be clipped.
+    cmap_name : string, optional
+        An acceptable colormap.  See either yt.visualization.color_maps or
+        http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps .
+    func : function, optional
+        A function to transform the buffer before applying a colormap. 
+
+    Returns
+    -------
+    to_plot : uint8 image with colorbar applied.
+
+    """
+    image = func(image)
     if color_bounds is None:
         mi = na.nanmin(image[~na.isinf(image)])
         ma = na.nanmax(image[~na.isinf(image)])
@@ -180,7 +212,6 @@
     image = (image - color_bounds[0])/(color_bounds[1] - color_bounds[0])
     to_plot = map_to_colors(image, cmap_name)
     to_plot = na.clip(to_plot, 0, 255)
-    au.write_png(to_plot, filename)
     return to_plot
 
 def annotate_image(image, text, xpos, ypos, font_name = "Vera",


--- a/yt/visualization/plot_window.py	Sat Mar 26 09:30:09 2011 -0700
+++ b/yt/visualization/plot_window.py	Sun Mar 27 07:54:35 2011 -0700
@@ -23,9 +23,11 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
+import tempfile
 import color_maps
 from image_writer import \
-    write_image
+    write_image, apply_colormap
+from yt.utilities.amr_utils import write_png_to_file
 from fixed_resolution import \
     FixedResolutionBuffer
 import matplotlib.pyplot
@@ -36,7 +38,7 @@
         args[0]._data_valid = False
         args[0]._plot_valid = False
         args[0]._recreate_frb()
-        args[0]._setup_plots()
+        return args[0]._setup_plots()
 
     return newfunc
 
@@ -98,7 +100,7 @@
         self._frb._get_data_source_fields()
         self._data_valid = True
         
-    def _setup_plot(self):
+    def _setup_plots(self):
         pass
 
     @property
@@ -160,11 +162,46 @@
     def set_antialias(self,aa):
         self.antialias = aa
 
+class PWViewerRaw(PlotWindow):
+    """A PlotWindow viewer that writes raw pngs (no MPL, no axes).
 
-class PlotWindowViewer(PlotWindow):
+    """
+    def _setup_plots(self):
+        self.save('')
+        self._plot_valid = True
+
+    def save(self,name):
+        for field in self._frb.data.keys():
+            nm = "%s_%s.png" % (name,field)
+            print "writing %s" % nm
+            write_image(self._frb[field],nm)
+
+class PWViewerExtJS(PlotWindow):
+    """A viewer for the web interface.
+
+    """
+    def _setup_plots(self):
+        plots = []
+        for field in self._frb.data.keys():
+            tf = tempfile.TemporaryFile()
+            to_plot = apply_colormap(self._frb[field])
+            write_png_to_file(to_plot, tf)
+            tf.seek(0)
+            s = tf.read()
+            tf.close()
+            ret = {}
+            ret['plot'] = s
+            ret['metadata'] = self.get_metadata()
+            plots.append(ret)
+
+        return plots
+
+    def get_metadata(self):
+        pass
+
+class PWWiewer(PlotWindow):
     """A viewer for PlotWindows.
 
-
     """
     def _setup_plots(self):
         for f in self.fields:


http://bitbucket.org/yt_analysis/yt/changeset/244fd41644a8/
changeset:   r3919:244fd41644a8
branch:      yt
user:        jsoishi
date:        2011-03-27 16:54:51
summary:     merged.
affected #:  0 files (0 bytes)

--- a/yt/gui/reason/basic_repl.py	Sun Mar 27 07:54:35 2011 -0700
+++ b/yt/gui/reason/basic_repl.py	Sun Mar 27 07:54:51 2011 -0700
@@ -42,6 +42,18 @@
         self.buffer = []
         # Nominally at this point we could populate our namespace with widgets
         # or other useful functions.  We aren't really ready for that just yet.
+
+    def evaluate_cell(self, input):
+        result = []
+        for line in input.split("\n"):
+            r = self.push(line)
+            if r is not None: result.append(r)
+        # To catch if people leave a little bit at the end for us
+        if r is None:
+            r = self.push("\n")
+            if r is not None: result.append(r)
+        # Usually they have \n already
+        return "".join(result)
     
     def push(self, line):
         """Push 'line' and return exec results (None if more input needed)."""


--- a/yt/gui/reason/bottle_mods.py	Sun Mar 27 07:54:35 2011 -0700
+++ b/yt/gui/reason/bottle_mods.py	Sun Mar 27 07:54:51 2011 -0700
@@ -24,10 +24,13 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
-from .bottle import server_names, debug, route
+from .bottle import server_names, debug, route, run, request
 import uuid
+from extdirect_router import DirectRouter, DirectProviderDefinition
+import json
 
 route_functions = {}
+route_watchers = []
 
 def preroute(future_route, *args, **kwargs):
     def router(func):
@@ -35,15 +38,52 @@
         return func
     return router
 
-def uuid_serve_functions(pre_routed, open_browser=False):
+def notify_route(watcher):
+    route_watchers.append(watcher)
+
+class BottleDirectRouter(DirectRouter):
+    # This class implements a mechanism for auto-routing an ExtDirect-callable
+    # object through Bottle.  It should be used as a base class of an object,
+    # and the __init__ function will need to include the keyword argument
+    # 'route' for it to work.
+    _route_prefix = None
+    def __init__(self, *args, **kwargs):
+        future_route = kwargs.pop("route")
+        super(BottleDirectRouter, self).__init__(*args, **kwargs)
+        self.__name__ = str(self.my_name)
+        route_functions[future_route] = ((), {'method':"POST"}, self)
+        notify_route(self)
+
+    def _myapi(self):
+        dpd = DirectProviderDefinition(self, self.api_url, ns="yt_rpc")
+        source = "Ext.Direct.addProvider(%s);" % json.dumps(dpd._config())
+        return source
+
+    def __call__(self):
+        print "Hi there, I just got this request:",
+        val = request.body.read()
+        print val
+        #import pdb;pdb.set_trace()
+        rv = super(BottleDirectRouter, self).__call__(val)
+        print "With this response:", rv
+        return rv
+
+def uuid_serve_functions(pre_routed = None, open_browser=False):
+    if pre_routed == None: pre_routed = route_functions
     debug(mode=True)
     token = uuid.uuid1()
     for r in pre_routed:
         args, kwargs, f = pre_routed[r]
         if r[0] == "/": r = r[1:]
         rp = "/%s/%s" % (token, r)
-        print "Routing from %s => %s" % (rp, f.func_name)
+        func_name = getattr(f, 'func_name', str(f))
+        print "Routing from %s => %s" % (rp, func_name)
         route(rp, *args, **kwargs)(f)
+    for w in route_watchers:
+        if not hasattr(w, "_route_prefix"):
+            print "WARNING: %s has no _route_prefix attribute.  Not notifying."
+            continue
+            w._route_prefix = token
     print "Greetings! Your private token is %s ." % token
     print
     print "Please direct your browser to:"
@@ -60,7 +100,7 @@
             import webbrowser, threading
             def _local_browse():
                 webbrowser.open('http://localhost:%s/%s/' % (8080, token))
-            thread = threading.Timer(0.5, _open_browser)
+            thread = threading.Timer(0.5, _local_browse)
             thread.start()
         local_browse()
     # Right now we only really support the built-in wsgiref, but this may


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/extdirect_repl.py	Sun Mar 27 07:54:51 2011 -0700
@@ -0,0 +1,69 @@
+"""
+A read-eval-print-loop that is served up through Bottle and accepts its
+commands through ExtDirect calls
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: NSF / Columbia
+Homepage: http://yt.enzotools.org/
+License:
+  Copyright (C) 2011 Matthew Turk.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+import json
+import os
+
+from .bottle_mods import preroute, BottleDirectRouter, notify_route
+from .basic_repl import ProgrammaticREPL
+
+local_dir = os.path.dirname(__file__)
+
+class ExtDirectREPL(ProgrammaticREPL, BottleDirectRouter):
+    _skip_expose = ('index', 'resources')
+    my_name = "ExtDirectREPL"
+
+    def __init__(self, locals=None):
+        # First we do the standard initialization
+        ProgrammaticREPL.__init__(self, locals)
+        # Now, since we want to only preroute functions we know about, and
+        # since they have different arguments, and most of all because we only
+        # want to add them to the routing tables (which are a singleton for the
+        # entire interpreter state) we apply all the pre-routing now, rather
+        # than through metaclasses or other fancy decorating.
+        preroute_table = dict(index = ("/", "GET"),
+                              _myapi = ("/resources/ext-repl-api.js", "GET"),
+                              resources = ("/resources/:val", "GET"),
+                              )
+        for v, args in preroute_table.items():
+            preroute(args[0], method=args[1])(getattr(self, v))
+        notify_route(self)
+        self.api_url = "repl"
+        BottleDirectRouter.__init__(self, route="/repl")
+
+    def index(self):
+        """Return an HTTP-based Read-Eval-Print-Loop terminal."""
+        # For now this doesn't work!  We will need to move to a better method
+        # for this.
+        vals = open(os.path.join(local_dir, "httprepl.html")).read()
+        return vals
+
+    def resources(self, val):
+        pp = os.path.join(local_dir, "resources", val)
+        if not os.path.exists(pp):
+            response.status = 404
+            return
+        return open(pp).read()


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/extdirect_router.py	Sun Mar 27 07:54:51 2011 -0700
@@ -0,0 +1,179 @@
+"""
+This is code from the extdirect package:
+
+http://pypi.python.org/pypi/extdirect/0.3
+https://github.com/iancmcc/extdirect
+
+written by Ian McCracken
+
+This code was released under the BSD License.
+"""
+
+import inspect
+
+class DirectException(Exception):
+    pass
+
+
+try:
+    import json
+except ImportError:
+    try:
+        import simplejson as json
+    except ImportError:
+        raise DirectException("No JSON library available. Please install"
+                              " simplejson or upgrade to Python 2.6.")
+
+
+class DirectRouter(object):
+    """
+    Basic Ext.Direct router class.
+
+    Ext.Direct allows one to create an API that communicates with a single URL,
+    which then routes requests to the appropriate method. The client-side API
+    object matches the server-side API object.
+
+    This base class parses an Ext.Direct request, which contains the name of
+    the method and any data that should be passed, and routes the data to the
+    approriate method. It then receives the output of that call and puts it
+    into the data structure expected by Ext.Direct.
+
+    Call an instance of this class with the JSON from an Ext.Direct request.
+    """
+    def __call__(self, body):
+        """
+        """
+        # Decode the request data
+        body = json.loads(body)
+        self._body = body
+
+        if isinstance(body, list):
+            directRequests = body
+        elif isinstance(body, dict):
+            directRequests = [body]
+        else:
+            raise DirectException("Body is not a support type: %s" % body)
+
+        responses = []
+
+        for req in directRequests:
+            responses.append(self._doRequest(req))
+
+        if len(responses) == 1:
+            responses = responses[0]
+
+        return json.dumps(responses)
+
+    def _doRequest(self, request):
+
+        # Double-check that this request is meant for this class
+        action = request.get('action')
+        clsname = self.__class__.__name__
+        if action != clsname:
+            raise DirectException(("Action specified in request ('%s') is"
+                                  " not named %s.") % (action, clsname))
+
+        # Pull out the method name and make sure it exists on this class
+        method = request.get('method')
+        if not method:
+            raise DirectException("No method specified. Is this a valid"
+                                  " Ext.Direct request?")
+        try:
+            _targetfn = getattr(self, method)
+        except AttributeError:
+            raise DirectException("'%s' is not the name of a method on %s" % (
+                method, clsname
+            ))
+
+        # Pull out any arguments. Sent as an array containing a hash map, so
+        # get the first member.
+        data = request.get('data')
+        if not data:
+            data = {}
+        else:
+            data = data[0]
+
+        # Cast all keys as strings, in case of encoding or other wrinkles
+        data = dict((str(k), v) for k,v in data.iteritems())
+        self._data = data
+
+        # Finally, call the target method, passing in the data
+        result = _targetfn(**data)
+
+        return {
+            'type':'rpc',
+            'tid': request['tid'],
+            'action': action,
+            'method': method,
+            'result': result
+        }
+
+
+class DirectProviderDefinition(object):
+    """
+    Turns a L{DirectRouter} subclass into JavaScript object representing the
+    config of the client-side API.
+
+    Inspects the given subclass and retrieves the names of all public methods,
+    then defines those as actions on the Ext.Direct provider, and creates the
+    JS that adds the provider.
+
+    See http://extjs.com/products/extjs/direct.php for a full explanation of
+    protocols and features of Ext.Direct.
+    """
+    def __init__(self, routercls, url, ns=None, timeout=None):
+        """
+        @param routercls: A L{DirectRouter} subclass
+        @type routercls: class
+        @param url: The url at which C{routercls} is available
+        @type url: str
+        @param ns: The client-side namespace in which the provider should live.
+                   The provider will be available at [ns].[routercls.__name__].
+                   For example, if ns is 'Zenoss.remote' and routercls is named
+                   'EventConsole', client-side code would call
+                   C{Zenoss.remote.EventConsole.my_method(params, callback)}.
+        """
+        self.routercls = routercls
+        self.url = url
+        self.ns = ns
+        self.timeout = timeout
+
+    def _config(self):
+        actions = []
+        for name, value in inspect.getmembers(self.routercls):
+            if name.startswith("_"):
+                continue
+            if inspect.ismethod(value):
+
+                ## Update this when extdirect doesn't freak out when you specify
+                ## actual lens (we're passing them all in as a single dict, so
+                ## from the perspective of Ext.Direct they are all len 1)
+                #args = inspect.getargspec(value)[0]
+                #args.remove('self')
+                #arglen = len(args)
+                arglen = 1
+
+                actions.append({'name':name, 'len':arglen})
+        config = {
+            'id': self.routercls.__name__,
+            'type': 'remoting',
+            'url': self.url,
+            'actions': {
+                self.routercls.__name__: actions
+            }
+        }
+        if self.timeout:
+            config['timeout'] = self.timeout
+        if self.ns:
+            config['namespace'] = self.ns
+        return config
+
+    def render(self):
+        """
+        Generate and return an Ext.Direct provider definition, wrapped in a
+        <script> tag and ready for inclusion in an HTML document.
+        """
+        config = self._config()
+        source = "Ext.Direct.addProvider(%s);" % json.dumps(config)
+        return '<script type="text/javascript"> %s </script>' % source.strip()
+


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 07:54:51 2011 -0700
@@ -0,0 +1,144 @@
+<html>
+<head>
+  <title>Complex Layout</title>
+    <link rel="stylesheet" type="text/css" href="../../../../../misc/ext/ext-3.3.1/resources/css/ext-all.css" />
+    
+    <style type="text/css">
+    html, body {
+        font:normal 12px verdana;
+        margin:0;
+        padding:0;
+        border:0 none;
+        overflow:hidden;
+        height:100%;
+    }
+    p {
+        margin:5px;
+    }
+    .settings {
+        background-image:url(../../../../../misc/ext/ext-3.3.1/examples/shared/icons/fam/folder_wrench.png);
+    }
+    .nav {
+        background-image:url(../../../../../misc/ext/ext-3.3.1/examples/shared/icons/fam/folder_go.png);
+    }
+    </style>
+
+    <!-- GC -->
+    <!-- LIBS -->
+    <script type="text/javascript" src="../../../../../misc/ext/ext-3.3.1/adapter/ext/ext-base.js"></script>
+    <!-- ENDLIBS -->
+
+    <script type="text/javascript" src="../../../../../misc/ext/ext-3.3.1/ext-all.js"></script>
+
+    <!-- EXAMPLES -->
+    <script type="text/javascript" src="../../../../../misc/ext/ext-3.3.1/examples/shared/examples.js"></script>
+  
+    <script type="text/javascript">
+    var viewport;
+    Ext.onReady(function(){
+    
+        // NOTE: This is an example showing simple state management. During development,
+        // it is generally best to disable state management as dynamically-generated ids
+        // can change across page loads, leading to unpredictable results.  The developer
+        // should ensure that stable state ids are set for stateful components in real apps.
+        Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
+        
+        viewport = new Ext.Viewport({
+            layout: 'border',
+            items: [
+            {
+                // lazily created panel (xtype:'panel' is default)
+                region: 'south',
+                contentEl: 'south',
+                split: true,
+                height: 100,
+                minSize: 100,
+                maxSize: 200,
+                collapsible: true,
+                title: 'Status',
+                margins: '0 0 0 0'
+            }, {
+                region: 'west',
+                id: 'west-panel', // see Ext.getCmp() below
+                title: 'BETA Sequences',
+                split: true,
+                width: 200,
+                minSize: 175,
+                maxSize: 400,
+                collapsible: true,
+                margins: '0 0 0 5',
+                layout: {
+                    type: 'accordion',
+                    animate: true
+                },
+                items: [{
+                    contentEl: 'west',
+                    title: 'Objects',
+                    border: false,
+                    iconCls: 'nav' // see the HEAD section for style used
+                }]
+            },
+            // in this instance the TabPanel is not wrapped by another panel
+            // since no title is needed, this Panel is added directly
+            // as a Container
+            new Ext.TabPanel({
+                region: 'center', // a center region is ALWAYS required for border layout
+                id: 'center-panel',
+                deferredRender: false,
+                activeTab: 0,     // first tab initially active
+                items: [{
+                    contentEl: 'center1',
+                    title: 'YT',
+                    closable: false,
+                    autoScroll: true
+                }, {
+                    contentEl: 'center2',
+                    title: 'Widget 1',
+                    closable: true,
+                    autoScroll: true
+                }]
+            })]
+        });
+        // get a reference to the HTML element with id "hideit" and add a click listener to it 
+        Ext.get("hideit").on('click', function(){
+            // get a reference to the Panel that was created with id = 'west-panel' 
+            var w = Ext.getCmp('west-panel');
+            // expand or collapse that Panel based on its collapsed property state
+            w.collapsed ? w.expand() : w.collapse();
+        });
+    });
+    </script>
+</head>
+<body>
+    <!-- use class="x-hide-display" to prevent a brief flicker of the content -->
+    <div id="west" class="x-hide-display">
+        <p>Hi. I'm the west panel.</p>
+    </div>
+    <div id="center2" class="x-hide-display">
+        <a id="hideit" href="#">Toggle the west region</a>
+        <p>My closable attribute is set to false so you can't close me. The other center panels can be closed.</p>
+        <p>The center panel automatically grows to fit the remaining space in the container that isn't taken up by the border regions.</p>
+        <hr>
+        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna. Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit. Quisque dolor magna, ornare sed, elementum porta, luctus in, leo.</p>
+        <p>Donec quis dui. Sed imperdiet. Nunc consequat, est eu sollicitudin gravida, mauris ligula lacinia mauris, eu porta dui nisl in velit. Nam congue, odio id auctor nonummy, augue lectus euismod nunc, in tristique turpis dolor sed urna. Donec sit amet quam eget diam fermentum pharetra. Integer tincidunt arcu ut purus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla blandit malesuada odio. Nam augue. Aenean molestie sapien in mi. Suspendisse tincidunt. Pellentesque tempus dui vitae sapien. Donec aliquam ipsum sit amet pede. Sed scelerisque mi a erat. Curabitur rutrum ullamcorper risus. Maecenas et lorem ut felis dictum viverra. Fusce sem. Donec pharetra nibh sit amet sapien.</p>
+        <p>Aenean ut orci sed ligula consectetuer pretium. Aliquam odio. Nam pellentesque enim. Nam tincidunt condimentum nisi. Maecenas convallis luctus ligula. Donec accumsan ornare risus. Vestibulum id magna a nunc posuere laoreet. Integer iaculis leo vitae nibh. Nam vulputate, mauris vitae luctus pharetra, pede neque bibendum tellus, facilisis commodo diam nisi eget lacus. Duis consectetuer pulvinar nisi. Cras interdum ultricies sem. Nullam tristique. Suspendisse elementum purus eu nisl. Nulla facilisi. Phasellus ultricies ullamcorper lorem. Sed euismod ante vitae lacus. Nam nunc leo, congue vehicula, luctus ac, tempus non, ante. Morbi suscipit purus a nulla. Sed eu diam.</p>
+        <p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras imperdiet felis id velit. Ut non quam at sem dictum ullamcorper. Vestibulum pharetra purus sed pede. Aliquam ultrices, nunc in varius mattis, felis justo pretium magna, eget laoreet justo eros id eros. Aliquam elementum diam fringilla nulla. Praesent laoreet sapien vel metus. Cras tempus, sapien condimentum dictum dapibus, lorem augue fringilla orci, ut tincidunt eros nisi eget turpis. Nullam nunc nunc, eleifend et, dictum et, pharetra a, neque. Ut feugiat. Aliquam erat volutpat. Donec pretium odio nec felis. Phasellus sagittis lacus eget sapien. Donec est. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p>
+        <p>Vestibulum semper. Nullam non odio. Aliquam quam. Mauris eu lectus non nunc auctor ullamcorper. Sed tincidunt molestie enim. Phasellus lobortis justo sit amet quam. Duis nulla erat, varius a, cursus in, tempor sollicitudin, mauris. Aliquam mi velit, consectetuer mattis, consequat tristique, pulvinar ac, nisl. Aliquam mattis vehicula elit. Proin quis leo sed tellus scelerisque molestie. Quisque luctus. Integer mattis. Donec id augue sed leo aliquam egestas. Quisque in sem. Donec dictum enim in dolor. Praesent non erat. Nulla ultrices vestibulum quam.</p>
+        <p>Duis hendrerit, est vel lobortis sagittis, tortor erat scelerisque tortor, sed pellentesque sem enim id metus. Maecenas at pede. Nulla velit libero, dictum at, mattis quis, sagittis vel, ante. Phasellus faucibus rutrum dui. Cras mauris elit, bibendum at, feugiat non, porta id, neque. Nulla et felis nec odio mollis vehicula. Donec elementum tincidunt mauris. Duis vel dui. Fusce iaculis enim ac nulla. In risus.</p>
+        <p>Donec gravida. Donec et enim. Morbi sollicitudin, lacus a facilisis pulvinar, odio turpis dapibus elit, in tincidunt turpis felis nec libero. Nam vestibulum tempus ipsum. In hac habitasse platea dictumst. Nulla facilisi. Donec semper ligula. Donec commodo tortor in quam. Etiam massa. Ut tempus ligula eget tellus. Curabitur id velit ut velit varius commodo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla facilisi. Fusce ornare pellentesque libero. Nunc rhoncus. Suspendisse potenti. Ut consequat, leo eu accumsan vehicula, justo sem lobortis elit, ac sollicitudin ipsum neque nec ante.</p>
+        <p>Aliquam elementum mauris id sem. Vivamus varius, est ut nonummy consectetuer, nulla quam bibendum velit, ac gravida nisi felis sit amet urna. Aliquam nec risus. Maecenas lacinia purus ut velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse sit amet dui vitae lacus fermentum sodales. Donec varius dapibus nisl. Praesent at velit id risus convallis bibendum. Aliquam felis nibh, rutrum nec, blandit non, mattis sit amet, magna. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam varius dignissim nibh. Quisque id orci ac ante hendrerit molestie. Aliquam malesuada enim non neque.</p>
+    </div>
+    <div id="center1" class="x-hide-display">
+        <p><b>Done reading me? Close me by clicking the X in the top right corner.</b></p>
+        <p>Vestibulum semper. Nullam non odio. Aliquam quam. Mauris eu lectus non nunc auctor ullamcorper. Sed tincidunt molestie enim. Phasellus lobortis justo sit amet quam. Duis nulla erat, varius a, cursus in, tempor sollicitudin, mauris. Aliquam mi velit, consectetuer mattis, consequat tristique, pulvinar ac, nisl. Aliquam mattis vehicula elit. Proin quis leo sed tellus scelerisque molestie. Quisque luctus. Integer mattis. Donec id augue sed leo aliquam egestas. Quisque in sem. Donec dictum enim in dolor. Praesent non erat. Nulla ultrices vestibulum quam.</p>
+        <p>Duis hendrerit, est vel lobortis sagittis, tortor erat scelerisque tortor, sed pellentesque sem enim id metus. Maecenas at pede. Nulla velit libero, dictum at, mattis quis, sagittis vel, ante. Phasellus faucibus rutrum dui. Cras mauris elit, bibendum at, feugiat non, porta id, neque. Nulla et felis nec odio mollis vehicula. Donec elementum tincidunt mauris. Duis vel dui. Fusce iaculis enim ac nulla. In risus.</p>
+        <p>Donec gravida. Donec et enim. Morbi sollicitudin, lacus a facilisis pulvinar, odio turpis dapibus elit, in tincidunt turpis felis nec libero. Nam vestibulum tempus ipsum. In hac habitasse platea dictumst. Nulla facilisi. Donec semper ligula. Donec commodo tortor in quam. Etiam massa. Ut tempus ligula eget tellus. Curabitur id velit ut velit varius commodo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla facilisi. Fusce ornare pellentesque libero. Nunc rhoncus. Suspendisse potenti. Ut consequat, leo eu accumsan vehicula, justo sem lobortis elit, ac sollicitudin ipsum neque nec ante.</p>
+        <p>Aliquam elementum mauris id sem. Vivamus varius, est ut nonummy consectetuer, nulla quam bibendum velit, ac gravida nisi felis sit amet urna. Aliquam nec risus. Maecenas lacinia purus ut velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse sit amet dui vitae lacus fermentum sodales. Donec varius dapibus nisl. Praesent at velit id risus convallis bibendum. Aliquam felis nibh, rutrum nec, blandit non, mattis sit amet, magna. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam varius dignissim nibh. Quisque id orci ac ante hendrerit molestie. Aliquam malesuada enim non neque.</p>
+    </div>
+    <div id="props-panel" class="x-hide-display" style="width:200px;height:200px;overflow:hidden;">
+    </div>
+    <div id="south" class="x-hide-display">
+        <p>4d3d3d3 engaged.</p>
+    </div>
+</body>
+</html>


--- a/yt/gui/reason/http_repl.py	Sun Mar 27 07:54:35 2011 -0700
+++ b/yt/gui/reason/http_repl.py	Sun Mar 27 07:54:51 2011 -0700
@@ -30,6 +30,8 @@
 from .bottle_mods import preroute
 from .basic_repl import ProgrammaticREPL
 
+local_dir = os.path.dirname(__file__)
+
 class HTTPREPL(ProgrammaticREPL):
 
     def __init__(self, locals=None):
@@ -43,15 +45,17 @@
         preroute_table = dict(index = ("/", "GET"),
                               push = ("/push", "POST"),
                               dir = ("/dir", "GET"),
-                              doc = ("/doc", "GET"))
-        for v, args in preroute_table:
+                              doc = ("/doc", "GET"),
+                              resources = ("/resources/:val", "GET"))
+        for v, args in preroute_table.items():
             preroute(args[0], method=args[1])(getattr(self, v))
 
     def index(self):
         """Return an HTTP-based Read-Eval-Print-Loop terminal."""
         # For now this doesn't work!  We will need to move to a better method
         # for this.
-        return open(os.path.join(localDir, "httprepl.html")).read()
+        vals = open(os.path.join(local_dir, "httprepl.html")).read()
+        return vals
         
     def push(self):
         """Push 'line' and return exec results as a bare response."""
@@ -79,3 +83,11 @@
         if not result:
             response.status = 204
         return result
+
+    def resources(self, val):
+        pp = os.path.join(local_dir, "resources", val)
+        if not os.path.exists(pp):
+            response.status = 404
+            return
+        return open(pp).read()
+


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/httprepl.html	Sun Mar 27 07:54:51 2011 -0700
@@ -0,0 +1,151 @@
+<html>
+<head>
+  <title>yt</title>
+	<link rel="stylesheet" type="text/css" href="resources/ext-all.css" />
+
+    <!-- GC -->
+ 	<!-- LIBS -->
+ 	<script type="text/javascript" src="resources/ext-base.js"></script>
+ 	<!-- ENDLIBS -->
+
+    <script type="text/javascript" src="resources/ext-all.js"></script>
+    <script type="text/javascript" src="resources/ext-repl-api.js"></script>
+
+	<style type="text/css">
+	html, body {
+        font:normal 12px verdana;
+        margin:0;
+        padding:0;
+        border:0 none;
+        overflow:hidden;
+        height:100%;
+    }
+	.x-panel-body p {
+	    margin:5px;
+	}
+    .x-column-layout-ct .x-panel {
+        margin-bottom:5px;
+    }
+    .x-column-layout-ct .x-panel-dd-spacer {
+        margin-bottom:5px;
+    }
+    .settings {
+        background-image:url(resources/folder_wrench.png) !important;
+    }
+    .nav {
+        background-image:url(resources/folder_go.png) !important;
+    }
+    #input_line {
+        font-family: monospace;
+    }
+    </style>
+	<script type="text/javascript">
+    function cell_sent() {
+        repl_input.get('input_line').setReadOnly(true);
+    }
+
+    function cell_finished() {
+        repl_input.get('input_line').setReadOnly(false);
+    }
+
+    var handle_result = function(f, a) {
+        var input_line = repl_input.get("input_line")
+        if (a.result == null) {
+            text = "ERROR";
+        } else {
+            text = a.result.replace(/\n/g,"<br/>");
+        }
+        Ext.get("output").dom.innerHTML +=
+        '>>> ' + input_line.getValue() + '<br/>' + text + '<br/>';
+        input_line.setValue("");
+        cell_finished();
+    }
+
+    var repl_input = new Ext.FormPanel({
+        url: 'push',
+        items: [{
+            id: 'input_line',
+            xtype: 'textarea',
+            width: '100%',
+            fieldLabel: '>>>',
+            name: 'line',
+            allowBlank: 'True',
+            bodyStyle: 'font-family: "monospace";',
+            listeners: {
+                specialkey: function(f, e){
+                    if (e.getKey() == e.ENTER) {
+                        cell_sent();
+                        yt_rpc.ExtDirectREPL.execute({
+                            code:repl_input.get('input_line').getValue()},
+                            handle_result);
+                    }
+                }
+            },
+        },],
+    });
+
+    Ext.onReady(function(){
+
+       // NOTE: This is an example showing simple state management. During development,
+       // it is generally best to disable state management as dynamically-generated ids
+       // can change across page loads, leading to unpredictable results.  The developer
+       // should ensure that stable state ids are set for stateful components in real apps.
+       Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
+
+       var viewport = new Ext.Viewport({
+            layout:'border',
+            items:[{
+                region:'west',
+                id:'west-panel',
+                title:'West',
+                split:true,
+                width: 200,
+                minSize: 175,
+                maxSize: 400,
+                collapsible: true,
+                margins:'35 0 5 5',
+                cmargins:'35 5 5 5',
+                layout:'accordion',
+                layoutConfig:{
+                    animate:true
+                },
+                items: [{
+                    html: Ext.example.shortBogusMarkup,
+                    title:'Navigation',
+                    autoScroll:true,
+                    border:false,
+                    iconCls:'nav'
+                },{
+                    title:'Settings',
+                    html: Ext.example.shortBogusMarkup,
+                    border:false,
+                    autoScroll:true,
+                    iconCls:'settings'
+                }]
+            },{
+                region:'center',
+                margins:'35 5 5 0',
+                layout:'column',
+                autoScroll:true,
+                items:[{
+                    columnWidth:1.0,
+                    baseCls:'x-plain',
+                    bodyStyle:'padding:5px 0 5px 5px; font-family: monospace;',
+                    items:[{
+                       title: 'Output',
+                       html: "",
+                       id: "output",
+                    }, repl_input, ]
+                },]
+            }]
+        });
+    Ext.get("output").dom.innerHTML += 'Welcome to the yt web interface.<br/>';
+    }
+    
+    );
+	</script>
+</head>
+<body>
+<script type="text/javascript" src="resources/examples.js"></script><!-- EXAMPLES -->
+  </body>
+</html>


http://bitbucket.org/yt_analysis/yt/changeset/2aca86d619d3/
changeset:   r3920:2aca86d619d3
branch:      yt
user:        MatthewTurk
date:        2011-03-27 17:07:54
summary:     Switching to use Britton's index.html from the old httprepl.html.  Fixing the
usage of multi-level paths in the resources/* route.
affected #:  2 files (1.2 KB)

--- a/yt/gui/reason/extdirect_repl.py	Sun Mar 27 10:39:40 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sun Mar 27 11:07:54 2011 -0400
@@ -46,7 +46,7 @@
         # than through metaclasses or other fancy decorating.
         preroute_table = dict(index = ("/", "GET"),
                               _myapi = ("/resources/ext-repl-api.js", "GET"),
-                              resources = ("/resources/:val", "GET"),
+                              resources = ("/resources/:path#.+#", "GET"),
                               )
         for v, args in preroute_table.items():
             preroute(args[0], method=args[1])(getattr(self, v))
@@ -58,11 +58,12 @@
         """Return an HTTP-based Read-Eval-Print-Loop terminal."""
         # For now this doesn't work!  We will need to move to a better method
         # for this.
-        vals = open(os.path.join(local_dir, "httprepl.html")).read()
+        vals = open(os.path.join(local_dir, "html/index.html")).read()
         return vals
 
-    def resources(self, val):
-        pp = os.path.join(local_dir, "resources", val)
+    def resources(self, path):
+        # This will need to be changed.
+        pp = os.path.join(local_dir, "../../../../misc/ext/ext-3.3.1/", path)
         if not os.path.exists(pp):
             response.status = 404
             return


--- a/yt/gui/reason/html/index.html	Sun Mar 27 10:39:40 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 11:07:54 2011 -0400
@@ -1,7 +1,7 @@
 <html><head><title>Complex Layout</title>
-    <link rel="stylesheet" type="text/css" href="../../../../../misc/ext/ext-3.3.1/resources/css/ext-all.css" />
+    <link rel="stylesheet" type="text/css" href="resources/resources/css/ext-all.css" /><style type="text/css">
     html, body {
@@ -16,25 +16,73 @@
         margin:5px;
     }
     .settings {
-        background-image:url(../../../../../misc/ext/ext-3.3.1/examples/shared/icons/fam/folder_wrench.png);
+        background-image:url(resources/examples/shared/icons/fam/folder_wrench.png);
     }
     .nav {
-        background-image:url(../../../../../misc/ext/ext-3.3.1/examples/shared/icons/fam/folder_go.png);
+        background-image:url(resources/examples/shared/icons/fam/folder_go.png);
+    }
+    #input_line {
+        font-family: monospace;
     }
     </style><!-- GC --><!-- LIBS -->
-    <script type="text/javascript" src="../../../../../misc/ext/ext-3.3.1/adapter/ext/ext-base.js"></script>
+    <script type="text/javascript" src="resources/adapter/ext/ext-base.js"></script><!-- ENDLIBS -->
 
-    <script type="text/javascript" src="../../../../../misc/ext/ext-3.3.1/ext-all.js"></script>
+    <script type="text/javascript" src="resources/ext-all.js"></script><!-- EXAMPLES -->
-    <script type="text/javascript" src="../../../../../misc/ext/ext-3.3.1/examples/shared/examples.js"></script>
+    <script type="text/javascript" src="resources/examples/shared/examples.js"></script>
+    <script type="text/javascript" src="resources/ext-repl-api.js"></script><script type="text/javascript">
     var viewport;
+    function cell_sent() {
+        repl_input.get('input_line').setReadOnly(true);
+    }
+
+    function cell_finished() {
+        repl_input.get('input_line').setReadOnly(false);
+    }
+
+    var handle_result = function(f, a) {
+        var input_line = repl_input.get("input_line")
+        if (a.result == null) {
+            text = "ERROR";
+        } else {
+            text = a.result.replace(/\n/g,"<br/>");
+        }
+        Ext.get("output").dom.innerHTML +=
+        '>>> ' + input_line.getValue() + '<br/>' + text + '<br/>';
+        input_line.setValue("");
+        cell_finished();
+    }
+
+    var repl_input = new Ext.FormPanel({
+        url: 'push',
+        items: [{
+            id: 'input_line',
+            xtype: 'textarea',
+            width: '100%',
+            fieldLabel: '>>>',
+            name: 'line',
+            allowBlank: 'True',
+            bodyStyle: 'font-family: "monospace";',
+            listeners: {
+                specialkey: function(f, e){
+                    if (e.getKey() == e.ENTER) {
+                        cell_sent();
+                        yt_rpc.ExtDirectREPL.execute({
+                            code:repl_input.get('input_line').getValue()},
+                            handle_result);
+                    }
+                }
+            },
+        },],
+    });
+
     Ext.onReady(function(){
     
         // NOTE: This is an example showing simple state management. During development,
@@ -87,10 +135,14 @@
                 deferredRender: false,
                 activeTab: 0,     // first tab initially active
                 items: [{
-                    contentEl: 'center1',
                     title: 'YT',
                     closable: false,
-                    autoScroll: true
+                    autoScroll: true,
+                    items: [{
+                       title: 'Output',
+                       html: "",
+                       id: "output",
+                    }, repl_input, ]
                 }, {
                     contentEl: 'center2',
                     title: 'Widget 1',
@@ -128,13 +180,6 @@
         <p>Donec gravida. Donec et enim. Morbi sollicitudin, lacus a facilisis pulvinar, odio turpis dapibus elit, in tincidunt turpis felis nec libero. Nam vestibulum tempus ipsum. In hac habitasse platea dictumst. Nulla facilisi. Donec semper ligula. Donec commodo tortor in quam. Etiam massa. Ut tempus ligula eget tellus. Curabitur id velit ut velit varius commodo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla facilisi. Fusce ornare pellentesque libero. Nunc rhoncus. Suspendisse potenti. Ut consequat, leo eu accumsan vehicula, justo sem lobortis elit, ac sollicitudin ipsum neque nec ante.</p><p>Aliquam elementum mauris id sem. Vivamus varius, est ut nonummy consectetuer, nulla quam bibendum velit, ac gravida nisi felis sit amet urna. Aliquam nec risus. Maecenas lacinia purus ut velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse sit amet dui vitae lacus fermentum sodales. Donec varius dapibus nisl. Praesent at velit id risus convallis bibendum. Aliquam felis nibh, rutrum nec, blandit non, mattis sit amet, magna. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam varius dignissim nibh. Quisque id orci ac ante hendrerit molestie. Aliquam malesuada enim non neque.</p></div>
-    <div id="center1" class="x-hide-display">
-        <p><b>Done reading me? Close me by clicking the X in the top right corner.</b></p>
-        <p>Vestibulum semper. Nullam non odio. Aliquam quam. Mauris eu lectus non nunc auctor ullamcorper. Sed tincidunt molestie enim. Phasellus lobortis justo sit amet quam. Duis nulla erat, varius a, cursus in, tempor sollicitudin, mauris. Aliquam mi velit, consectetuer mattis, consequat tristique, pulvinar ac, nisl. Aliquam mattis vehicula elit. Proin quis leo sed tellus scelerisque molestie. Quisque luctus. Integer mattis. Donec id augue sed leo aliquam egestas. Quisque in sem. Donec dictum enim in dolor. Praesent non erat. Nulla ultrices vestibulum quam.</p>
-        <p>Duis hendrerit, est vel lobortis sagittis, tortor erat scelerisque tortor, sed pellentesque sem enim id metus. Maecenas at pede. Nulla velit libero, dictum at, mattis quis, sagittis vel, ante. Phasellus faucibus rutrum dui. Cras mauris elit, bibendum at, feugiat non, porta id, neque. Nulla et felis nec odio mollis vehicula. Donec elementum tincidunt mauris. Duis vel dui. Fusce iaculis enim ac nulla. In risus.</p>
-        <p>Donec gravida. Donec et enim. Morbi sollicitudin, lacus a facilisis pulvinar, odio turpis dapibus elit, in tincidunt turpis felis nec libero. Nam vestibulum tempus ipsum. In hac habitasse platea dictumst. Nulla facilisi. Donec semper ligula. Donec commodo tortor in quam. Etiam massa. Ut tempus ligula eget tellus. Curabitur id velit ut velit varius commodo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla facilisi. Fusce ornare pellentesque libero. Nunc rhoncus. Suspendisse potenti. Ut consequat, leo eu accumsan vehicula, justo sem lobortis elit, ac sollicitudin ipsum neque nec ante.</p>
-        <p>Aliquam elementum mauris id sem. Vivamus varius, est ut nonummy consectetuer, nulla quam bibendum velit, ac gravida nisi felis sit amet urna. Aliquam nec risus. Maecenas lacinia purus ut velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse sit amet dui vitae lacus fermentum sodales. Donec varius dapibus nisl. Praesent at velit id risus convallis bibendum. Aliquam felis nibh, rutrum nec, blandit non, mattis sit amet, magna. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam varius dignissim nibh. Quisque id orci ac ante hendrerit molestie. Aliquam malesuada enim non neque.</p>
-    </div><div id="props-panel" class="x-hide-display" style="width:200px;height:200px;overflow:hidden;"></div><div id="south" class="x-hide-display">


http://bitbucket.org/yt_analysis/yt/changeset/ce1741051893/
changeset:   r3921:ce1741051893
branch:      yt
user:        MatthewTurk
date:        2011-03-27 17:08:07
summary:     Merginghg merge
affected #:  0 files (0 bytes)

--- a/yt/visualization/image_writer.py	Sun Mar 27 11:07:54 2011 -0400
+++ b/yt/visualization/image_writer.py	Sun Mar 27 11:08:07 2011 -0400
@@ -137,7 +137,7 @@
     au.write_png(bitmap_array.copy(), filename)
     return bitmap_array
 
-def write_image(image, filename, color_bounds = None, cmap_name = "algae"):
+def write_image(image, filename, color_bounds = None, cmap_name = "algae", func = lambda x: x):
     r"""Write out a floating point array directly to a PNG file, scaling it and
     applying a colormap.
 
@@ -157,7 +157,9 @@
     cmap_name : string, optional
         An acceptable colormap.  See either yt.visualization.color_maps or
         http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps .
-        
+    func : function, optional
+        A function to transform the buffer before applying a colormap. 
+
     Returns
     -------
     scaled_image : uint8 image that has been saved
@@ -173,6 +175,36 @@
     if len(image.shape) == 3:
         mylog.info("Using only channel 1 of supplied image")
         image = image[:,:,0]
+    to_plot = apply_colormap(image, color_bounds = color_bounds, cmap_name = cmap_name)
+    au.write_png(to_plot, filename)
+    return to_plot
+
+def apply_colormap(image, color_bounds = None, cmap_name = 'algae', func=lambda x: x):
+    r"""Apply a colormap to a floating point image, scaling to uint8.
+
+    This function will scale an image and directly call libpng to write out a
+    colormapped version of that image.  It is designed for rapid-fire saving of
+    image buffers generated using `yt.visualization.api.FixedResolutionBuffers` and the like.
+
+    Parameters
+    ----------
+    image : array_like
+        This is an (unscaled) array of floating point values, shape (N,N,) to
+        save in a PNG file.
+    color_bounds : tuple of floats, optional
+        The min and max to scale between.  Outlying values will be clipped.
+    cmap_name : string, optional
+        An acceptable colormap.  See either yt.visualization.color_maps or
+        http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps .
+    func : function, optional
+        A function to transform the buffer before applying a colormap. 
+
+    Returns
+    -------
+    to_plot : uint8 image with colorbar applied.
+
+    """
+    image = func(image)
     if color_bounds is None:
         mi = na.nanmin(image[~na.isinf(image)])
         ma = na.nanmax(image[~na.isinf(image)])
@@ -180,7 +212,6 @@
     image = (image - color_bounds[0])/(color_bounds[1] - color_bounds[0])
     to_plot = map_to_colors(image, cmap_name)
     to_plot = na.clip(to_plot, 0, 255)
-    au.write_png(to_plot, filename)
     return to_plot
 
 def annotate_image(image, text, xpos, ypos, font_name = "Vera",


--- a/yt/visualization/plot_window.py	Sun Mar 27 11:07:54 2011 -0400
+++ b/yt/visualization/plot_window.py	Sun Mar 27 11:08:07 2011 -0400
@@ -23,9 +23,11 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
+import tempfile
 import color_maps
 from image_writer import \
-    write_image
+    write_image, apply_colormap
+from yt.utilities.amr_utils import write_png_to_file
 from fixed_resolution import \
     FixedResolutionBuffer
 import matplotlib.pyplot
@@ -36,7 +38,7 @@
         args[0]._data_valid = False
         args[0]._plot_valid = False
         args[0]._recreate_frb()
-        args[0]._setup_plots()
+        return args[0]._setup_plots()
 
     return newfunc
 
@@ -60,6 +62,23 @@
         invalidated as the object is modified.
         
         Data is handled by a FixedResolutionBuffer object.
+
+        Parameters
+        ----------
+        data_source : :class:`yt.data_objects.data_containers.AMRProjBase` or :class:`yt.data_objects.data_containers.AMRSliceBase`
+            This is the source to be pixelized, which can be a projection or a
+            slice.  (For cutting planes, see
+            `yt.visualization.fixed_resolution.ObliqueFixedResolutionBuffer`.)
+        bounds : sequence of floats
+            Bounds are the min and max in the image plane that we want our
+            image to cover.  It's in the order of (xmin, xmax, ymin, ymax),
+            where the coordinates are all in the appropriate code units.
+        buff_size : sequence of ints
+            The size of the image to generate.
+        antialias : boolean
+            This can be true or false.  It determines whether or not sub-pixel
+            rendering is used during data deposition.
+
         """
         self.plots = {}
         self.data_source = data_source
@@ -80,25 +99,14 @@
             raise RuntimeError("Failed to repixelize.")
         self._frb._get_data_source_fields()
         self._data_valid = True
-
+        
     def _setup_plots(self):
-        for f in self.fields:
-            self.plots[f] = YtWindowPlot(self._frb[f])
-        self._plot_valid = True
+        pass
 
     @property
     def fields(self):
         return self._frb.data.keys()
 
-    def save(self,name):
-        for k,v in self.plots.iteritems():
-            n = "%s_%s" % (name, k)
-            v.save(n)
-
-    @invalidate_data
-    def pan(self):
-        pass
-
     @property
     def width(self):
         Wx = self.xlim[1] - self.xlim[0]
@@ -131,10 +139,6 @@
         self.xlim = (self.xlim[0] + deltas[0], self.xlim[1] + deltas[0])
         self.ylim = (self.ylim[0] + deltas[1], self.ylim[1] + deltas[1])
 
-    @invalidate_plot
-    def set_cmap(self):
-        pass
-
     @invalidate_data
     def set_field(self):
         pass
@@ -147,20 +151,76 @@
     @invalidate_data
     def set_width(self):
         pass
+
     @property
     def width(self):
         Wx = self.xlim[1] - self.xlim[0]
         Wy = self.ylim[1] - self.ylim[0]
         return (Wx, Wy)
 
-    # @invalidate_plot
-    # def set_zlim(self):
-    #     pass
-
     @invalidate_data
     def set_antialias(self,aa):
         self.antialias = aa
 
+class PWViewerRaw(PlotWindow):
+    """A PlotWindow viewer that writes raw pngs (no MPL, no axes).
+
+    """
+    def _setup_plots(self):
+        self.save('')
+        self._plot_valid = True
+
+    def save(self,name):
+        for field in self._frb.data.keys():
+            nm = "%s_%s.png" % (name,field)
+            print "writing %s" % nm
+            write_image(self._frb[field],nm)
+
+class PWViewerExtJS(PlotWindow):
+    """A viewer for the web interface.
+
+    """
+    def _setup_plots(self):
+        plots = []
+        for field in self._frb.data.keys():
+            tf = tempfile.TemporaryFile()
+            to_plot = apply_colormap(self._frb[field])
+            write_png_to_file(to_plot, tf)
+            tf.seek(0)
+            s = tf.read()
+            tf.close()
+            ret = {}
+            ret['plot'] = s
+            ret['metadata'] = self.get_metadata()
+            plots.append(ret)
+
+        return plots
+
+    def get_metadata(self):
+        pass
+
+class PWWiewer(PlotWindow):
+    """A viewer for PlotWindows.
+
+    """
+    def _setup_plots(self):
+        for f in self.fields:
+            self.plots[f] = YtWindowPlot(self._frb[f])
+        self._plot_valid = True
+
+    def save(self,name):
+        for k,v in self.plots.iteritems():
+            n = "%s_%s" % (name, k)
+            v.save(n)
+    @invalidate_plot
+    def set_cmap(self):
+        pass
+    @invalidate_plot
+    def set_zlim(self):
+        pass
+
+
+
 class YtPlot(object):
     """A base class for all yt plots. It should abstract the actual
     plotting engine completely, allowing plotting even without matplotlib. 


http://bitbucket.org/yt_analysis/yt/changeset/4b7c17898edd/
changeset:   r3922:4b7c17898edd
branch:      yt
user:        MatthewTurk
date:        2011-03-27 17:17:47
summary:     Monospacing the cell output
affected #:  1 file (67 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 11:08:07 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 11:17:47 2011 -0400
@@ -24,6 +24,9 @@
     #input_line {
         font-family: monospace;
     }
+    #cell_output {
+        font-family: monospace;
+    }
     </style><!-- GC -->
@@ -54,7 +57,7 @@
         } else {
             text = a.result.replace(/\n/g,"<br/>");
         }
-        Ext.get("output").dom.innerHTML +=
+        Ext.get("cell_output").dom.innerHTML +=
         '>>> ' + input_line.getValue() + '<br/>' + text + '<br/>';
         input_line.setValue("");
         cell_finished();
@@ -141,7 +144,7 @@
                     items: [{
                        title: 'Output',
                        html: "",
-                       id: "output",
+                       id: "cell_output",
                     }, repl_input, ]
                 }, {
                     contentEl: 'center2',


http://bitbucket.org/yt_analysis/yt/changeset/48d97fac1d0d/
changeset:   r3923:48d97fac1d0d
branch:      yt
user:        brittonsmith
date:        2011-03-27 17:41:37
summary:     Added tree example.
affected #:  1 file (644 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 11:17:47 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 11:41:37 2011 -0400
@@ -87,13 +87,54 @@
     });
 
     Ext.onReady(function(){
-    
+
+Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
+
         // NOTE: This is an example showing simple state management. During development,
         // it is generally best to disable state management as dynamically-generated ids
         // can change across page loads, leading to unpredictable results.  The developer
         // should ensure that stable state ids are set for stateful components in real apps.
         Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
-        
+
+var children = [{
+     text:'pf1',
+     expanded: true,
+     children:[{
+         text:'sphere',
+         leaf:true
+    },{
+         text:'region'
+        ,leaf:true
+    }]
+},{
+     text:'pf2',
+     expanded: true,
+     children:[{
+         text:'all_data'
+        ,leaf:true
+    }]
+ 
+}];
+
+	// Go ahead and create the TreePanel now so that we can use it below
+    var treePanel = new Ext.tree.TreePanel({
+     loader:new Ext.tree.TreeLoader(),
+        iconCls: 'nav',
+    	id: 'tree-panel',
+    	title: 'Objects',
+        region:'west',
+        split: true,
+        minSize: 150,
+        autoScroll: true,
+        rootVisible: false,
+        root:new Ext.tree.AsyncTreeNode({
+          expanded:true
+         ,leaf:false
+         ,text:''
+         ,children:children
+     })
+     });
+
         viewport = new Ext.Viewport({
             layout: 'border',
             items: [
@@ -122,12 +163,7 @@
                     type: 'accordion',
                     animate: true
                 },
-                items: [{
-                    contentEl: 'west',
-                    title: 'Objects',
-                    border: false,
-                    iconCls: 'nav' // see the HEAD section for style used
-                }]
+                items: [treePanel]
             },
             // in this instance the TabPanel is not wrapped by another panel
             // since no title is needed, this Panel is added directly


http://bitbucket.org/yt_analysis/yt/changeset/63f6a93c9878/
changeset:   r3924:63f6a93c9878
branch:      yt
user:        MatthewTurk
date:        2011-03-27 17:42:20
summary:     Setting up a simple button for adding and testing functions
affected #:  1 file (93 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 11:41:37 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 11:42:20 2011 -0400
@@ -86,6 +86,10 @@
         },],
     });
 
+    var TestButtonPanel = new Ext.Button(
+        {text:'First Button'}
+    );
+
     Ext.onReady(function(){
 
 Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
@@ -177,10 +181,10 @@
                     title: 'YT',
                     closable: false,
                     autoScroll: true,
-                    items: [{
-                       title: 'Output',
-                       html: "",
-                       id: "cell_output",
+                    items: [TestButtonPanel, 
+                    { title: 'Output',
+                      html: "",
+                      id: "cell_output",
                     }, repl_input, ]
                 }, {
                     contentEl: 'center2',


http://bitbucket.org/yt_analysis/yt/changeset/907036537f94/
changeset:   r3925:907036537f94
branch:      yt
user:        MatthewTurk
date:        2011-03-27 18:38:46
summary:     Removing old httprepl.html file
affected #:  1 file (0 bytes)

--- a/yt/gui/reason/httprepl.html	Sun Mar 27 11:42:20 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-<html>
-<head>
-  <title>yt</title>
-	<link rel="stylesheet" type="text/css" href="resources/ext-all.css" />
-
-    <!-- GC -->
- 	<!-- LIBS -->
- 	<script type="text/javascript" src="resources/ext-base.js"></script>
- 	<!-- ENDLIBS -->
-
-    <script type="text/javascript" src="resources/ext-all.js"></script>
-    <script type="text/javascript" src="resources/ext-repl-api.js"></script>
-
-	<style type="text/css">
-	html, body {
-        font:normal 12px verdana;
-        margin:0;
-        padding:0;
-        border:0 none;
-        overflow:hidden;
-        height:100%;
-    }
-	.x-panel-body p {
-	    margin:5px;
-	}
-    .x-column-layout-ct .x-panel {
-        margin-bottom:5px;
-    }
-    .x-column-layout-ct .x-panel-dd-spacer {
-        margin-bottom:5px;
-    }
-    .settings {
-        background-image:url(resources/folder_wrench.png) !important;
-    }
-    .nav {
-        background-image:url(resources/folder_go.png) !important;
-    }
-    #input_line {
-        font-family: monospace;
-    }
-    </style>
-	<script type="text/javascript">
-    function cell_sent() {
-        repl_input.get('input_line').setReadOnly(true);
-    }
-
-    function cell_finished() {
-        repl_input.get('input_line').setReadOnly(false);
-    }
-
-    var handle_result = function(f, a) {
-        var input_line = repl_input.get("input_line")
-        if (a.result == null) {
-            text = "ERROR";
-        } else {
-            text = a.result.replace(/\n/g,"<br/>");
-        }
-        Ext.get("output").dom.innerHTML +=
-        '>>> ' + input_line.getValue() + '<br/>' + text + '<br/>';
-        input_line.setValue("");
-        cell_finished();
-    }
-
-    var repl_input = new Ext.FormPanel({
-        url: 'push',
-        items: [{
-            id: 'input_line',
-            xtype: 'textarea',
-            width: '100%',
-            fieldLabel: '>>>',
-            name: 'line',
-            allowBlank: 'True',
-            bodyStyle: 'font-family: "monospace";',
-            listeners: {
-                specialkey: function(f, e){
-                    if (e.getKey() == e.ENTER) {
-                        cell_sent();
-                        yt_rpc.ExtDirectREPL.execute({
-                            code:repl_input.get('input_line').getValue()},
-                            handle_result);
-                    }
-                }
-            },
-        },],
-    });
-
-    Ext.onReady(function(){
-
-       // NOTE: This is an example showing simple state management. During development,
-       // it is generally best to disable state management as dynamically-generated ids
-       // can change across page loads, leading to unpredictable results.  The developer
-       // should ensure that stable state ids are set for stateful components in real apps.
-       Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
-
-       var viewport = new Ext.Viewport({
-            layout:'border',
-            items:[{
-                region:'west',
-                id:'west-panel',
-                title:'West',
-                split:true,
-                width: 200,
-                minSize: 175,
-                maxSize: 400,
-                collapsible: true,
-                margins:'35 0 5 5',
-                cmargins:'35 5 5 5',
-                layout:'accordion',
-                layoutConfig:{
-                    animate:true
-                },
-                items: [{
-                    html: Ext.example.shortBogusMarkup,
-                    title:'Navigation',
-                    autoScroll:true,
-                    border:false,
-                    iconCls:'nav'
-                },{
-                    title:'Settings',
-                    html: Ext.example.shortBogusMarkup,
-                    border:false,
-                    autoScroll:true,
-                    iconCls:'settings'
-                }]
-            },{
-                region:'center',
-                margins:'35 5 5 0',
-                layout:'column',
-                autoScroll:true,
-                items:[{
-                    columnWidth:1.0,
-                    baseCls:'x-plain',
-                    bodyStyle:'padding:5px 0 5px 5px; font-family: monospace;',
-                    items:[{
-                       title: 'Output',
-                       html: "",
-                       id: "output",
-                    }, repl_input, ]
-                },]
-            }]
-        });
-    Ext.get("output").dom.innerHTML += 'Welcome to the yt web interface.<br/>';
-    }
-    
-    );
-	</script>
-</head>
-<body>
-<script type="text/javascript" src="resources/examples.js"></script><!-- EXAMPLES -->
-  </body>
-</html>


http://bitbucket.org/yt_analysis/yt/changeset/96a5019d12ac/
changeset:   r3926:96a5019d12ac
branch:      yt
user:        MatthewTurk
date:        2011-03-27 18:45:05
summary:     Refactoring the ExtDirectBottleRouter slightly and adding a parameter file
lister
affected #:  3 files (467 bytes)

--- a/yt/gui/reason/bottle_mods.py	Sun Mar 27 12:38:46 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Sun Mar 27 12:45:05 2011 -0400
@@ -48,10 +48,11 @@
     # 'route' for it to work.
     _route_prefix = None
     def __init__(self, *args, **kwargs):
-        future_route = kwargs.pop("route")
+        future_route = self.api_url
         super(BottleDirectRouter, self).__init__(*args, **kwargs)
         self.__name__ = str(self.my_name)
         route_functions[future_route] = ((), {'method':"POST"}, self)
+        preroute("/resources/ext-%s-api.js" % self.api_url, method="GET")(self._myapi)
         notify_route(self)
 
     def _myapi(self):


--- a/yt/gui/reason/extdirect_repl.py	Sun Mar 27 12:38:46 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sun Mar 27 12:45:05 2011 -0400
@@ -50,9 +50,9 @@
                               )
         for v, args in preroute_table.items():
             preroute(args[0], method=args[1])(getattr(self, v))
-        notify_route(self)
         self.api_url = "repl"
-        BottleDirectRouter.__init__(self, route="/repl")
+        BottleDirectRouter.__init__(self)
+        self.pflist = ExtDirectParameterFileList()
 
     def index(self):
         """Return an HTTP-based Read-Eval-Print-Loop terminal."""
@@ -68,3 +68,12 @@
             response.status = 404
             return
         return open(pp).read()
+
+class ExtDirectParameterFileList(BottleDirectRouter):
+    my_name = "ExtDirectParameterFileList"
+    api_url = "pflist"
+
+    def get_list_of_pfs(self):
+        from yt.data_objects.static_output import _cached_pfs
+        names = [str(i) for i in sorted(_cached_pfs.values())]
+        return names


--- a/yt/gui/reason/html/index.html	Sun Mar 27 12:38:46 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 12:45:05 2011 -0400
@@ -39,6 +39,7 @@
     <!-- EXAMPLES --><script type="text/javascript" src="resources/examples/shared/examples.js"></script><script type="text/javascript" src="resources/ext-repl-api.js"></script>
+    <script type="text/javascript" src="resources/ext-pflist-api.js"></script><script type="text/javascript">
     var viewport;


http://bitbucket.org/yt_analysis/yt/changeset/7770bdb6ecb2/
changeset:   r3927:7770bdb6ecb2
branch:      yt
user:        Cameron Hummels
date:        2011-03-27 19:28:41
summary:     Made changes to index.html, including icons for tabs
affected #:  3 files (8.8 KB)

Binary file yt/gui/reason/html/images/console.png has changed


Binary file yt/gui/reason/html/images/graph.png has changed


--- a/yt/gui/reason/html/index.html	Sun Mar 27 12:45:05 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 13:28:41 2011 -0400
@@ -21,6 +21,12 @@
     .nav {
         background-image:url(resources/examples/shared/icons/fam/folder_go.png);
     }
+    graph { 
+        background-image:url(images/graph.png) !important; //add images to tabs
+    }
+    console { 
+        background-image:url(images/console.png) !important;
+    }
     #input_line {
         font-family: monospace;
     }
@@ -87,8 +93,20 @@
         },],
     });
 
-    var TestButtonPanel = new Ext.Button(
-        {text:'First Button'}
+    var NorthButton = new Ext.Button(
+        {text : 'North',
+        pageX : 10,
+        pageY : 100
+        }
+    );
+    var EastButton = new Ext.Button(
+        {text:'East'}
+    );
+    var SouthButton = new Ext.Button(
+        {text:'South'}
+    );
+    var WestButton = new Ext.Button(
+        {text:'West'}
     );
 
     Ext.onReady(function(){
@@ -173,27 +191,35 @@
             // in this instance the TabPanel is not wrapped by another panel
             // since no title is needed, this Panel is added directly
             // as a Container
-            new Ext.TabPanel({
+//            new Ext.TabPanel({
+            {
+                xtype: 'tabpanel',
                 region: 'center', // a center region is ALWAYS required for border layout
                 id: 'center-panel',
                 deferredRender: false,
                 activeTab: 0,     // first tab initially active
                 items: [{
                     title: 'YT',
+                    iconCls: 'console',
                     closable: false,
                     autoScroll: true,
-                    items: [TestButtonPanel, 
-                    { title: 'Output',
-                      html: "",
-                      id: "cell_output",
+                    iconCls: 'console',
+                    items: [{ 
+                        title: 'Output',
+                        html: "",
+                        id: "cell_output",
                     }, repl_input, ]
                 }, {
                     contentEl: 'center2',
-                    title: 'Widget 1',
+                    title: 'Plot Window 1',
+                    iconCls: 'graph',
                     closable: true,
-                    autoScroll: true
+                    autoScroll: true,
+                    items: [NorthButton]
+                        
                 }]
-            })]
+//            })]
+            }]
         });
         // get a reference to the HTML element with id "hideit" and add a click listener to it 
         Ext.get("hideit").on('click', function(){
@@ -212,17 +238,8 @@
     </div><div id="center2" class="x-hide-display"><a id="hideit" href="#">Toggle the west region</a>
-        <p>My closable attribute is set to false so you can't close me. The other center panels can be closed.</p>
-        <p>The center panel automatically grows to fit the remaining space in the container that isn't taken up by the border regions.</p><hr>
-        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna. Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit. Quisque dolor magna, ornare sed, elementum porta, luctus in, leo.</p>
-        <p>Donec quis dui. Sed imperdiet. Nunc consequat, est eu sollicitudin gravida, mauris ligula lacinia mauris, eu porta dui nisl in velit. Nam congue, odio id auctor nonummy, augue lectus euismod nunc, in tristique turpis dolor sed urna. Donec sit amet quam eget diam fermentum pharetra. Integer tincidunt arcu ut purus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla blandit malesuada odio. Nam augue. Aenean molestie sapien in mi. Suspendisse tincidunt. Pellentesque tempus dui vitae sapien. Donec aliquam ipsum sit amet pede. Sed scelerisque mi a erat. Curabitur rutrum ullamcorper risus. Maecenas et lorem ut felis dictum viverra. Fusce sem. Donec pharetra nibh sit amet sapien.</p>
-        <p>Aenean ut orci sed ligula consectetuer pretium. Aliquam odio. Nam pellentesque enim. Nam tincidunt condimentum nisi. Maecenas convallis luctus ligula. Donec accumsan ornare risus. Vestibulum id magna a nunc posuere laoreet. Integer iaculis leo vitae nibh. Nam vulputate, mauris vitae luctus pharetra, pede neque bibendum tellus, facilisis commodo diam nisi eget lacus. Duis consectetuer pulvinar nisi. Cras interdum ultricies sem. Nullam tristique. Suspendisse elementum purus eu nisl. Nulla facilisi. Phasellus ultricies ullamcorper lorem. Sed euismod ante vitae lacus. Nam nunc leo, congue vehicula, luctus ac, tempus non, ante. Morbi suscipit purus a nulla. Sed eu diam.</p>
-        <p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras imperdiet felis id velit. Ut non quam at sem dictum ullamcorper. Vestibulum pharetra purus sed pede. Aliquam ultrices, nunc in varius mattis, felis justo pretium magna, eget laoreet justo eros id eros. Aliquam elementum diam fringilla nulla. Praesent laoreet sapien vel metus. Cras tempus, sapien condimentum dictum dapibus, lorem augue fringilla orci, ut tincidunt eros nisi eget turpis. Nullam nunc nunc, eleifend et, dictum et, pharetra a, neque. Ut feugiat. Aliquam erat volutpat. Donec pretium odio nec felis. Phasellus sagittis lacus eget sapien. Donec est. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p>
-        <p>Vestibulum semper. Nullam non odio. Aliquam quam. Mauris eu lectus non nunc auctor ullamcorper. Sed tincidunt molestie enim. Phasellus lobortis justo sit amet quam. Duis nulla erat, varius a, cursus in, tempor sollicitudin, mauris. Aliquam mi velit, consectetuer mattis, consequat tristique, pulvinar ac, nisl. Aliquam mattis vehicula elit. Proin quis leo sed tellus scelerisque molestie. Quisque luctus. Integer mattis. Donec id augue sed leo aliquam egestas. Quisque in sem. Donec dictum enim in dolor. Praesent non erat. Nulla ultrices vestibulum quam.</p><p>Duis hendrerit, est vel lobortis sagittis, tortor erat scelerisque tortor, sed pellentesque sem enim id metus. Maecenas at pede. Nulla velit libero, dictum at, mattis quis, sagittis vel, ante. Phasellus faucibus rutrum dui. Cras mauris elit, bibendum at, feugiat non, porta id, neque. Nulla et felis nec odio mollis vehicula. Donec elementum tincidunt mauris. Duis vel dui. Fusce iaculis enim ac nulla. In risus.</p>
-        <p>Donec gravida. Donec et enim. Morbi sollicitudin, lacus a facilisis pulvinar, odio turpis dapibus elit, in tincidunt turpis felis nec libero. Nam vestibulum tempus ipsum. In hac habitasse platea dictumst. Nulla facilisi. Donec semper ligula. Donec commodo tortor in quam. Etiam massa. Ut tempus ligula eget tellus. Curabitur id velit ut velit varius commodo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla facilisi. Fusce ornare pellentesque libero. Nunc rhoncus. Suspendisse potenti. Ut consequat, leo eu accumsan vehicula, justo sem lobortis elit, ac sollicitudin ipsum neque nec ante.</p>
-        <p>Aliquam elementum mauris id sem. Vivamus varius, est ut nonummy consectetuer, nulla quam bibendum velit, ac gravida nisi felis sit amet urna. Aliquam nec risus. Maecenas lacinia purus ut velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse sit amet dui vitae lacus fermentum sodales. Donec varius dapibus nisl. Praesent at velit id risus convallis bibendum. Aliquam felis nibh, rutrum nec, blandit non, mattis sit amet, magna. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam varius dignissim nibh. Quisque id orci ac ante hendrerit molestie. Aliquam malesuada enim non neque.</p></div><div id="props-panel" class="x-hide-display" style="width:200px;height:200px;overflow:hidden;"></div>


http://bitbucket.org/yt_analysis/yt/changeset/e6c8b040edbe/
changeset:   r3928:e6c8b040edbe
branch:      yt
user:        MatthewTurk
date:        2011-03-27 19:17:59
summary:     Generalizing some payload handling
affected #:  3 files (963 bytes)

--- a/yt/gui/reason/bottle_mods.py	Sun Mar 27 12:45:05 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Sun Mar 27 13:17:59 2011 -0400
@@ -31,6 +31,7 @@
 
 route_functions = {}
 route_watchers = []
+payloads = []
 
 def preroute(future_route, *args, **kwargs):
     def router(func):
@@ -41,6 +42,25 @@
 def notify_route(watcher):
     route_watchers.append(watcher)
 
+class PayloadHandler(object):
+    _shared_state = {}
+
+    def __new__(cls, *p, **k):
+        self = object.__new__(cls, *p, **k)
+        self.__dict__ = cls._shared_state
+        return self
+
+    def __init__(self):
+        self.payloads = []
+
+    def deliver_payloads(self):
+        payloads = self.payloads
+        self.payloads = []
+        return payloads
+
+    def add_payload(self, to_add):
+        self.payloads.append(to_add)
+
 class BottleDirectRouter(DirectRouter):
     # This class implements a mechanism for auto-routing an ExtDirect-callable
     # object through Bottle.  It should be used as a base class of an object,


--- a/yt/gui/reason/extdirect_repl.py	Sun Mar 27 12:45:05 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sun Mar 27 13:17:59 2011 -0400
@@ -27,7 +27,8 @@
 import json
 import os
 
-from .bottle_mods import preroute, BottleDirectRouter, notify_route
+from .bottle_mods import preroute, BottleDirectRouter, notify_route, \
+                         PayloadHandler
 from .basic_repl import ProgrammaticREPL
 
 local_dir = os.path.dirname(__file__)
@@ -53,6 +54,8 @@
         self.api_url = "repl"
         BottleDirectRouter.__init__(self)
         self.pflist = ExtDirectParameterFileList()
+        self.executed_cell_texts = []
+        self.payload_handler = PayloadHandler()
 
     def index(self):
         """Return an HTTP-based Read-Eval-Print-Loop terminal."""
@@ -69,6 +72,17 @@
             return
         return open(pp).read()
 
+    def execute(self, code):
+        self.executed_cell_texts.append(code)
+        result = ProgrammaticREPL.execute(self, code)
+        payloads = self.payload_handler.deliver_payloads()
+        return_value = {'output': result,
+                        'payloads': payloads}
+        return return_value
+
+    def get_history(self):
+        return self.executed_cell_texts[:]
+
 class ExtDirectParameterFileList(BottleDirectRouter):
     my_name = "ExtDirectParameterFileList"
     api_url = "pflist"


--- a/yt/gui/reason/html/index.html	Sun Mar 27 12:45:05 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 13:17:59 2011 -0400
@@ -56,7 +56,7 @@
         if (a.result == null) {
             text = "ERROR";
         } else {
-            text = a.result.replace(/\n/g,"<br/>");
+            text = a.result['output'].replace(/\n/g,"<br/>");
         }
         Ext.get("cell_output").dom.innerHTML +=
         '>>> ' + input_line.getValue() + '<br/>' + text + '<br/>';


http://bitbucket.org/yt_analysis/yt/changeset/2a392d0b0625/
changeset:   r3929:2a392d0b0625
branch:      yt
user:        MatthewTurk
date:        2011-03-27 19:32:30
summary:     Merging
affected #:  1 file (4.4 KB)

Binary file yt/gui/reason/html/images/console.png has changed


Binary file yt/gui/reason/html/images/graph.png has changed


--- a/yt/gui/reason/html/index.html	Sun Mar 27 13:17:59 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 13:32:30 2011 -0400
@@ -21,6 +21,12 @@
     .nav {
         background-image:url(resources/examples/shared/icons/fam/folder_go.png);
     }
+    graph { 
+        background-image:url(images/graph.png) !important; //add images to tabs
+    }
+    console { 
+        background-image:url(images/console.png) !important;
+    }
     #input_line {
         font-family: monospace;
     }
@@ -87,8 +93,20 @@
         },],
     });
 
-    var TestButtonPanel = new Ext.Button(
-        {text:'First Button'}
+    var NorthButton = new Ext.Button(
+        {text : 'North',
+        pageX : 10,
+        pageY : 100
+        }
+    );
+    var EastButton = new Ext.Button(
+        {text:'East'}
+    );
+    var SouthButton = new Ext.Button(
+        {text:'South'}
+    );
+    var WestButton = new Ext.Button(
+        {text:'West'}
     );
 
     Ext.onReady(function(){
@@ -173,27 +191,35 @@
             // in this instance the TabPanel is not wrapped by another panel
             // since no title is needed, this Panel is added directly
             // as a Container
-            new Ext.TabPanel({
+//            new Ext.TabPanel({
+            {
+                xtype: 'tabpanel',
                 region: 'center', // a center region is ALWAYS required for border layout
                 id: 'center-panel',
                 deferredRender: false,
                 activeTab: 0,     // first tab initially active
                 items: [{
                     title: 'YT',
+                    iconCls: 'console',
                     closable: false,
                     autoScroll: true,
-                    items: [TestButtonPanel, 
-                    { title: 'Output',
-                      html: "",
-                      id: "cell_output",
+                    iconCls: 'console',
+                    items: [{ 
+                        title: 'Output',
+                        html: "",
+                        id: "cell_output",
                     }, repl_input, ]
                 }, {
                     contentEl: 'center2',
-                    title: 'Widget 1',
+                    title: 'Plot Window 1',
+                    iconCls: 'graph',
                     closable: true,
-                    autoScroll: true
+                    autoScroll: true,
+                    items: [NorthButton]
+                        
                 }]
-            })]
+//            })]
+            }]
         });
         // get a reference to the HTML element with id "hideit" and add a click listener to it 
         Ext.get("hideit").on('click', function(){
@@ -212,17 +238,8 @@
     </div><div id="center2" class="x-hide-display"><a id="hideit" href="#">Toggle the west region</a>
-        <p>My closable attribute is set to false so you can't close me. The other center panels can be closed.</p>
-        <p>The center panel automatically grows to fit the remaining space in the container that isn't taken up by the border regions.</p><hr>
-        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna. Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit. Quisque dolor magna, ornare sed, elementum porta, luctus in, leo.</p>
-        <p>Donec quis dui. Sed imperdiet. Nunc consequat, est eu sollicitudin gravida, mauris ligula lacinia mauris, eu porta dui nisl in velit. Nam congue, odio id auctor nonummy, augue lectus euismod nunc, in tristique turpis dolor sed urna. Donec sit amet quam eget diam fermentum pharetra. Integer tincidunt arcu ut purus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla blandit malesuada odio. Nam augue. Aenean molestie sapien in mi. Suspendisse tincidunt. Pellentesque tempus dui vitae sapien. Donec aliquam ipsum sit amet pede. Sed scelerisque mi a erat. Curabitur rutrum ullamcorper risus. Maecenas et lorem ut felis dictum viverra. Fusce sem. Donec pharetra nibh sit amet sapien.</p>
-        <p>Aenean ut orci sed ligula consectetuer pretium. Aliquam odio. Nam pellentesque enim. Nam tincidunt condimentum nisi. Maecenas convallis luctus ligula. Donec accumsan ornare risus. Vestibulum id magna a nunc posuere laoreet. Integer iaculis leo vitae nibh. Nam vulputate, mauris vitae luctus pharetra, pede neque bibendum tellus, facilisis commodo diam nisi eget lacus. Duis consectetuer pulvinar nisi. Cras interdum ultricies sem. Nullam tristique. Suspendisse elementum purus eu nisl. Nulla facilisi. Phasellus ultricies ullamcorper lorem. Sed euismod ante vitae lacus. Nam nunc leo, congue vehicula, luctus ac, tempus non, ante. Morbi suscipit purus a nulla. Sed eu diam.</p>
-        <p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras imperdiet felis id velit. Ut non quam at sem dictum ullamcorper. Vestibulum pharetra purus sed pede. Aliquam ultrices, nunc in varius mattis, felis justo pretium magna, eget laoreet justo eros id eros. Aliquam elementum diam fringilla nulla. Praesent laoreet sapien vel metus. Cras tempus, sapien condimentum dictum dapibus, lorem augue fringilla orci, ut tincidunt eros nisi eget turpis. Nullam nunc nunc, eleifend et, dictum et, pharetra a, neque. Ut feugiat. Aliquam erat volutpat. Donec pretium odio nec felis. Phasellus sagittis lacus eget sapien. Donec est. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p>
-        <p>Vestibulum semper. Nullam non odio. Aliquam quam. Mauris eu lectus non nunc auctor ullamcorper. Sed tincidunt molestie enim. Phasellus lobortis justo sit amet quam. Duis nulla erat, varius a, cursus in, tempor sollicitudin, mauris. Aliquam mi velit, consectetuer mattis, consequat tristique, pulvinar ac, nisl. Aliquam mattis vehicula elit. Proin quis leo sed tellus scelerisque molestie. Quisque luctus. Integer mattis. Donec id augue sed leo aliquam egestas. Quisque in sem. Donec dictum enim in dolor. Praesent non erat. Nulla ultrices vestibulum quam.</p><p>Duis hendrerit, est vel lobortis sagittis, tortor erat scelerisque tortor, sed pellentesque sem enim id metus. Maecenas at pede. Nulla velit libero, dictum at, mattis quis, sagittis vel, ante. Phasellus faucibus rutrum dui. Cras mauris elit, bibendum at, feugiat non, porta id, neque. Nulla et felis nec odio mollis vehicula. Donec elementum tincidunt mauris. Duis vel dui. Fusce iaculis enim ac nulla. In risus.</p>
-        <p>Donec gravida. Donec et enim. Morbi sollicitudin, lacus a facilisis pulvinar, odio turpis dapibus elit, in tincidunt turpis felis nec libero. Nam vestibulum tempus ipsum. In hac habitasse platea dictumst. Nulla facilisi. Donec semper ligula. Donec commodo tortor in quam. Etiam massa. Ut tempus ligula eget tellus. Curabitur id velit ut velit varius commodo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla facilisi. Fusce ornare pellentesque libero. Nunc rhoncus. Suspendisse potenti. Ut consequat, leo eu accumsan vehicula, justo sem lobortis elit, ac sollicitudin ipsum neque nec ante.</p>
-        <p>Aliquam elementum mauris id sem. Vivamus varius, est ut nonummy consectetuer, nulla quam bibendum velit, ac gravida nisi felis sit amet urna. Aliquam nec risus. Maecenas lacinia purus ut velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse sit amet dui vitae lacus fermentum sodales. Donec varius dapibus nisl. Praesent at velit id risus convallis bibendum. Aliquam felis nibh, rutrum nec, blandit non, mattis sit amet, magna. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam varius dignissim nibh. Quisque id orci ac ante hendrerit molestie. Aliquam malesuada enim non neque.</p></div><div id="props-panel" class="x-hide-display" style="width:200px;height:200px;overflow:hidden;"></div>


http://bitbucket.org/yt_analysis/yt/changeset/7eec65c40020/
changeset:   r3930:7eec65c40020
branch:      yt
user:        MatthewTurk
date:        2011-03-27 19:42:09
summary:     Adding a 'serve' command
affected #:  1 file (436 bytes)

--- a/yt/utilities/command_line.py	Sun Mar 27 13:32:30 2011 -0400
+++ b/yt/utilities/command_line.py	Sun Mar 27 13:42:09 2011 -0400
@@ -908,6 +908,19 @@
         print
         print "Good luck!"
 
+    def do_serve(self, subcmd, opts):
+        """
+        Run the Web GUI
+        """
+        from yt.config import ytcfg;ytcfg["yt","__withinreason"]="True"
+        import yt.gui.reason.bottle as bottle
+        from yt.gui.reason.extdirect_repl import ExtDirectREPL
+        from yt.gui.reason.bottle_mods import uuid_serve_functions
+
+        hr = ExtDirectREPL()
+        bottle.debug()
+        uuid_serve_functions(open_browser=True)
+
 def run_main():
     for co in ["--parallel", "--paste"]:
         if co in sys.argv: del sys.argv[sys.argv.index(co)]


http://bitbucket.org/yt_analysis/yt/changeset/4a925e7c5f2b/
changeset:   r3931:4a925e7c5f2b
branch:      yt
user:        jsoishi
date:        2011-03-27 19:29:48
summary:     added __withinreason flag to ytcfg; use this to trigger generation of binary strings being read out of plot files on PlotCollection save method.
affected #:  2 files (253 bytes)

--- a/yt/config.py	Sun Mar 27 11:08:07 2011 -0400
+++ b/yt/config.py	Sun Mar 27 10:29:48 2011 -0700
@@ -36,6 +36,7 @@
     suppressstreamlogging = 'False',
     loglevel = '20',
     inline = 'False',
+    __withinreason = 'False',
     __parallel = 'False',
     __parallel_rank = '0',
     __parallel_size = '1',


--- a/yt/visualization/plot_collection.py	Sun Mar 27 11:08:07 2011 -0400
+++ b/yt/visualization/plot_collection.py	Sun Mar 27 10:29:48 2011 -0700
@@ -28,6 +28,7 @@
 
 from yt.funcs import *
 
+from yt.config import ytcfg
 from yt.data_objects.profiles import \
     BinnedProfile1D, \
     BinnedProfile2D
@@ -155,7 +156,13 @@
             fn.append(plot.save_image(basename, format=format, 
                       override=override, force_save=force_save))
             mylog.info("Saved %s", fn[-1])
-        return fn
+        if ytcfg.getboolean("yt", "__withinreason"):
+            strs = []
+            for f in fn:
+                strs.append(open(f,'rb').read())
+            return fn, strs
+        else:
+            return fn
 
     def set_xlim(self, xmin, xmax):
         r"""Set the x-limits of all plots.


http://bitbucket.org/yt_analysis/yt/changeset/692d3505909c/
changeset:   r3932:692d3505909c
branch:      yt
user:        jsoishi
date:        2011-03-27 19:35:29
summary:     merged.
affected #:  1 file (0 bytes)

--- a/yt/gui/reason/bottle_mods.py	Sun Mar 27 10:29:48 2011 -0700
+++ b/yt/gui/reason/bottle_mods.py	Sun Mar 27 10:35:29 2011 -0700
@@ -31,6 +31,7 @@
 
 route_functions = {}
 route_watchers = []
+payloads = []
 
 def preroute(future_route, *args, **kwargs):
     def router(func):
@@ -41,6 +42,25 @@
 def notify_route(watcher):
     route_watchers.append(watcher)
 
+class PayloadHandler(object):
+    _shared_state = {}
+
+    def __new__(cls, *p, **k):
+        self = object.__new__(cls, *p, **k)
+        self.__dict__ = cls._shared_state
+        return self
+
+    def __init__(self):
+        self.payloads = []
+
+    def deliver_payloads(self):
+        payloads = self.payloads
+        self.payloads = []
+        return payloads
+
+    def add_payload(self, to_add):
+        self.payloads.append(to_add)
+
 class BottleDirectRouter(DirectRouter):
     # This class implements a mechanism for auto-routing an ExtDirect-callable
     # object through Bottle.  It should be used as a base class of an object,
@@ -48,10 +68,11 @@
     # 'route' for it to work.
     _route_prefix = None
     def __init__(self, *args, **kwargs):
-        future_route = kwargs.pop("route")
+        future_route = self.api_url
         super(BottleDirectRouter, self).__init__(*args, **kwargs)
         self.__name__ = str(self.my_name)
         route_functions[future_route] = ((), {'method':"POST"}, self)
+        preroute("/resources/ext-%s-api.js" % self.api_url, method="GET")(self._myapi)
         notify_route(self)
 
     def _myapi(self):


--- a/yt/gui/reason/extdirect_repl.py	Sun Mar 27 10:29:48 2011 -0700
+++ b/yt/gui/reason/extdirect_repl.py	Sun Mar 27 10:35:29 2011 -0700
@@ -27,7 +27,8 @@
 import json
 import os
 
-from .bottle_mods import preroute, BottleDirectRouter, notify_route
+from .bottle_mods import preroute, BottleDirectRouter, notify_route, \
+                         PayloadHandler
 from .basic_repl import ProgrammaticREPL
 
 local_dir = os.path.dirname(__file__)
@@ -50,9 +51,11 @@
                               )
         for v, args in preroute_table.items():
             preroute(args[0], method=args[1])(getattr(self, v))
-        notify_route(self)
         self.api_url = "repl"
-        BottleDirectRouter.__init__(self, route="/repl")
+        BottleDirectRouter.__init__(self)
+        self.pflist = ExtDirectParameterFileList()
+        self.executed_cell_texts = []
+        self.payload_handler = PayloadHandler()
 
     def index(self):
         """Return an HTTP-based Read-Eval-Print-Loop terminal."""
@@ -68,3 +71,23 @@
             response.status = 404
             return
         return open(pp).read()
+
+    def execute(self, code):
+        self.executed_cell_texts.append(code)
+        result = ProgrammaticREPL.execute(self, code)
+        payloads = self.payload_handler.deliver_payloads()
+        return_value = {'output': result,
+                        'payloads': payloads}
+        return return_value
+
+    def get_history(self):
+        return self.executed_cell_texts[:]
+
+class ExtDirectParameterFileList(BottleDirectRouter):
+    my_name = "ExtDirectParameterFileList"
+    api_url = "pflist"
+
+    def get_list_of_pfs(self):
+        from yt.data_objects.static_output import _cached_pfs
+        names = [str(i) for i in sorted(_cached_pfs.values())]
+        return names


Binary file yt/gui/reason/html/images/console.png has changed


Binary file yt/gui/reason/html/images/graph.png has changed


--- a/yt/gui/reason/html/index.html	Sun Mar 27 10:29:48 2011 -0700
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 10:35:29 2011 -0700
@@ -21,9 +21,18 @@
     .nav {
         background-image:url(resources/examples/shared/icons/fam/folder_go.png);
     }
+    graph { 
+        background-image:url(images/graph.png) !important; //add images to tabs
+    }
+    console { 
+        background-image:url(images/console.png) !important;
+    }
     #input_line {
         font-family: monospace;
     }
+    #cell_output {
+        font-family: monospace;
+    }
     </style><!-- GC -->
@@ -36,6 +45,7 @@
     <!-- EXAMPLES --><script type="text/javascript" src="resources/examples/shared/examples.js"></script><script type="text/javascript" src="resources/ext-repl-api.js"></script>
+    <script type="text/javascript" src="resources/ext-pflist-api.js"></script><script type="text/javascript">
     var viewport;
@@ -52,9 +62,9 @@
         if (a.result == null) {
             text = "ERROR";
         } else {
-            text = a.result.replace(/\n/g,"<br/>");
+            text = a.result['output'].replace(/\n/g,"<br/>");
         }
-        Ext.get("output").dom.innerHTML +=
+        Ext.get("cell_output").dom.innerHTML +=
         '>>> ' + input_line.getValue() + '<br/>' + text + '<br/>';
         input_line.setValue("");
         cell_finished();
@@ -83,14 +93,71 @@
         },],
     });
 
+    var NorthButton = new Ext.Button(
+        {text : 'North',
+        pageX : 10,
+        pageY : 100
+        }
+    );
+    var EastButton = new Ext.Button(
+        {text:'East'}
+    );
+    var SouthButton = new Ext.Button(
+        {text:'South'}
+    );
+    var WestButton = new Ext.Button(
+        {text:'West'}
+    );
+
     Ext.onReady(function(){
-    
+
+Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
+
         // NOTE: This is an example showing simple state management. During development,
         // it is generally best to disable state management as dynamically-generated ids
         // can change across page loads, leading to unpredictable results.  The developer
         // should ensure that stable state ids are set for stateful components in real apps.
         Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
-        
+
+var children = [{
+     text:'pf1',
+     expanded: true,
+     children:[{
+         text:'sphere',
+         leaf:true
+    },{
+         text:'region'
+        ,leaf:true
+    }]
+},{
+     text:'pf2',
+     expanded: true,
+     children:[{
+         text:'all_data'
+        ,leaf:true
+    }]
+ 
+}];
+
+	// Go ahead and create the TreePanel now so that we can use it below
+    var treePanel = new Ext.tree.TreePanel({
+     loader:new Ext.tree.TreeLoader(),
+        iconCls: 'nav',
+    	id: 'tree-panel',
+    	title: 'Objects',
+        region:'west',
+        split: true,
+        minSize: 150,
+        autoScroll: true,
+        rootVisible: false,
+        root:new Ext.tree.AsyncTreeNode({
+          expanded:true
+         ,leaf:false
+         ,text:''
+         ,children:children
+     })
+     });
+
         viewport = new Ext.Viewport({
             layout: 'border',
             items: [
@@ -119,37 +186,40 @@
                     type: 'accordion',
                     animate: true
                 },
-                items: [{
-                    contentEl: 'west',
-                    title: 'Objects',
-                    border: false,
-                    iconCls: 'nav' // see the HEAD section for style used
-                }]
+                items: [treePanel]
             },
             // in this instance the TabPanel is not wrapped by another panel
             // since no title is needed, this Panel is added directly
             // as a Container
-            new Ext.TabPanel({
+//            new Ext.TabPanel({
+            {
+                xtype: 'tabpanel',
                 region: 'center', // a center region is ALWAYS required for border layout
                 id: 'center-panel',
                 deferredRender: false,
                 activeTab: 0,     // first tab initially active
                 items: [{
                     title: 'YT',
+                    iconCls: 'console',
                     closable: false,
                     autoScroll: true,
-                    items: [{
-                       title: 'Output',
-                       html: "",
-                       id: "output",
+                    iconCls: 'console',
+                    items: [{ 
+                        title: 'Output',
+                        html: "",
+                        id: "cell_output",
                     }, repl_input, ]
                 }, {
                     contentEl: 'center2',
-                    title: 'Widget 1',
+                    title: 'Plot Window 1',
+                    iconCls: 'graph',
                     closable: true,
-                    autoScroll: true
+                    autoScroll: true,
+                    items: [NorthButton]
+                        
                 }]
-            })]
+//            })]
+            }]
         });
         // get a reference to the HTML element with id "hideit" and add a click listener to it 
         Ext.get("hideit").on('click', function(){
@@ -168,17 +238,8 @@
     </div><div id="center2" class="x-hide-display"><a id="hideit" href="#">Toggle the west region</a>
-        <p>My closable attribute is set to false so you can't close me. The other center panels can be closed.</p>
-        <p>The center panel automatically grows to fit the remaining space in the container that isn't taken up by the border regions.</p><hr>
-        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna. Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit. Quisque dolor magna, ornare sed, elementum porta, luctus in, leo.</p>
-        <p>Donec quis dui. Sed imperdiet. Nunc consequat, est eu sollicitudin gravida, mauris ligula lacinia mauris, eu porta dui nisl in velit. Nam congue, odio id auctor nonummy, augue lectus euismod nunc, in tristique turpis dolor sed urna. Donec sit amet quam eget diam fermentum pharetra. Integer tincidunt arcu ut purus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla blandit malesuada odio. Nam augue. Aenean molestie sapien in mi. Suspendisse tincidunt. Pellentesque tempus dui vitae sapien. Donec aliquam ipsum sit amet pede. Sed scelerisque mi a erat. Curabitur rutrum ullamcorper risus. Maecenas et lorem ut felis dictum viverra. Fusce sem. Donec pharetra nibh sit amet sapien.</p>
-        <p>Aenean ut orci sed ligula consectetuer pretium. Aliquam odio. Nam pellentesque enim. Nam tincidunt condimentum nisi. Maecenas convallis luctus ligula. Donec accumsan ornare risus. Vestibulum id magna a nunc posuere laoreet. Integer iaculis leo vitae nibh. Nam vulputate, mauris vitae luctus pharetra, pede neque bibendum tellus, facilisis commodo diam nisi eget lacus. Duis consectetuer pulvinar nisi. Cras interdum ultricies sem. Nullam tristique. Suspendisse elementum purus eu nisl. Nulla facilisi. Phasellus ultricies ullamcorper lorem. Sed euismod ante vitae lacus. Nam nunc leo, congue vehicula, luctus ac, tempus non, ante. Morbi suscipit purus a nulla. Sed eu diam.</p>
-        <p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras imperdiet felis id velit. Ut non quam at sem dictum ullamcorper. Vestibulum pharetra purus sed pede. Aliquam ultrices, nunc in varius mattis, felis justo pretium magna, eget laoreet justo eros id eros. Aliquam elementum diam fringilla nulla. Praesent laoreet sapien vel metus. Cras tempus, sapien condimentum dictum dapibus, lorem augue fringilla orci, ut tincidunt eros nisi eget turpis. Nullam nunc nunc, eleifend et, dictum et, pharetra a, neque. Ut feugiat. Aliquam erat volutpat. Donec pretium odio nec felis. Phasellus sagittis lacus eget sapien. Donec est. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p>
-        <p>Vestibulum semper. Nullam non odio. Aliquam quam. Mauris eu lectus non nunc auctor ullamcorper. Sed tincidunt molestie enim. Phasellus lobortis justo sit amet quam. Duis nulla erat, varius a, cursus in, tempor sollicitudin, mauris. Aliquam mi velit, consectetuer mattis, consequat tristique, pulvinar ac, nisl. Aliquam mattis vehicula elit. Proin quis leo sed tellus scelerisque molestie. Quisque luctus. Integer mattis. Donec id augue sed leo aliquam egestas. Quisque in sem. Donec dictum enim in dolor. Praesent non erat. Nulla ultrices vestibulum quam.</p><p>Duis hendrerit, est vel lobortis sagittis, tortor erat scelerisque tortor, sed pellentesque sem enim id metus. Maecenas at pede. Nulla velit libero, dictum at, mattis quis, sagittis vel, ante. Phasellus faucibus rutrum dui. Cras mauris elit, bibendum at, feugiat non, porta id, neque. Nulla et felis nec odio mollis vehicula. Donec elementum tincidunt mauris. Duis vel dui. Fusce iaculis enim ac nulla. In risus.</p>
-        <p>Donec gravida. Donec et enim. Morbi sollicitudin, lacus a facilisis pulvinar, odio turpis dapibus elit, in tincidunt turpis felis nec libero. Nam vestibulum tempus ipsum. In hac habitasse platea dictumst. Nulla facilisi. Donec semper ligula. Donec commodo tortor in quam. Etiam massa. Ut tempus ligula eget tellus. Curabitur id velit ut velit varius commodo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla facilisi. Fusce ornare pellentesque libero. Nunc rhoncus. Suspendisse potenti. Ut consequat, leo eu accumsan vehicula, justo sem lobortis elit, ac sollicitudin ipsum neque nec ante.</p>
-        <p>Aliquam elementum mauris id sem. Vivamus varius, est ut nonummy consectetuer, nulla quam bibendum velit, ac gravida nisi felis sit amet urna. Aliquam nec risus. Maecenas lacinia purus ut velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse sit amet dui vitae lacus fermentum sodales. Donec varius dapibus nisl. Praesent at velit id risus convallis bibendum. Aliquam felis nibh, rutrum nec, blandit non, mattis sit amet, magna. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam varius dignissim nibh. Quisque id orci ac ante hendrerit molestie. Aliquam malesuada enim non neque.</p></div><div id="props-panel" class="x-hide-display" style="width:200px;height:200px;overflow:hidden;"></div>


--- a/yt/gui/reason/httprepl.html	Sun Mar 27 10:29:48 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-<html>
-<head>
-  <title>yt</title>
-	<link rel="stylesheet" type="text/css" href="resources/ext-all.css" />
-
-    <!-- GC -->
- 	<!-- LIBS -->
- 	<script type="text/javascript" src="resources/ext-base.js"></script>
- 	<!-- ENDLIBS -->
-
-    <script type="text/javascript" src="resources/ext-all.js"></script>
-    <script type="text/javascript" src="resources/ext-repl-api.js"></script>
-
-	<style type="text/css">
-	html, body {
-        font:normal 12px verdana;
-        margin:0;
-        padding:0;
-        border:0 none;
-        overflow:hidden;
-        height:100%;
-    }
-	.x-panel-body p {
-	    margin:5px;
-	}
-    .x-column-layout-ct .x-panel {
-        margin-bottom:5px;
-    }
-    .x-column-layout-ct .x-panel-dd-spacer {
-        margin-bottom:5px;
-    }
-    .settings {
-        background-image:url(resources/folder_wrench.png) !important;
-    }
-    .nav {
-        background-image:url(resources/folder_go.png) !important;
-    }
-    #input_line {
-        font-family: monospace;
-    }
-    </style>
-	<script type="text/javascript">
-    function cell_sent() {
-        repl_input.get('input_line').setReadOnly(true);
-    }
-
-    function cell_finished() {
-        repl_input.get('input_line').setReadOnly(false);
-    }
-
-    var handle_result = function(f, a) {
-        var input_line = repl_input.get("input_line")
-        if (a.result == null) {
-            text = "ERROR";
-        } else {
-            text = a.result.replace(/\n/g,"<br/>");
-        }
-        Ext.get("output").dom.innerHTML +=
-        '>>> ' + input_line.getValue() + '<br/>' + text + '<br/>';
-        input_line.setValue("");
-        cell_finished();
-    }
-
-    var repl_input = new Ext.FormPanel({
-        url: 'push',
-        items: [{
-            id: 'input_line',
-            xtype: 'textarea',
-            width: '100%',
-            fieldLabel: '>>>',
-            name: 'line',
-            allowBlank: 'True',
-            bodyStyle: 'font-family: "monospace";',
-            listeners: {
-                specialkey: function(f, e){
-                    if (e.getKey() == e.ENTER) {
-                        cell_sent();
-                        yt_rpc.ExtDirectREPL.execute({
-                            code:repl_input.get('input_line').getValue()},
-                            handle_result);
-                    }
-                }
-            },
-        },],
-    });
-
-    Ext.onReady(function(){
-
-       // NOTE: This is an example showing simple state management. During development,
-       // it is generally best to disable state management as dynamically-generated ids
-       // can change across page loads, leading to unpredictable results.  The developer
-       // should ensure that stable state ids are set for stateful components in real apps.
-       Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
-
-       var viewport = new Ext.Viewport({
-            layout:'border',
-            items:[{
-                region:'west',
-                id:'west-panel',
-                title:'West',
-                split:true,
-                width: 200,
-                minSize: 175,
-                maxSize: 400,
-                collapsible: true,
-                margins:'35 0 5 5',
-                cmargins:'35 5 5 5',
-                layout:'accordion',
-                layoutConfig:{
-                    animate:true
-                },
-                items: [{
-                    html: Ext.example.shortBogusMarkup,
-                    title:'Navigation',
-                    autoScroll:true,
-                    border:false,
-                    iconCls:'nav'
-                },{
-                    title:'Settings',
-                    html: Ext.example.shortBogusMarkup,
-                    border:false,
-                    autoScroll:true,
-                    iconCls:'settings'
-                }]
-            },{
-                region:'center',
-                margins:'35 5 5 0',
-                layout:'column',
-                autoScroll:true,
-                items:[{
-                    columnWidth:1.0,
-                    baseCls:'x-plain',
-                    bodyStyle:'padding:5px 0 5px 5px; font-family: monospace;',
-                    items:[{
-                       title: 'Output',
-                       html: "",
-                       id: "output",
-                    }, repl_input, ]
-                },]
-            }]
-        });
-    Ext.get("output").dom.innerHTML += 'Welcome to the yt web interface.<br/>';
-    }
-    
-    );
-	</script>
-</head>
-<body>
-<script type="text/javascript" src="resources/examples.js"></script><!-- EXAMPLES -->
-  </body>
-</html>


http://bitbucket.org/yt_analysis/yt/changeset/1c27968c6918/
changeset:   r3933:1c27968c6918
branch:      yt
user:        jsoishi
date:        2011-03-27 19:43:02
summary:     changed __withinreason handling of PlotCollection to use the PayloadHandler. untested.
affected #:  1 file (34 bytes)

--- a/yt/visualization/plot_collection.py	Sun Mar 27 10:35:29 2011 -0700
+++ b/yt/visualization/plot_collection.py	Sun Mar 27 10:43:02 2011 -0700
@@ -157,12 +157,11 @@
                       override=override, force_save=force_save))
             mylog.info("Saved %s", fn[-1])
         if ytcfg.getboolean("yt", "__withinreason"):
-            strs = []
+            from yt.gui.reason.bottle_mods import PayloadHandler
+            ph = PayloadHandler()
             for f in fn:
-                strs.append(open(f,'rb').read())
-            return fn, strs
-        else:
-            return fn
+                ph.add_payload(open(f,'rb').read())
+        return fn
 
     def set_xlim(self, xmin, xmax):
         r"""Set the x-limits of all plots.


http://bitbucket.org/yt_analysis/yt/changeset/c3f2e9c0a97b/
changeset:   r3934:c3f2e9c0a97b
branch:      yt
user:        jsoishi
date:        2011-03-27 19:45:40
summary:     merged
affected #:  0 files (0 bytes)

--- a/yt/utilities/command_line.py	Sun Mar 27 10:43:02 2011 -0700
+++ b/yt/utilities/command_line.py	Sun Mar 27 10:45:40 2011 -0700
@@ -908,6 +908,19 @@
         print
         print "Good luck!"
 
+    def do_serve(self, subcmd, opts):
+        """
+        Run the Web GUI
+        """
+        from yt.config import ytcfg;ytcfg["yt","__withinreason"]="True"
+        import yt.gui.reason.bottle as bottle
+        from yt.gui.reason.extdirect_repl import ExtDirectREPL
+        from yt.gui.reason.bottle_mods import uuid_serve_functions
+
+        hr = ExtDirectREPL()
+        bottle.debug()
+        uuid_serve_functions(open_browser=True)
+
 def run_main():
     for co in ["--parallel", "--paste"]:
         if co in sys.argv: del sys.argv[sys.argv.index(co)]


http://bitbucket.org/yt_analysis/yt/changeset/8d3b5176044d/
changeset:   r3935:8d3b5176044d
branch:      yt
user:        jsoishi
date:        2011-03-27 19:49:34
summary:     only add pngs to the PayloadHandler
affected #:  1 file (42 bytes)

--- a/yt/visualization/plot_collection.py	Sun Mar 27 10:45:40 2011 -0700
+++ b/yt/visualization/plot_collection.py	Sun Mar 27 10:49:34 2011 -0700
@@ -160,7 +160,8 @@
             from yt.gui.reason.bottle_mods import PayloadHandler
             ph = PayloadHandler()
             for f in fn:
-                ph.add_payload(open(f,'rb').read())
+                if f.endswith('png'):
+                    ph.add_payload(open(f,'rb').read())
         return fn
 
     def set_xlim(self, xmin, xmax):


http://bitbucket.org/yt_analysis/yt/changeset/8f654ccb92d9/
changeset:   r3936:8f654ccb92d9
branch:      yt
user:        MatthewTurk
date:        2011-03-27 19:54:28
summary:     Added payload handling and encoding in the PC
affected #:  2 files (518 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 10:49:34 2011 -0700
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 13:54:28 2011 -0400
@@ -53,7 +53,14 @@
         repl_input.get('input_line').setReadOnly(true);
     }
 
-    function cell_finished() {
+    function cell_finished(result) {
+        Ext.each(result['payloads'], function(payload, index) {
+            if (payload['type'] == 'image_string') {
+                Ext.get("cell_output").dom.innerHTML +=
+                    '<br/><img src="data:image/png;base64,' +
+                        payload['image_data'] + '"/>';
+            }
+        });
         repl_input.get('input_line').setReadOnly(false);
     }
 
@@ -67,7 +74,7 @@
         Ext.get("cell_output").dom.innerHTML +=
         '>>> ' + input_line.getValue() + '<br/>' + text + '<br/>';
         input_line.setValue("");
-        cell_finished();
+        cell_finished(a.result);
     }
 
     var repl_input = new Ext.FormPanel({


--- a/yt/visualization/plot_collection.py	Sun Mar 27 10:49:34 2011 -0700
+++ b/yt/visualization/plot_collection.py	Sun Mar 27 13:54:28 2011 -0400
@@ -158,10 +158,14 @@
             mylog.info("Saved %s", fn[-1])
         if ytcfg.getboolean("yt", "__withinreason"):
             from yt.gui.reason.bottle_mods import PayloadHandler
+            import base64
             ph = PayloadHandler()
             for f in fn:
-                if f.endswith('png'):
-                    ph.add_payload(open(f,'rb').read())
+                if not f.endswith('png'): continue
+                img_data = base64.b64encode(open(f,'rb').read())
+                payload = {'type':'image_string',
+                           'image_data':img_data}
+                ph.add_payload(payload)
         return fn
 
     def set_xlim(self, xmin, xmax):


http://bitbucket.org/yt_analysis/yt/changeset/e6bb15bf8433/
changeset:   r3937:e6bb15bf8433
branch:      yt
user:        Cameron Hummels
date:        2011-03-27 19:59:36
summary:     Bringing everything up to date with my copy.
affected #:  1 file (51 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 13:54:28 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 13:59:36 2011 -0400
@@ -198,7 +198,6 @@
             // in this instance the TabPanel is not wrapped by another panel
             // since no title is needed, this Panel is added directly
             // as a Container
-//            new Ext.TabPanel({
             {
                 xtype: 'tabpanel',
                 region: 'center', // a center region is ALWAYS required for border layout
@@ -225,7 +224,6 @@
                     items: [NorthButton]
                         
                 }]
-//            })]
             }]
         });
         // get a reference to the HTML element with id "hideit" and add a click listener to it 


http://bitbucket.org/yt_analysis/yt/changeset/dfa6314b6ea9/
changeset:   r3938:dfa6314b6ea9
branch:      yt
user:        Cameron Hummels
date:        2011-03-28 01:10:29
summary:     Addition of buttons.
affected #:  1 file (263 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 13:59:36 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 19:10:29 2011 -0400
@@ -102,12 +102,17 @@
 
     var NorthButton = new Ext.Button(
         {text : 'North',
-        pageX : 10,
-        pageY : 100
+ //       pageX : 10,
+//        pageY : 50
+        anchor:'10% 5%'
         }
     );
+
     var EastButton = new Ext.Button(
-        {text:'East'}
+        {text:'East',
+//        pageX : '100%',
+ //       pageY : '50%'
+        }
     );
     var SouthButton = new Ext.Button(
         {text:'South'}
@@ -116,6 +121,17 @@
         {text:'West'}
     );
 
+    var PlotPanel = new Ext.Panel(
+        {layout: 'anchor',
+        title: 'Plot Window 1',
+        width:400,
+        height:400,
+        items:[
+            NorthButton, 
+            EastButton]
+        }
+    );
+
     Ext.onReady(function(){
 
 Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
@@ -216,12 +232,11 @@
                         id: "cell_output",
                     }, repl_input, ]
                 }, {
-                    contentEl: 'center2',
                     title: 'Plot Window 1',
                     iconCls: 'graph',
                     closable: true,
                     autoScroll: true,
-                    items: [NorthButton]
+                    items: [ PlotPanel ]
                         
                 }]
             }]


http://bitbucket.org/yt_analysis/yt/changeset/0ba57fd95963/
changeset:   r3939:0ba57fd95963
branch:      yt
user:        jsoishi
date:        2011-03-27 20:51:16
summary:     PlotWindow now properly respects log status of fields. Additionally, an arbitrary transform can be specified for each field.
affected #:  1 file (858 bytes)

--- a/yt/visualization/plot_window.py	Sun Mar 27 13:59:36 2011 -0400
+++ b/yt/visualization/plot_window.py	Sun Mar 27 11:51:16 2011 -0700
@@ -24,6 +24,7 @@
 """
 
 import tempfile
+import numpy as na
 import color_maps
 from image_writer import \
     write_image, apply_colormap
@@ -38,7 +39,8 @@
         args[0]._data_valid = False
         args[0]._plot_valid = False
         args[0]._recreate_frb()
-        return args[0]._setup_plots()
+        if args[0]._initfinished:
+            return args[0]._setup_plots()
 
     return newfunc
 
@@ -80,11 +82,13 @@
             rendering is used during data deposition.
 
         """
+        self._initfinished = False
         self.plots = {}
         self.data_source = data_source
         self.buff_size = buff_size
         self.antialias = True
         self.set_window(bounds) # this automatically updates the data and plot
+        self._initfinished = True
 
     def __getitem__(self, item):
         return self.plots[item]
@@ -180,11 +184,34 @@
     """A viewer for the web interface.
 
     """
+    def __init__(self, *args,**kwargs):
+        PlotWindow.__init__(self, *args,**kwargs)
+        self._field_transform = {}
+        for field in self._frb.data.keys():
+            if self._frb.pf.field_info[field].take_log:
+                self._field_transform[field] = na.log
+            else:
+                self._field_transform[field] = lambda x: x
+
+        self._setup_plots()
+
+    def set_log(self,field,log):
+        """set a field to log or linear.
+
+        """
+        if log:
+            self._field_transform[field] = na.log
+        else:
+            self._field_transform[field] = lambda x: x
+
+    def set_transform(self, field, func):
+        self._field_transform[field] = func
+
     def _setup_plots(self):
         plots = []
         for field in self._frb.data.keys():
             tf = tempfile.TemporaryFile()
-            to_plot = apply_colormap(self._frb[field])
+            to_plot = apply_colormap(self._frb[field],func = self._field_transform[field])
             write_png_to_file(to_plot, tf)
             tf.seek(0)
             s = tf.read()


http://bitbucket.org/yt_analysis/yt/changeset/b1c702194bdf/
changeset:   r3940:b1c702194bdf
branch:      yt
user:        brittonsmith
date:        2011-03-27 22:44:38
summary:     Added pf tree loader.
affected #:  1 file (404 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 11:41:37 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 16:44:38 2011 -0400
@@ -39,6 +39,8 @@
     <!-- EXAMPLES --><script type="text/javascript" src="resources/examples/shared/examples.js"></script><script type="text/javascript" src="resources/ext-repl-api.js"></script>
+
+    <script type="text/javascript" src="pf_data.js"></script><script type="text/javascript">
     var viewport;
@@ -118,8 +120,7 @@
 
 	// Go ahead and create the TreePanel now so that we can use it below
     var treePanel = new Ext.tree.TreePanel({
-     loader:new Ext.tree.TreeLoader(),
-        iconCls: 'nav',
+       iconCls: 'nav',
     	id: 'tree-panel',
     	title: 'Objects',
         region:'west',
@@ -127,14 +128,25 @@
         minSize: 150,
         autoScroll: true,
         rootVisible: false,
-        root:new Ext.tree.AsyncTreeNode({
+        root:new Ext.tree.TreeNode({
           expanded:true
          ,leaf:false
          ,text:''
-         ,children:children
-     })
+        })
      });
 
+     Ext.each(my_pfs, function(pf, index) {
+        treePanel.root.appendChild(new Ext.tree.TreeNode({text: pf.name,
+                                    leaf:false}));
+        this_pf = treePanel.root.lastChild
+        Ext.each(pf.objects, function(object, obj_index) {
+           this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
+                                leaf: true}));
+       });
+   });
+
+
+
         viewport = new Ext.Viewport({
             layout: 'border',
             items: [


http://bitbucket.org/yt_analysis/yt/changeset/45d3551b86f3/
changeset:   r3941:45d3551b86f3
branch:      yt
user:        brittonsmith
date:        2011-03-27 22:47:47
summary:     Merged.
affected #:  2 files (4.0 KB)

--- a/yt/config.py	Sun Mar 27 16:44:38 2011 -0400
+++ b/yt/config.py	Sun Mar 27 16:47:47 2011 -0400
@@ -36,6 +36,7 @@
     suppressstreamlogging = 'False',
     loglevel = '20',
     inline = 'False',
+    __withinreason = 'False',
     __parallel = 'False',
     __parallel_rank = '0',
     __parallel_size = '1',


--- a/yt/gui/reason/bottle_mods.py	Sun Mar 27 16:44:38 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Sun Mar 27 16:47:47 2011 -0400
@@ -31,6 +31,7 @@
 
 route_functions = {}
 route_watchers = []
+payloads = []
 
 def preroute(future_route, *args, **kwargs):
     def router(func):
@@ -41,6 +42,25 @@
 def notify_route(watcher):
     route_watchers.append(watcher)
 
+class PayloadHandler(object):
+    _shared_state = {}
+
+    def __new__(cls, *p, **k):
+        self = object.__new__(cls, *p, **k)
+        self.__dict__ = cls._shared_state
+        return self
+
+    def __init__(self):
+        self.payloads = []
+
+    def deliver_payloads(self):
+        payloads = self.payloads
+        self.payloads = []
+        return payloads
+
+    def add_payload(self, to_add):
+        self.payloads.append(to_add)
+
 class BottleDirectRouter(DirectRouter):
     # This class implements a mechanism for auto-routing an ExtDirect-callable
     # object through Bottle.  It should be used as a base class of an object,
@@ -48,10 +68,11 @@
     # 'route' for it to work.
     _route_prefix = None
     def __init__(self, *args, **kwargs):
-        future_route = kwargs.pop("route")
+        future_route = self.api_url
         super(BottleDirectRouter, self).__init__(*args, **kwargs)
         self.__name__ = str(self.my_name)
         route_functions[future_route] = ((), {'method':"POST"}, self)
+        preroute("/resources/ext-%s-api.js" % self.api_url, method="GET")(self._myapi)
         notify_route(self)
 
     def _myapi(self):


--- a/yt/gui/reason/extdirect_repl.py	Sun Mar 27 16:44:38 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sun Mar 27 16:47:47 2011 -0400
@@ -27,7 +27,8 @@
 import json
 import os
 
-from .bottle_mods import preroute, BottleDirectRouter, notify_route
+from .bottle_mods import preroute, BottleDirectRouter, notify_route, \
+                         PayloadHandler
 from .basic_repl import ProgrammaticREPL
 
 local_dir = os.path.dirname(__file__)
@@ -50,9 +51,11 @@
                               )
         for v, args in preroute_table.items():
             preroute(args[0], method=args[1])(getattr(self, v))
-        notify_route(self)
         self.api_url = "repl"
-        BottleDirectRouter.__init__(self, route="/repl")
+        BottleDirectRouter.__init__(self)
+        self.pflist = ExtDirectParameterFileList()
+        self.executed_cell_texts = []
+        self.payload_handler = PayloadHandler()
 
     def index(self):
         """Return an HTTP-based Read-Eval-Print-Loop terminal."""
@@ -68,3 +71,23 @@
             response.status = 404
             return
         return open(pp).read()
+
+    def execute(self, code):
+        self.executed_cell_texts.append(code)
+        result = ProgrammaticREPL.execute(self, code)
+        payloads = self.payload_handler.deliver_payloads()
+        return_value = {'output': result,
+                        'payloads': payloads}
+        return return_value
+
+    def get_history(self):
+        return self.executed_cell_texts[:]
+
+class ExtDirectParameterFileList(BottleDirectRouter):
+    my_name = "ExtDirectParameterFileList"
+    api_url = "pflist"
+
+    def get_list_of_pfs(self):
+        from yt.data_objects.static_output import _cached_pfs
+        names = [str(i) for i in sorted(_cached_pfs.values())]
+        return names


Binary file yt/gui/reason/html/images/console.png has changed


Binary file yt/gui/reason/html/images/graph.png has changed


--- a/yt/gui/reason/html/index.html	Sun Mar 27 16:44:38 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 16:47:47 2011 -0400
@@ -21,6 +21,12 @@
     .nav {
         background-image:url(resources/examples/shared/icons/fam/folder_go.png);
     }
+    graph { 
+        background-image:url(images/graph.png) !important; //add images to tabs
+    }
+    console { 
+        background-image:url(images/console.png) !important;
+    }
     #input_line {
         font-family: monospace;
     }
@@ -39,16 +45,23 @@
     <!-- EXAMPLES --><script type="text/javascript" src="resources/examples/shared/examples.js"></script><script type="text/javascript" src="resources/ext-repl-api.js"></script>
-
+    <script type="text/javascript" src="resources/ext-pflist-api.js"></script><script type="text/javascript" src="pf_data.js"></script>
-  
+ 
     <script type="text/javascript">
     var viewport;
     function cell_sent() {
         repl_input.get('input_line').setReadOnly(true);
     }
 
-    function cell_finished() {
+    function cell_finished(result) {
+        Ext.each(result['payloads'], function(payload, index) {
+            if (payload['type'] == 'image_string') {
+                Ext.get("cell_output").dom.innerHTML +=
+                    '<br/><img src="data:image/png;base64,' +
+                        payload['image_data'] + '"/>';
+            }
+        });
         repl_input.get('input_line').setReadOnly(false);
     }
 
@@ -57,12 +70,12 @@
         if (a.result == null) {
             text = "ERROR";
         } else {
-            text = a.result.replace(/\n/g,"<br/>");
+            text = a.result['output'].replace(/\n/g,"<br/>");
         }
         Ext.get("cell_output").dom.innerHTML +=
         '>>> ' + input_line.getValue() + '<br/>' + text + '<br/>';
         input_line.setValue("");
-        cell_finished();
+        cell_finished(a.result);
     }
 
     var repl_input = new Ext.FormPanel({
@@ -88,6 +101,22 @@
         },],
     });
 
+    var NorthButton = new Ext.Button(
+        {text : 'North',
+        pageX : 10,
+        pageY : 100
+        }
+    );
+    var EastButton = new Ext.Button(
+        {text:'East'}
+    );
+    var SouthButton = new Ext.Button(
+        {text:'South'}
+    );
+    var WestButton = new Ext.Button(
+        {text:'West'}
+    );
+
     Ext.onReady(function(){
 
 Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
@@ -180,27 +209,33 @@
             // in this instance the TabPanel is not wrapped by another panel
             // since no title is needed, this Panel is added directly
             // as a Container
-            new Ext.TabPanel({
+            {
+                xtype: 'tabpanel',
                 region: 'center', // a center region is ALWAYS required for border layout
                 id: 'center-panel',
                 deferredRender: false,
                 activeTab: 0,     // first tab initially active
                 items: [{
                     title: 'YT',
+                    iconCls: 'console',
                     closable: false,
                     autoScroll: true,
-                    items: [{
-                       title: 'Output',
-                       html: "",
-                       id: "cell_output",
+                    iconCls: 'console',
+                    items: [{ 
+                        title: 'Output',
+                        html: "",
+                        id: "cell_output",
                     }, repl_input, ]
                 }, {
                     contentEl: 'center2',
-                    title: 'Widget 1',
+                    title: 'Plot Window 1',
+                    iconCls: 'graph',
                     closable: true,
-                    autoScroll: true
+                    autoScroll: true,
+                    items: [NorthButton]
+                        
                 }]
-            })]
+            }]
         });
         // get a reference to the HTML element with id "hideit" and add a click listener to it 
         Ext.get("hideit").on('click', function(){
@@ -219,17 +254,8 @@
     </div><div id="center2" class="x-hide-display"><a id="hideit" href="#">Toggle the west region</a>
-        <p>My closable attribute is set to false so you can't close me. The other center panels can be closed.</p>
-        <p>The center panel automatically grows to fit the remaining space in the container that isn't taken up by the border regions.</p><hr>
-        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna. Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit. Quisque dolor magna, ornare sed, elementum porta, luctus in, leo.</p>
-        <p>Donec quis dui. Sed imperdiet. Nunc consequat, est eu sollicitudin gravida, mauris ligula lacinia mauris, eu porta dui nisl in velit. Nam congue, odio id auctor nonummy, augue lectus euismod nunc, in tristique turpis dolor sed urna. Donec sit amet quam eget diam fermentum pharetra. Integer tincidunt arcu ut purus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla blandit malesuada odio. Nam augue. Aenean molestie sapien in mi. Suspendisse tincidunt. Pellentesque tempus dui vitae sapien. Donec aliquam ipsum sit amet pede. Sed scelerisque mi a erat. Curabitur rutrum ullamcorper risus. Maecenas et lorem ut felis dictum viverra. Fusce sem. Donec pharetra nibh sit amet sapien.</p>
-        <p>Aenean ut orci sed ligula consectetuer pretium. Aliquam odio. Nam pellentesque enim. Nam tincidunt condimentum nisi. Maecenas convallis luctus ligula. Donec accumsan ornare risus. Vestibulum id magna a nunc posuere laoreet. Integer iaculis leo vitae nibh. Nam vulputate, mauris vitae luctus pharetra, pede neque bibendum tellus, facilisis commodo diam nisi eget lacus. Duis consectetuer pulvinar nisi. Cras interdum ultricies sem. Nullam tristique. Suspendisse elementum purus eu nisl. Nulla facilisi. Phasellus ultricies ullamcorper lorem. Sed euismod ante vitae lacus. Nam nunc leo, congue vehicula, luctus ac, tempus non, ante. Morbi suscipit purus a nulla. Sed eu diam.</p>
-        <p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras imperdiet felis id velit. Ut non quam at sem dictum ullamcorper. Vestibulum pharetra purus sed pede. Aliquam ultrices, nunc in varius mattis, felis justo pretium magna, eget laoreet justo eros id eros. Aliquam elementum diam fringilla nulla. Praesent laoreet sapien vel metus. Cras tempus, sapien condimentum dictum dapibus, lorem augue fringilla orci, ut tincidunt eros nisi eget turpis. Nullam nunc nunc, eleifend et, dictum et, pharetra a, neque. Ut feugiat. Aliquam erat volutpat. Donec pretium odio nec felis. Phasellus sagittis lacus eget sapien. Donec est. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p>
-        <p>Vestibulum semper. Nullam non odio. Aliquam quam. Mauris eu lectus non nunc auctor ullamcorper. Sed tincidunt molestie enim. Phasellus lobortis justo sit amet quam. Duis nulla erat, varius a, cursus in, tempor sollicitudin, mauris. Aliquam mi velit, consectetuer mattis, consequat tristique, pulvinar ac, nisl. Aliquam mattis vehicula elit. Proin quis leo sed tellus scelerisque molestie. Quisque luctus. Integer mattis. Donec id augue sed leo aliquam egestas. Quisque in sem. Donec dictum enim in dolor. Praesent non erat. Nulla ultrices vestibulum quam.</p><p>Duis hendrerit, est vel lobortis sagittis, tortor erat scelerisque tortor, sed pellentesque sem enim id metus. Maecenas at pede. Nulla velit libero, dictum at, mattis quis, sagittis vel, ante. Phasellus faucibus rutrum dui. Cras mauris elit, bibendum at, feugiat non, porta id, neque. Nulla et felis nec odio mollis vehicula. Donec elementum tincidunt mauris. Duis vel dui. Fusce iaculis enim ac nulla. In risus.</p>
-        <p>Donec gravida. Donec et enim. Morbi sollicitudin, lacus a facilisis pulvinar, odio turpis dapibus elit, in tincidunt turpis felis nec libero. Nam vestibulum tempus ipsum. In hac habitasse platea dictumst. Nulla facilisi. Donec semper ligula. Donec commodo tortor in quam. Etiam massa. Ut tempus ligula eget tellus. Curabitur id velit ut velit varius commodo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla facilisi. Fusce ornare pellentesque libero. Nunc rhoncus. Suspendisse potenti. Ut consequat, leo eu accumsan vehicula, justo sem lobortis elit, ac sollicitudin ipsum neque nec ante.</p>
-        <p>Aliquam elementum mauris id sem. Vivamus varius, est ut nonummy consectetuer, nulla quam bibendum velit, ac gravida nisi felis sit amet urna. Aliquam nec risus. Maecenas lacinia purus ut velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse sit amet dui vitae lacus fermentum sodales. Donec varius dapibus nisl. Praesent at velit id risus convallis bibendum. Aliquam felis nibh, rutrum nec, blandit non, mattis sit amet, magna. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam varius dignissim nibh. Quisque id orci ac ante hendrerit molestie. Aliquam malesuada enim non neque.</p></div><div id="props-panel" class="x-hide-display" style="width:200px;height:200px;overflow:hidden;"></div>


--- a/yt/gui/reason/httprepl.html	Sun Mar 27 16:44:38 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-<html>
-<head>
-  <title>yt</title>
-	<link rel="stylesheet" type="text/css" href="resources/ext-all.css" />
-
-    <!-- GC -->
- 	<!-- LIBS -->
- 	<script type="text/javascript" src="resources/ext-base.js"></script>
- 	<!-- ENDLIBS -->
-
-    <script type="text/javascript" src="resources/ext-all.js"></script>
-    <script type="text/javascript" src="resources/ext-repl-api.js"></script>
-
-	<style type="text/css">
-	html, body {
-        font:normal 12px verdana;
-        margin:0;
-        padding:0;
-        border:0 none;
-        overflow:hidden;
-        height:100%;
-    }
-	.x-panel-body p {
-	    margin:5px;
-	}
-    .x-column-layout-ct .x-panel {
-        margin-bottom:5px;
-    }
-    .x-column-layout-ct .x-panel-dd-spacer {
-        margin-bottom:5px;
-    }
-    .settings {
-        background-image:url(resources/folder_wrench.png) !important;
-    }
-    .nav {
-        background-image:url(resources/folder_go.png) !important;
-    }
-    #input_line {
-        font-family: monospace;
-    }
-    </style>
-	<script type="text/javascript">
-    function cell_sent() {
-        repl_input.get('input_line').setReadOnly(true);
-    }
-
-    function cell_finished() {
-        repl_input.get('input_line').setReadOnly(false);
-    }
-
-    var handle_result = function(f, a) {
-        var input_line = repl_input.get("input_line")
-        if (a.result == null) {
-            text = "ERROR";
-        } else {
-            text = a.result.replace(/\n/g,"<br/>");
-        }
-        Ext.get("output").dom.innerHTML +=
-        '>>> ' + input_line.getValue() + '<br/>' + text + '<br/>';
-        input_line.setValue("");
-        cell_finished();
-    }
-
-    var repl_input = new Ext.FormPanel({
-        url: 'push',
-        items: [{
-            id: 'input_line',
-            xtype: 'textarea',
-            width: '100%',
-            fieldLabel: '>>>',
-            name: 'line',
-            allowBlank: 'True',
-            bodyStyle: 'font-family: "monospace";',
-            listeners: {
-                specialkey: function(f, e){
-                    if (e.getKey() == e.ENTER) {
-                        cell_sent();
-                        yt_rpc.ExtDirectREPL.execute({
-                            code:repl_input.get('input_line').getValue()},
-                            handle_result);
-                    }
-                }
-            },
-        },],
-    });
-
-    Ext.onReady(function(){
-
-       // NOTE: This is an example showing simple state management. During development,
-       // it is generally best to disable state management as dynamically-generated ids
-       // can change across page loads, leading to unpredictable results.  The developer
-       // should ensure that stable state ids are set for stateful components in real apps.
-       Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
-
-       var viewport = new Ext.Viewport({
-            layout:'border',
-            items:[{
-                region:'west',
-                id:'west-panel',
-                title:'West',
-                split:true,
-                width: 200,
-                minSize: 175,
-                maxSize: 400,
-                collapsible: true,
-                margins:'35 0 5 5',
-                cmargins:'35 5 5 5',
-                layout:'accordion',
-                layoutConfig:{
-                    animate:true
-                },
-                items: [{
-                    html: Ext.example.shortBogusMarkup,
-                    title:'Navigation',
-                    autoScroll:true,
-                    border:false,
-                    iconCls:'nav'
-                },{
-                    title:'Settings',
-                    html: Ext.example.shortBogusMarkup,
-                    border:false,
-                    autoScroll:true,
-                    iconCls:'settings'
-                }]
-            },{
-                region:'center',
-                margins:'35 5 5 0',
-                layout:'column',
-                autoScroll:true,
-                items:[{
-                    columnWidth:1.0,
-                    baseCls:'x-plain',
-                    bodyStyle:'padding:5px 0 5px 5px; font-family: monospace;',
-                    items:[{
-                       title: 'Output',
-                       html: "",
-                       id: "output",
-                    }, repl_input, ]
-                },]
-            }]
-        });
-    Ext.get("output").dom.innerHTML += 'Welcome to the yt web interface.<br/>';
-    }
-    
-    );
-	</script>
-</head>
-<body>
-<script type="text/javascript" src="resources/examples.js"></script><!-- EXAMPLES -->
-  </body>
-</html>


--- a/yt/utilities/command_line.py	Sun Mar 27 16:44:38 2011 -0400
+++ b/yt/utilities/command_line.py	Sun Mar 27 16:47:47 2011 -0400
@@ -908,6 +908,19 @@
         print
         print "Good luck!"
 
+    def do_serve(self, subcmd, opts):
+        """
+        Run the Web GUI
+        """
+        from yt.config import ytcfg;ytcfg["yt","__withinreason"]="True"
+        import yt.gui.reason.bottle as bottle
+        from yt.gui.reason.extdirect_repl import ExtDirectREPL
+        from yt.gui.reason.bottle_mods import uuid_serve_functions
+
+        hr = ExtDirectREPL()
+        bottle.debug()
+        uuid_serve_functions(open_browser=True)
+
 def run_main():
     for co in ["--parallel", "--paste"]:
         if co in sys.argv: del sys.argv[sys.argv.index(co)]


--- a/yt/visualization/plot_collection.py	Sun Mar 27 16:44:38 2011 -0400
+++ b/yt/visualization/plot_collection.py	Sun Mar 27 16:47:47 2011 -0400
@@ -28,6 +28,7 @@
 
 from yt.funcs import *
 
+from yt.config import ytcfg
 from yt.data_objects.profiles import \
     BinnedProfile1D, \
     BinnedProfile2D
@@ -155,6 +156,16 @@
             fn.append(plot.save_image(basename, format=format, 
                       override=override, force_save=force_save))
             mylog.info("Saved %s", fn[-1])
+        if ytcfg.getboolean("yt", "__withinreason"):
+            from yt.gui.reason.bottle_mods import PayloadHandler
+            import base64
+            ph = PayloadHandler()
+            for f in fn:
+                if not f.endswith('png'): continue
+                img_data = base64.b64encode(open(f,'rb').read())
+                payload = {'type':'image_string',
+                           'image_data':img_data}
+                ph.add_payload(payload)
         return fn
 
     def set_xlim(self, xmin, xmax):


--- a/yt/visualization/plot_window.py	Sun Mar 27 16:44:38 2011 -0400
+++ b/yt/visualization/plot_window.py	Sun Mar 27 16:47:47 2011 -0400
@@ -24,6 +24,7 @@
 """
 
 import tempfile
+import numpy as na
 import color_maps
 from image_writer import \
     write_image, apply_colormap
@@ -38,7 +39,8 @@
         args[0]._data_valid = False
         args[0]._plot_valid = False
         args[0]._recreate_frb()
-        return args[0]._setup_plots()
+        if args[0]._initfinished:
+            return args[0]._setup_plots()
 
     return newfunc
 
@@ -80,11 +82,13 @@
             rendering is used during data deposition.
 
         """
+        self._initfinished = False
         self.plots = {}
         self.data_source = data_source
         self.buff_size = buff_size
         self.antialias = True
         self.set_window(bounds) # this automatically updates the data and plot
+        self._initfinished = True
 
     def __getitem__(self, item):
         return self.plots[item]
@@ -180,11 +184,34 @@
     """A viewer for the web interface.
 
     """
+    def __init__(self, *args,**kwargs):
+        PlotWindow.__init__(self, *args,**kwargs)
+        self._field_transform = {}
+        for field in self._frb.data.keys():
+            if self._frb.pf.field_info[field].take_log:
+                self._field_transform[field] = na.log
+            else:
+                self._field_transform[field] = lambda x: x
+
+        self._setup_plots()
+
+    def set_log(self,field,log):
+        """set a field to log or linear.
+
+        """
+        if log:
+            self._field_transform[field] = na.log
+        else:
+            self._field_transform[field] = lambda x: x
+
+    def set_transform(self, field, func):
+        self._field_transform[field] = func
+
     def _setup_plots(self):
         plots = []
         for field in self._frb.data.keys():
             tf = tempfile.TemporaryFile()
-            to_plot = apply_colormap(self._frb[field])
+            to_plot = apply_colormap(self._frb[field],func = self._field_transform[field])
             write_png_to_file(to_plot, tf)
             tf.seek(0)
             s = tf.read()


http://bitbucket.org/yt_analysis/yt/changeset/1557a6693333/
changeset:   r3942:1557a6693333
branch:      yt
user:        brittonsmith
date:        2011-03-27 23:05:10
summary:     Added pf_data.
affected #:  1 file (379 bytes)

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/pf_data.js	Sun Mar 27 17:05:10 2011 -0400
@@ -0,0 +1,8 @@
+var my_pfs = [{name: "pf1", objects: [
+                              {name: "sp1", type: "sphere"},
+                              {name: "sp2", type: "sphere"}
+				      ]},
+              {name: "pf2", objects: [
+                              {name: 'r1', type: "region"},
+                              {name: 'ad', type: "all_data"}]},
+              {name: "pf3", objects: []}]


http://bitbucket.org/yt_analysis/yt/changeset/f6079a9af0b6/
changeset:   r3943:f6079a9af0b6
branch:      yt
user:        MatthewTurk
date:        2011-03-27 23:21:20
summary:     Linking the list of parameter files and objects with the RPC calls in the
Javascript
affected #:  4 files (300 bytes)

--- a/yt/gui/reason/bottle_mods.py	Sun Mar 27 17:05:10 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Sun Mar 27 17:21:20 2011 -0400
@@ -81,12 +81,12 @@
         return source
 
     def __call__(self):
-        print "Hi there, I just got this request:",
+        #print "Hi there, I just got this request:",
         val = request.body.read()
         print val
         #import pdb;pdb.set_trace()
         rv = super(BottleDirectRouter, self).__call__(val)
-        print "With this response:", rv
+        #print "With this response:", rv
         return rv
 
 def uuid_serve_functions(pre_routed = None, open_browser=False):


--- a/yt/gui/reason/extdirect_repl.py	Sun Mar 27 17:05:10 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sun Mar 27 17:21:20 2011 -0400
@@ -89,5 +89,10 @@
 
     def get_list_of_pfs(self):
         from yt.data_objects.static_output import _cached_pfs
-        names = [str(i) for i in sorted(_cached_pfs.values())]
-        return names
+        rv = []
+        for fn, pf in sorted(_cached_pfs.items()):
+            objs = []
+            for obj in pf.h.objects:
+                objs.append(dict(name=str(obj), type=obj._type_name))
+            rv.append( dict(name = str(pf), objects = objs) )
+        return rv


--- a/yt/gui/reason/html/index.html	Sun Mar 27 17:05:10 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 17:21:20 2011 -0400
@@ -56,13 +56,14 @@
 
     function cell_finished(result) {
         Ext.each(result['payloads'], function(payload, index) {
-            if (payload['type'] == 'image_string') {
+            if (payload['type'] == 'png_string') {
                 Ext.get("cell_output").dom.innerHTML +=
                     '<br/><img src="data:image/png;base64,' +
                         payload['image_data'] + '"/>';
             }
         });
         repl_input.get('input_line').setReadOnly(false);
+        yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
     }
 
     var handle_result = function(f, a) {
@@ -117,37 +118,7 @@
         {text:'West'}
     );
 
-    Ext.onReady(function(){
-
-Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
-
-        // NOTE: This is an example showing simple state management. During development,
-        // it is generally best to disable state management as dynamically-generated ids
-        // can change across page loads, leading to unpredictable results.  The developer
-        // should ensure that stable state ids are set for stateful components in real apps.
-        Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
-
-var children = [{
-     text:'pf1',
-     expanded: true,
-     children:[{
-         text:'sphere',
-         leaf:true
-    },{
-         text:'region'
-        ,leaf:true
-    }]
-},{
-     text:'pf2',
-     expanded: true,
-     children:[{
-         text:'all_data'
-        ,leaf:true
-    }]
- 
-}];
-
-	// Go ahead and create the TreePanel now so that we can use it below
+    var examine;
     var treePanel = new Ext.tree.TreePanel({
        iconCls: 'nav',
     	id: 'tree-panel',
@@ -164,18 +135,31 @@
         })
      });
 
-     Ext.each(my_pfs, function(pf, index) {
-        treePanel.root.appendChild(new Ext.tree.TreeNode({text: pf.name,
-                                    leaf:false}));
-        this_pf = treePanel.root.lastChild
-        Ext.each(pf.objects, function(object, obj_index) {
-           this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
-                                leaf: true}));
-       });
-   });
+    function fill_tree(my_pfs) {
+        examine = my_pfs;
+        treePanel.root.removeAll();
+      Ext.each(my_pfs, function(pf, index) {
+          treePanel.root.appendChild(new Ext.tree.TreeNode({text: pf.name,
+              leaf:false, expanded:true}));
+          this_pf = treePanel.root.lastChild
+          Ext.each(pf.objects, function(object, obj_index) {
+            this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
+                leaf: true}));
+            });
+          });
+    };
 
+    Ext.onReady(function(){
 
+Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
 
+        // NOTE: This is an example showing simple state management. During development,
+        // it is generally best to disable state management as dynamically-generated ids
+        // can change across page loads, leading to unpredictable results.  The developer
+        // should ensure that stable state ids are set for stateful components in real apps.
+        Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
+
+	// Go ahead and create the TreePanel now so that we can use it below
         viewport = new Ext.Viewport({
             layout: 'border',
             items: [


--- a/yt/visualization/plot_collection.py	Sun Mar 27 17:05:10 2011 -0400
+++ b/yt/visualization/plot_collection.py	Sun Mar 27 17:21:20 2011 -0400
@@ -163,7 +163,7 @@
             for f in fn:
                 if not f.endswith('png'): continue
                 img_data = base64.b64encode(open(f,'rb').read())
-                payload = {'type':'image_string',
+                payload = {'type':'png_string',
                            'image_data':img_data}
                 ph.add_payload(payload)
         return fn


http://bitbucket.org/yt_analysis/yt/changeset/fdaafbc149b5/
changeset:   r3944:fdaafbc149b5
branch:      yt
user:        MatthewTurk
date:        2011-03-28 00:07:54
summary:     Fixing object deletion
affected #:  1 file (121 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Sun Mar 27 17:21:20 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sun Mar 27 18:07:54 2011 -0400
@@ -93,6 +93,10 @@
         for fn, pf in sorted(_cached_pfs.items()):
             objs = []
             for obj in pf.h.objects:
-                objs.append(dict(name=str(obj), type=obj._type_name))
+                try:
+                    name = str(obj)
+                except ReferenceError:
+                    continue
+                objs.append(dict(name=name, type=obj._type_name))
             rv.append( dict(name = str(pf), objects = objs) )
         return rv


http://bitbucket.org/yt_analysis/yt/changeset/61fb1c0743eb/
changeset:   r3945:61fb1c0743eb
branch:      yt
user:        MatthewTurk
date:        2011-03-28 00:23:04
summary:     Adding a script loader
affected #:  2 files (597 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Sun Mar 27 18:07:54 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sun Mar 27 18:23:04 2011 -0400
@@ -56,6 +56,10 @@
         self.pflist = ExtDirectParameterFileList()
         self.executed_cell_texts = []
         self.payload_handler = PayloadHandler()
+        # Now we load up all the yt.mods stuff, but only after we've finished
+        # setting up.
+        self.execute("from yt.mods import *")
+        self.locals['load_script'] = ext_load_script
 
     def index(self):
         """Return an HTTP-based Read-Eval-Print-Loop terminal."""
@@ -100,3 +104,12 @@
                 objs.append(dict(name=name, type=obj._type_name))
             rv.append( dict(name = str(pf), objects = objs) )
         return rv
+
+def ext_load_script(filename):
+    contents = open(filename).read()
+    payload_handler = PayloadHandler()
+    payload_handler.add_payload(
+        {'type': 'cell_contents',
+         'value': contents}
+    )
+    return


--- a/yt/gui/reason/html/index.html	Sun Mar 27 18:07:54 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 18:23:04 2011 -0400
@@ -60,6 +60,9 @@
                 Ext.get("cell_output").dom.innerHTML +=
                     '<br/><img src="data:image/png;base64,' +
                         payload['image_data'] + '"/>';
+            } else if (payload['type'] == 'cell_contents') {
+                var input_line = repl_input.get("input_line")
+                input_line.setValue(payload['value']);
             }
         });
         repl_input.get('input_line').setReadOnly(false);


http://bitbucket.org/yt_analysis/yt/changeset/85c8c58a77e7/
changeset:   r3946:85c8c58a77e7
branch:      yt
user:        Cameron Hummels
date:        2011-03-28 01:19:44
summary:     Added some test buttons.
affected #:  1 file (475 bytes)

--- a/yt/gui/reason/bottle_mods.py	Sun Mar 27 19:10:29 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Sun Mar 27 19:19:44 2011 -0400
@@ -81,12 +81,12 @@
         return source
 
     def __call__(self):
-        print "Hi there, I just got this request:",
+        #print "Hi there, I just got this request:",
         val = request.body.read()
         print val
         #import pdb;pdb.set_trace()
         rv = super(BottleDirectRouter, self).__call__(val)
-        print "With this response:", rv
+        #print "With this response:", rv
         return rv
 
 def uuid_serve_functions(pre_routed = None, open_browser=False):


--- a/yt/gui/reason/extdirect_repl.py	Sun Mar 27 19:10:29 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sun Mar 27 19:19:44 2011 -0400
@@ -56,6 +56,10 @@
         self.pflist = ExtDirectParameterFileList()
         self.executed_cell_texts = []
         self.payload_handler = PayloadHandler()
+        # Now we load up all the yt.mods stuff, but only after we've finished
+        # setting up.
+        self.execute("from yt.mods import *")
+        self.locals['load_script'] = ext_load_script
 
     def index(self):
         """Return an HTTP-based Read-Eval-Print-Loop terminal."""
@@ -89,5 +93,23 @@
 
     def get_list_of_pfs(self):
         from yt.data_objects.static_output import _cached_pfs
-        names = [str(i) for i in sorted(_cached_pfs.values())]
-        return names
+        rv = []
+        for fn, pf in sorted(_cached_pfs.items()):
+            objs = []
+            for obj in pf.h.objects:
+                try:
+                    name = str(obj)
+                except ReferenceError:
+                    continue
+                objs.append(dict(name=name, type=obj._type_name))
+            rv.append( dict(name = str(pf), objects = objs) )
+        return rv
+
+def ext_load_script(filename):
+    contents = open(filename).read()
+    payload_handler = PayloadHandler()
+    payload_handler.add_payload(
+        {'type': 'cell_contents',
+         'value': contents}
+    )
+    return


--- a/yt/gui/reason/html/index.html	Sun Mar 27 19:10:29 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 19:19:44 2011 -0400
@@ -46,7 +46,8 @@
     <script type="text/javascript" src="resources/examples/shared/examples.js"></script><script type="text/javascript" src="resources/ext-repl-api.js"></script><script type="text/javascript" src="resources/ext-pflist-api.js"></script>
-  
+    <script type="text/javascript" src="pf_data.js"></script>
+ 
     <script type="text/javascript">
     var viewport;
     function cell_sent() {
@@ -55,13 +56,17 @@
 
     function cell_finished(result) {
         Ext.each(result['payloads'], function(payload, index) {
-            if (payload['type'] == 'image_string') {
+            if (payload['type'] == 'png_string') {
                 Ext.get("cell_output").dom.innerHTML +=
                     '<br/><img src="data:image/png;base64,' +
                         payload['image_data'] + '"/>';
+            } else if (payload['type'] == 'cell_contents') {
+                var input_line = repl_input.get("input_line")
+                input_line.setValue(payload['value']);
             }
         });
         repl_input.get('input_line').setReadOnly(false);
+        yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
     }
 
     var handle_result = function(f, a) {
@@ -131,6 +136,36 @@
             EastButton]
         }
     );
+    var examine;
+    var treePanel = new Ext.tree.TreePanel({
+       iconCls: 'nav',
+    	id: 'tree-panel',
+    	title: 'Objects',
+        region:'west',
+        split: true,
+        minSize: 150,
+        autoScroll: true,
+        rootVisible: false,
+        root:new Ext.tree.TreeNode({
+          expanded:true
+         ,leaf:false
+         ,text:''
+        })
+     });
+
+    function fill_tree(my_pfs) {
+        examine = my_pfs;
+        treePanel.root.removeAll();
+      Ext.each(my_pfs, function(pf, index) {
+          treePanel.root.appendChild(new Ext.tree.TreeNode({text: pf.name,
+              leaf:false, expanded:true}));
+          this_pf = treePanel.root.lastChild
+          Ext.each(pf.objects, function(object, obj_index) {
+            this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
+                leaf: true}));
+            });
+          });
+    };
 
     Ext.onReady(function(){
 
@@ -142,45 +177,7 @@
         // should ensure that stable state ids are set for stateful components in real apps.
         Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
 
-var children = [{
-     text:'pf1',
-     expanded: true,
-     children:[{
-         text:'sphere',
-         leaf:true
-    },{
-         text:'region'
-        ,leaf:true
-    }]
-},{
-     text:'pf2',
-     expanded: true,
-     children:[{
-         text:'all_data'
-        ,leaf:true
-    }]
- 
-}];
-
 	// Go ahead and create the TreePanel now so that we can use it below
-    var treePanel = new Ext.tree.TreePanel({
-     loader:new Ext.tree.TreeLoader(),
-        iconCls: 'nav',
-    	id: 'tree-panel',
-    	title: 'Objects',
-        region:'west',
-        split: true,
-        minSize: 150,
-        autoScroll: true,
-        rootVisible: false,
-        root:new Ext.tree.AsyncTreeNode({
-          expanded:true
-         ,leaf:false
-         ,text:''
-         ,children:children
-     })
-     });
-
         viewport = new Ext.Viewport({
             layout: 'border',
             items: [


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/pf_data.js	Sun Mar 27 19:19:44 2011 -0400
@@ -0,0 +1,8 @@
+var my_pfs = [{name: "pf1", objects: [
+                              {name: "sp1", type: "sphere"},
+                              {name: "sp2", type: "sphere"}
+				      ]},
+              {name: "pf2", objects: [
+                              {name: 'r1', type: "region"},
+                              {name: 'ad', type: "all_data"}]},
+              {name: "pf3", objects: []}]


--- a/yt/visualization/plot_collection.py	Sun Mar 27 19:10:29 2011 -0400
+++ b/yt/visualization/plot_collection.py	Sun Mar 27 19:19:44 2011 -0400
@@ -163,7 +163,7 @@
             for f in fn:
                 if not f.endswith('png'): continue
                 img_data = base64.b64encode(open(f,'rb').read())
-                payload = {'type':'image_string',
+                payload = {'type':'png_string',
                            'image_data':img_data}
                 ph.add_payload(payload)
         return fn


--- a/yt/visualization/plot_window.py	Sun Mar 27 19:10:29 2011 -0400
+++ b/yt/visualization/plot_window.py	Sun Mar 27 19:19:44 2011 -0400
@@ -24,6 +24,7 @@
 """
 
 import tempfile
+import numpy as na
 import color_maps
 from image_writer import \
     write_image, apply_colormap
@@ -38,7 +39,8 @@
         args[0]._data_valid = False
         args[0]._plot_valid = False
         args[0]._recreate_frb()
-        return args[0]._setup_plots()
+        if args[0]._initfinished:
+            return args[0]._setup_plots()
 
     return newfunc
 
@@ -80,11 +82,13 @@
             rendering is used during data deposition.
 
         """
+        self._initfinished = False
         self.plots = {}
         self.data_source = data_source
         self.buff_size = buff_size
         self.antialias = True
         self.set_window(bounds) # this automatically updates the data and plot
+        self._initfinished = True
 
     def __getitem__(self, item):
         return self.plots[item]
@@ -180,11 +184,34 @@
     """A viewer for the web interface.
 
     """
+    def __init__(self, *args,**kwargs):
+        PlotWindow.__init__(self, *args,**kwargs)
+        self._field_transform = {}
+        for field in self._frb.data.keys():
+            if self._frb.pf.field_info[field].take_log:
+                self._field_transform[field] = na.log
+            else:
+                self._field_transform[field] = lambda x: x
+
+        self._setup_plots()
+
+    def set_log(self,field,log):
+        """set a field to log or linear.
+
+        """
+        if log:
+            self._field_transform[field] = na.log
+        else:
+            self._field_transform[field] = lambda x: x
+
+    def set_transform(self, field, func):
+        self._field_transform[field] = func
+
     def _setup_plots(self):
         plots = []
         for field in self._frb.data.keys():
             tf = tempfile.TemporaryFile()
-            to_plot = apply_colormap(self._frb[field])
+            to_plot = apply_colormap(self._frb[field],func = self._field_transform[field])
             write_png_to_file(to_plot, tf)
             tf.seek(0)
             s = tf.read()


http://bitbucket.org/yt_analysis/yt/changeset/f0dae66b215f/
changeset:   r3947:f0dae66b215f
branch:      yt
user:        Cameron Hummels
date:        2011-03-28 02:58:08
summary:     Added some panels to the Plot Window.
affected #:  1 file (600 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 19:19:44 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 20:58:08 2011 -0400
@@ -127,13 +127,30 @@
     );
 
     var PlotPanel = new Ext.Panel(
-        {layout: 'anchor',
+        {
+//layout: 'anchor',
+        layout:'vbox',
         title: 'Plot Window 1',
-        width:400,
+//        width:1400,
         height:400,
-        items:[
-            NorthButton, 
-            EastButton]
+        layoutConfig: {
+            align : 'stretch',
+            pack  : 'start',
+        },
+        items: [
+            {html:'panel 1<br><br><br>test<br>'},
+            {html:'panel 1<br><br><br>test<br>'},
+            {html:'panel 1 test<br>'},
+            {html:'panel 1<br><br><br>test<br>'},
+            {html:'panel 1<br>test<br>'},
+            {html:'panel 1<br><br><br>test<br>'},
+            {html:'panel 1<br><br><br>test<br>'},
+            {html:'panel 1 test<br>'},
+            {html:'panel 1<br><br><br>test<br>'},
+            {html:'panel 1<br>test<br>'}
+        ]
+            //NorthButton, 
+            //EastButton]
         }
     );
     var examine;


http://bitbucket.org/yt_analysis/yt/changeset/304545e83995/
changeset:   r3948:304545e83995
branch:      yt
user:        Cameron Hummels
date:        2011-03-28 04:06:59
summary:     Added buttons to west panel.
affected #:  1 file (916 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 20:58:08 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 22:06:59 2011 -0400
@@ -158,8 +158,10 @@
        iconCls: 'nav',
     	id: 'tree-panel',
     	title: 'Objects',
+        layout: 'absolute',
         region:'west',
         split: true,
+        height:480,
         minSize: 150,
         autoScroll: true,
         rootVisible: false,
@@ -170,6 +172,39 @@
         })
      });
 
+    var ButtonGroupPanel = new Ext.Panel({
+//        title: 'Panel with Button Group',
+        layout: 'absolute',
+        width: 210,
+        height:38,
+        pageX:0,
+        pageY:480,
+        ButtonAlign: 'center',
+        collapsible: false,
+        renderTo: document.body,
+        tbar: [{
+            xtype: 'buttongroup',
+            columns: 3,
+            items: [{
+                text: 'Download',
+                width: 65
+            },{
+//                text: 'Save', iconCls: 'add'
+                text: 'Save',
+                width: 65
+            },{
+                text: 'Pastebin',
+                width: 65
+            }]
+        }]
+    });
+    
+    var DownloadButton = new Ext.Button({
+        text:'Download this Session',
+        region:'west'
+        }
+    );
+
     function fill_tree(my_pfs) {
         examine = my_pfs;
         treePanel.root.removeAll();
@@ -220,10 +255,13 @@
                 collapsible: true,
                 margins: '0 0 0 5',
                 layout: {
-                    type: 'accordion',
+                    type: 'absolute',
                     animate: true
                 },
-                items: [treePanel]
+                items: [
+                    treePanel,
+                    ButtonGroupPanel
+                ]
             },
             // in this instance the TabPanel is not wrapped by another panel
             // since no title is needed, this Panel is added directly


http://bitbucket.org/yt_analysis/yt/changeset/302af9263126/
changeset:   r3949:302af9263126
branch:      yt
user:        MatthewTurk
date:        2011-03-28 02:56:56
summary:     Adding session download URL
affected #:  1 file (666 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Sun Mar 27 19:19:44 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sun Mar 27 20:56:56 2011 -0400
@@ -26,9 +26,11 @@
 
 import json
 import os
+import cStringIO
 
 from .bottle_mods import preroute, BottleDirectRouter, notify_route, \
                          PayloadHandler
+from .bottle import response, request
 from .basic_repl import ProgrammaticREPL
 
 local_dir = os.path.dirname(__file__)
@@ -48,6 +50,8 @@
         preroute_table = dict(index = ("/", "GET"),
                               _myapi = ("/resources/ext-repl-api.js", "GET"),
                               resources = ("/resources/:path#.+#", "GET"),
+                              _session_py = ("/session.py", "GET"),
+                              ace = ("/ace/:path#.+#", "GET"),
                               )
         for v, args in preroute_table.items():
             preroute(args[0], method=args[1])(getattr(self, v))
@@ -76,6 +80,14 @@
             return
         return open(pp).read()
 
+    def ace(self, path):
+        # This will need to be changed.
+        pp = os.path.join(local_dir, "ace", path)
+        if not os.path.exists(pp):
+            response.status = 404
+            return
+        return open(pp).read()
+
     def execute(self, code):
         self.executed_cell_texts.append(code)
         result = ProgrammaticREPL.execute(self, code)
@@ -87,6 +99,13 @@
     def get_history(self):
         return self.executed_cell_texts[:]
 
+    def _session_py(self):
+        cs = cStringIO.StringIO()
+        cs.write("\n######\n".join(self.executed_cell_texts))
+        cs.seek(0)
+        response.headers["content-disposition"] = "attachment; filename=session.py"
+        return cs
+
 class ExtDirectParameterFileList(BottleDirectRouter):
     my_name = "ExtDirectParameterFileList"
     api_url = "pflist"


http://bitbucket.org/yt_analysis/yt/changeset/58e917c10178/
changeset:   r3950:58e917c10178
branch:      yt
user:        MatthewTurk
date:        2011-03-28 03:20:48
summary:     Adding syntax highlighting to output cells
affected #:  2 files (921 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Sun Mar 27 20:56:56 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sun Mar 27 21:20:48 2011 -0400
@@ -33,6 +33,23 @@
 from .bottle import response, request
 from .basic_repl import ProgrammaticREPL
 
+try:
+    import pygments
+    import pygments.lexers
+    import pygments.formatters
+    def _highlighter():
+        pl = pygments.lexers.PythonLexer()
+        hf = pygments.formatters.HtmlFormatter(linenos='table')
+        def __highlighter(a):
+            return pygments.highlight(a, pl, hf)
+        return __highlighter, hf.get_style_defs()
+    # We could add an additional '.highlight_pyg' in the call
+    highlighter, highlighter_css = _highlighter()
+
+except ImportError:
+    highlighter = lambda a: a
+    highlight_css = ''
+
 local_dir = os.path.dirname(__file__)
 
 class ExtDirectREPL(ProgrammaticREPL, BottleDirectRouter):
@@ -51,7 +68,8 @@
                               _myapi = ("/resources/ext-repl-api.js", "GET"),
                               resources = ("/resources/:path#.+#", "GET"),
                               _session_py = ("/session.py", "GET"),
-                              ace = ("/ace/:path#.+#", "GET"),
+                              _ace = ("/ace/:path#.+#", "GET"),
+                              _highlighter_css = ("/highlighter.css", "GET"),
                               )
         for v, args in preroute_table.items():
             preroute(args[0], method=args[1])(getattr(self, v))
@@ -80,7 +98,7 @@
             return
         return open(pp).read()
 
-    def ace(self, path):
+    def _ace(self, path):
         # This will need to be changed.
         pp = os.path.join(local_dir, "ace", path)
         if not os.path.exists(pp):
@@ -88,11 +106,15 @@
             return
         return open(pp).read()
 
+    def _highlighter_css(self):
+        return highlighter_css
+
     def execute(self, code):
         self.executed_cell_texts.append(code)
         result = ProgrammaticREPL.execute(self, code)
         payloads = self.payload_handler.deliver_payloads()
         return_value = {'output': result,
+                        'input': highlighter(code),
                         'payloads': payloads}
         return return_value
 


--- a/yt/gui/reason/html/index.html	Sun Mar 27 20:56:56 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 21:20:48 2011 -0400
@@ -2,6 +2,7 @@
 <head><title>Complex Layout</title><link rel="stylesheet" type="text/css" href="resources/resources/css/ext-all.css" />
+    <link rel="stylesheet" type="text/css" href="highlighter.css" /><style type="text/css">
     html, body {
@@ -69,16 +70,21 @@
         yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
     }
 
+    var res;
+
     var handle_result = function(f, a) {
         var input_line = repl_input.get("input_line")
         if (a.result == null) {
             text = "ERROR";
+            formatted_input = input_line.getValue();
         } else {
             text = a.result['output'].replace(/\n/g,"<br/>");
+            formatted_input = a.result['input']
         }
         Ext.get("cell_output").dom.innerHTML +=
-        '>>> ' + input_line.getValue() + '<br/>' + text + '<br/>';
+          formatted_input + '<br/>' + text + '<br/>';
         input_line.setValue("");
+        res = a.result;
         cell_finished(a.result);
     }
 


http://bitbucket.org/yt_analysis/yt/changeset/c7a9752deb0d/
changeset:   r3951:c7a9752deb0d
branch:      yt
user:        MatthewTurk
date:        2011-03-28 03:25:03
summary:     Merging
affected #:  1 file (600 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 21:20:48 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 21:25:03 2011 -0400
@@ -133,13 +133,30 @@
     );
 
     var PlotPanel = new Ext.Panel(
-        {layout: 'anchor',
+        {
+//layout: 'anchor',
+        layout:'vbox',
         title: 'Plot Window 1',
-        width:400,
+//        width:1400,
         height:400,
-        items:[
-            NorthButton, 
-            EastButton]
+        layoutConfig: {
+            align : 'stretch',
+            pack  : 'start',
+        },
+        items: [
+            {html:'panel 1<br><br><br>test<br>'},
+            {html:'panel 1<br><br><br>test<br>'},
+            {html:'panel 1 test<br>'},
+            {html:'panel 1<br><br><br>test<br>'},
+            {html:'panel 1<br>test<br>'},
+            {html:'panel 1<br><br><br>test<br>'},
+            {html:'panel 1<br><br><br>test<br>'},
+            {html:'panel 1 test<br>'},
+            {html:'panel 1<br><br><br>test<br>'},
+            {html:'panel 1<br>test<br>'}
+        ]
+            //NorthButton, 
+            //EastButton]
         }
     );
     var examine;


http://bitbucket.org/yt_analysis/yt/changeset/d9d31525bcb3/
changeset:   r3952:d9d31525bcb3
branch:      yt
user:        MatthewTurk
date:        2011-03-28 03:36:47
summary:     Adding line numbers, fixing formatting for output
affected #:  2 files (171 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Sun Mar 27 21:25:03 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sun Mar 27 21:36:47 2011 -0400
@@ -39,13 +39,13 @@
     import pygments.formatters
     def _highlighter():
         pl = pygments.lexers.PythonLexer()
-        hf = pygments.formatters.HtmlFormatter(linenos='table')
+        hf = pygments.formatters.HtmlFormatter(
+                linenos='table', linenospecial=2)
         def __highlighter(a):
             return pygments.highlight(a, pl, hf)
         return __highlighter, hf.get_style_defs()
     # We could add an additional '.highlight_pyg' in the call
     highlighter, highlighter_css = _highlighter()
-
 except ImportError:
     highlighter = lambda a: a
     highlight_css = ''


--- a/yt/gui/reason/html/index.html	Sun Mar 27 21:25:03 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 21:36:47 2011 -0400
@@ -34,6 +34,10 @@
     #cell_output {
         font-family: monospace;
     }
+    td.code {
+        padding-left: 20px;
+        font-family: monospace;
+    }
     </style><!-- GC -->
@@ -78,7 +82,8 @@
             text = "ERROR";
             formatted_input = input_line.getValue();
         } else {
-            text = a.result['output'].replace(/\n/g,"<br/>");
+            //text = a.result['output'].replace(/\n/g,"<br/>");
+            text = "<pre>"+a.result['output']+"</pre>";
             formatted_input = a.result['input']
         }
         Ext.get("cell_output").dom.innerHTML +=


http://bitbucket.org/yt_analysis/yt/changeset/0b40964d8061/
changeset:   r3953:0b40964d8061
branch:      yt
user:        MatthewTurk
date:        2011-03-28 04:08:07
summary:     Adding in some separation of cell-formatting, etc.
affected #:  1 file (201 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 21:36:47 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 22:08:07 2011 -0400
@@ -75,9 +75,11 @@
     }
 
     var res;
+    var cell_count = 0;
 
     var handle_result = function(f, a) {
         var input_line = repl_input.get("input_line")
+        cell_count += 1;
         if (a.result == null) {
             text = "ERROR";
             formatted_input = input_line.getValue();
@@ -86,8 +88,9 @@
             text = "<pre>"+a.result['output']+"</pre>";
             formatted_input = a.result['input']
         }
-        Ext.get("cell_output").dom.innerHTML +=
-          formatted_input + '<br/>' + text + '<br/>';
+        var cell = NewCell("cell_"+cell_count, formatted_input, text);
+        notebook.get("output_container").add(cell);
+        notebook.doLayout();
         input_line.setValue("");
         res = a.result;
         cell_finished(a.result);
@@ -137,34 +140,38 @@
         {text:'West'}
     );
 
+    function NewCell(name, input, result) {
+        var CellPanel = new Ext.Panel(
+            {id: name,
+             items: [new Ext.Panel({
+                        id:name+"_input",
+                        items:[{html:input}]
+                        }),
+                     new Ext.Panel({
+                        id:name+"_result",
+                        items:[{html:result}]
+                        })]
+            }
+        );
+        return CellPanel;
+    }
+
+    var OutputContainer = new Ext.Panel({
+          title: 'YT Output',
+          id: 'output_container',
+          autoScroll: true,
+          items: []
+        });
+
     var PlotPanel = new Ext.Panel(
         {
-//layout: 'anchor',
-        layout:'vbox',
         title: 'Plot Window 1',
-//        width:1400,
-        height:400,
-        layoutConfig: {
-            align : 'stretch',
-            pack  : 'start',
-        },
-        items: [
-            {html:'panel 1<br><br><br>test<br>'},
-            {html:'panel 1<br><br><br>test<br>'},
-            {html:'panel 1 test<br>'},
-            {html:'panel 1<br><br><br>test<br>'},
-            {html:'panel 1<br>test<br>'},
-            {html:'panel 1<br><br><br>test<br>'},
-            {html:'panel 1<br><br><br>test<br>'},
-            {html:'panel 1 test<br>'},
-            {html:'panel 1<br><br><br>test<br>'},
-            {html:'panel 1<br>test<br>'}
-        ]
-            //NorthButton, 
-            //EastButton]
+        autoScroll: true,
+        items: [ ]
         }
     );
     var examine;
+    var notebook;
     var treePanel = new Ext.tree.TreePanel({
        iconCls: 'nav',
     	id: 'tree-panel',
@@ -247,6 +254,7 @@
                 activeTab: 0,     // first tab initially active
                 items: [{
                     title: 'YT',
+                    id: 'notebook',
                     iconCls: 'console',
                     closable: false,
                     autoScroll: true,
@@ -255,7 +263,7 @@
                         title: 'Output',
                         html: "",
                         id: "cell_output",
-                    }, repl_input, ]
+                    }, repl_input, OutputContainer]
                 }, {
                     title: 'Plot Window 1',
                     iconCls: 'graph',
@@ -273,6 +281,8 @@
             // expand or collapse that Panel based on its collapsed property state
             w.collapsed ? w.expand() : w.collapse();
         });
+        
+        notebook = viewport.get("center-panel").get("notebook")
     });
     </script></head>


http://bitbucket.org/yt_analysis/yt/changeset/25e9b03a649b/
changeset:   r3954:25e9b03a649b
branch:      yt
user:        MatthewTurk
date:        2011-03-28 04:08:17
summary:     Merge
affected #:  1 file (916 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 22:08:07 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 22:08:17 2011 -0400
@@ -176,8 +176,10 @@
        iconCls: 'nav',
     	id: 'tree-panel',
     	title: 'Objects',
+        layout: 'absolute',
         region:'west',
         split: true,
+        height:480,
         minSize: 150,
         autoScroll: true,
         rootVisible: false,
@@ -188,6 +190,39 @@
         })
      });
 
+    var ButtonGroupPanel = new Ext.Panel({
+//        title: 'Panel with Button Group',
+        layout: 'absolute',
+        width: 210,
+        height:38,
+        pageX:0,
+        pageY:480,
+        ButtonAlign: 'center',
+        collapsible: false,
+        renderTo: document.body,
+        tbar: [{
+            xtype: 'buttongroup',
+            columns: 3,
+            items: [{
+                text: 'Download',
+                width: 65
+            },{
+//                text: 'Save', iconCls: 'add'
+                text: 'Save',
+                width: 65
+            },{
+                text: 'Pastebin',
+                width: 65
+            }]
+        }]
+    });
+    
+    var DownloadButton = new Ext.Button({
+        text:'Download this Session',
+        region:'west'
+        }
+    );
+
     function fill_tree(my_pfs) {
         examine = my_pfs;
         treePanel.root.removeAll();
@@ -238,10 +273,13 @@
                 collapsible: true,
                 margins: '0 0 0 5',
                 layout: {
-                    type: 'accordion',
+                    type: 'absolute',
                     animate: true
                 },
-                items: [treePanel]
+                items: [
+                    treePanel,
+                    ButtonGroupPanel
+                ]
             },
             // in this instance the TabPanel is not wrapped by another panel
             // since no title is needed, this Panel is added directly


http://bitbucket.org/yt_analysis/yt/changeset/6362e188d5b0/
changeset:   r3955:6362e188d5b0
branch:      yt
user:        MatthewTurk
date:        2011-03-28 04:24:54
summary:     Adding the URL redirection for downloading the session file
affected #:  2 files (100 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Sun Mar 27 22:08:17 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sun Mar 27 22:24:54 2011 -0400
@@ -125,7 +125,7 @@
         cs = cStringIO.StringIO()
         cs.write("\n######\n".join(self.executed_cell_texts))
         cs.seek(0)
-        response.headers["content-disposition"] = "attachment; filename=session.py"
+        response.headers["content-disposition"] = "attachment;"
         return cs
 
 class ExtDirectParameterFileList(BottleDirectRouter):


--- a/yt/gui/reason/html/index.html	Sun Mar 27 22:08:17 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 22:24:54 2011 -0400
@@ -205,7 +205,8 @@
             columns: 3,
             items: [{
                 text: 'Download',
-                width: 65
+                width: 65,
+                handler: function(b, e) { window.open("session.py", "_top"); }
             },{
 //                text: 'Save', iconCls: 'add'
                 text: 'Save',


http://bitbucket.org/yt_analysis/yt/changeset/98c069b4b5f1/
changeset:   r3956:98c069b4b5f1
branch:      yt
user:        Cameron Hummels
date:        2011-03-28 05:09:37
summary:     Made buttons in Objects window hold relative to window position instead of absolute.
affected #:  1 file (188 bytes)

--- a/yt/gui/reason/html/index.html	Sun Mar 27 22:24:54 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sun Mar 27 23:09:37 2011 -0400
@@ -173,13 +173,13 @@
     var examine;
     var notebook;
     var treePanel = new Ext.tree.TreePanel({
-       iconCls: 'nav',
+        iconCls: 'nav',
     	id: 'tree-panel',
     	title: 'Objects',
-        layout: 'absolute',
+        layout: 'anchor',
         region:'west',
         split: true,
-        height:480,
+        anchor: '100% -35',
         minSize: 150,
         autoScroll: true,
         rootVisible: false,
@@ -191,12 +191,7 @@
      });
 
     var ButtonGroupPanel = new Ext.Panel({
-//        title: 'Panel with Button Group',
-        layout: 'absolute',
-        width: 210,
-        height:38,
-        pageX:0,
-        pageY:480,
+        layout: 'anchor',
         ButtonAlign: 'center',
         collapsible: false,
         renderTo: document.body,
@@ -205,25 +200,21 @@
             columns: 3,
             items: [{
                 text: 'Download',
-                width: 65,
+                layout:'anchor',
+                anchor: '100% 33%',
                 handler: function(b, e) { window.open("session.py", "_top"); }
             },{
-//                text: 'Save', iconCls: 'add'
                 text: 'Save',
-                width: 65
+                layout:'anchor',
+                anchor: '100% 67%',
             },{
                 text: 'Pastebin',
-                width: 65
+                layout:'anchor',
+                anchor: '100% 100%',
             }]
         }]
     });
     
-    var DownloadButton = new Ext.Button({
-        text:'Download this Session',
-        region:'west'
-        }
-    );
-
     function fill_tree(my_pfs) {
         examine = my_pfs;
         treePanel.root.removeAll();
@@ -274,8 +265,7 @@
                 collapsible: true,
                 margins: '0 0 0 5',
                 layout: {
-                    type: 'absolute',
-                    animate: true
+                    type: 'anchor',
                 },
                 items: [
                     treePanel,


http://bitbucket.org/yt_analysis/yt/changeset/3daf98ad5fa5/
changeset:   r3957:3daf98ad5fa5
branch:      yt
user:        MatthewTurk
date:        2011-03-28 06:13:52
summary:     Adding initial status logging
affected #:  2 files (1.5 KB)

--- a/yt/gui/reason/extdirect_repl.py	Sun Mar 27 23:09:37 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Mon Mar 28 00:13:52 2011 -0400
@@ -27,6 +27,8 @@
 import json
 import os
 import cStringIO
+import logging
+from yt.utilities.logger import ytLogger, ufstring
 
 from .bottle_mods import preroute, BottleDirectRouter, notify_route, \
                          PayloadHandler
@@ -82,6 +84,13 @@
         # setting up.
         self.execute("from yt.mods import *")
         self.locals['load_script'] = ext_load_script
+        self._setup_logging_handlers()
+
+    def _setup_logging_handlers(self):
+        handler = PayloadLoggingHandler()
+        formatter = logging.Formatter(ufstring)
+        handler.setFormatter(formatter)
+        ytLogger.addHandler(handler)
 
     def index(self):
         """Return an HTTP-based Read-Eval-Print-Loop terminal."""
@@ -154,3 +163,15 @@
          'value': contents}
     )
     return
+
+class PayloadLoggingHandler(logging.StreamHandler):
+    def __init__(self, *args, **kwargs):
+        logging.StreamHandler.__init__(self, *args, **kwargs)
+        self.payload_handler = PayloadHandler()
+
+    def emit(self, record):
+        msg = self.format(record)
+        self.payload_handler.add_payload(
+            {'type':'log_entry',
+             'log_entry':msg})
+


--- a/yt/gui/reason/html/index.html	Sun Mar 27 23:09:37 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 00:13:52 2011 -0400
@@ -58,6 +58,8 @@
     function cell_sent() {
         repl_input.get('input_line').setReadOnly(true);
     }
+    var examine;
+    var number_log_records = 0;
 
     function cell_finished(result) {
         Ext.each(result['payloads'], function(payload, index) {
@@ -68,6 +70,12 @@
             } else if (payload['type'] == 'cell_contents') {
                 var input_line = repl_input.get("input_line")
                 input_line.setValue(payload['value']);
+            } else if (payload['type'] == 'log_entry') {
+                /*console.log(payload['log_entry']);*/
+                var record = new logging_store.recordType(
+                                {record: payload['log_entry'] });
+                number_log_records += 1;
+                logging_store.add(record, number_log_records);
             }
         });
         repl_input.get('input_line').setReadOnly(false);
@@ -229,6 +237,12 @@
           });
     };
 
+    var status_panel;
+    var logging_store = new Ext.data.Store({
+            fields: [{name:'record'}],
+            reader: new Ext.data.ArrayReader({}, [{name: 'record'}]),
+            });
+
     Ext.onReady(function(){
 
 Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
@@ -245,15 +259,19 @@
             items: [
             {
                 // lazily created panel (xtype:'panel' is default)
+                xtype: 'grid',
+                store: logging_store,
+                columns: [ {id:'record', header:'Logging Message',
+                            sortable: false} ],
                 region: 'south',
-                contentEl: 'south',
+                id: "status-region",
                 split: true,
                 height: 100,
                 minSize: 100,
                 maxSize: 200,
                 collapsible: true,
                 title: 'Status',
-                margins: '0 0 0 0'
+                margins: '0 0 0 0',
             }, {
                 region: 'west',
                 id: 'west-panel', // see Ext.getCmp() below
@@ -311,7 +329,8 @@
             w.collapsed ? w.expand() : w.collapse();
         });
         
-        notebook = viewport.get("center-panel").get("notebook")
+        notebook = viewport.get("center-panel").get("notebook");
+        status_panel = viewport.get("status-region").get("status-div");
     });
     </script></head>


http://bitbucket.org/yt_analysis/yt/changeset/c69d62adf0c7/
changeset:   r3958:c69d62adf0c7
branch:      yt
user:        MatthewTurk
date:        2011-03-28 06:59:13
summary:     Monospace the status and change the headers slightly
affected #:  2 files (247 bytes)

--- a/yt/gui/reason/bottle_mods.py	Mon Mar 28 00:13:52 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Mon Mar 28 00:59:13 2011 -0400
@@ -28,6 +28,7 @@
 import uuid
 from extdirect_router import DirectRouter, DirectProviderDefinition
 import json
+from yt.utilities.logger import ytLogger as mylog
 
 route_functions = {}
 route_watchers = []
@@ -129,4 +130,5 @@
     server_type = server_names.get("wsgiref")
     server = server_type(host='localhost', port=8080)
     #repl.locals['server'] = server
+    mylog.info("Starting up the server.")
     run(server=server)


--- a/yt/gui/reason/html/index.html	Mon Mar 28 00:13:52 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 00:59:13 2011 -0400
@@ -38,6 +38,10 @@
         padding-left: 20px;
         font-family: monospace;
     }
+    div#status-region div.x-grid3-cell-inner {
+        font-family: monospace;
+        font-size: 120%;
+    }
     </style><!-- GC -->
@@ -261,10 +265,12 @@
                 // lazily created panel (xtype:'panel' is default)
                 xtype: 'grid',
                 store: logging_store,
-                columns: [ {id:'record', header:'Logging Message',
+                columns: [ {id:'record', 
                             sortable: false} ],
+                autofill: true,
                 region: 'south',
                 id: "status-region",
+                cls: "status-logger",
                 split: true,
                 height: 100,
                 minSize: 100,


http://bitbucket.org/yt_analysis/yt/changeset/0418d37a5967/
changeset:   r3959:0418d37a5967
branch:      yt
user:        MatthewTurk
date:        2011-03-28 14:34:12
summary:     Adding a payload subpanel
affected #:  1 file (169 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 00:59:13 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 08:34:12 2011 -0400
@@ -65,12 +65,16 @@
     var examine;
     var number_log_records = 0;
 
-    function cell_finished(result) {
+    function cell_finished(result, new_cell) {
         Ext.each(result['payloads'], function(payload, index) {
             if (payload['type'] == 'png_string') {
-                Ext.get("cell_output").dom.innerHTML +=
-                    '<br/><img src="data:image/png;base64,' +
-                        payload['image_data'] + '"/>';
+                new_cell.add(new Ext.Panel({
+                                autoEl:{
+                                tag:'img',
+                                src:"data:image/png;base64," +
+                                        payload['image_data']
+                              }}));
+                new_cell.doLayout();
             } else if (payload['type'] == 'cell_contents') {
                 var input_line = repl_input.get("input_line")
                 input_line.setValue(payload['value']);
@@ -104,8 +108,8 @@
         notebook.get("output_container").add(cell);
         notebook.doLayout();
         input_line.setValue("");
-        res = a.result;
-        cell_finished(a.result);
+        res = cell;
+        cell_finished(a.result, cell);
     }
 
     var repl_input = new Ext.FormPanel({
@@ -157,12 +161,13 @@
             {id: name,
              items: [new Ext.Panel({
                         id:name+"_input",
-                        items:[{html:input}]
+                        html:input,
                         }),
                      new Ext.Panel({
                         id:name+"_result",
-                        items:[{html:result}]
-                        })]
+                        html:result,
+                        })
+                    ]
             }
         );
         return CellPanel;


http://bitbucket.org/yt_analysis/yt/changeset/d6379aa6574b/
changeset:   r3960:d6379aa6574b
branch:      yt
user:        MatthewTurk
date:        2011-03-28 15:24:57
summary:     Images are smaller
affected #:  1 file (63 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 08:34:12 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 09:24:57 2011 -0400
@@ -1,6 +1,6 @@
 <html><head>
-  <title>Complex Layout</title>
+  <title>Cinco Analysis Generator</title><link rel="stylesheet" type="text/css" href="resources/resources/css/ext-all.css" /><link rel="stylesheet" type="text/css" href="highlighter.css" />
     
@@ -70,7 +70,7 @@
             if (payload['type'] == 'png_string') {
                 new_cell.add(new Ext.Panel({
                                 autoEl:{
-                                tag:'img',
+                                tag:'img', width:'25%',
                                 src:"data:image/png;base64," +
                                         payload['image_data']
                               }}));
@@ -79,11 +79,9 @@
                 var input_line = repl_input.get("input_line")
                 input_line.setValue(payload['value']);
             } else if (payload['type'] == 'log_entry') {
-                /*console.log(payload['log_entry']);*/
                 var record = new logging_store.recordType(
                                 {record: payload['log_entry'] });
-                number_log_records += 1;
-                logging_store.add(record, number_log_records);
+                logging_store.add(record, number_log_records++);
             }
         });
         repl_input.get('input_line').setReadOnly(false);
@@ -278,7 +276,6 @@
                 cls: "status-logger",
                 split: true,
                 height: 100,
-                minSize: 100,
                 maxSize: 200,
                 collapsible: true,
                 title: 'Status',
@@ -342,6 +339,10 @@
         
         notebook = viewport.get("center-panel").get("notebook");
         status_panel = viewport.get("status-region").get("status-div");
+
+        var record = new logging_store.recordType(
+                        {record: '4d3d3d3 engaged' });
+        logging_store.add(record, number_log_records++);
     });
     </script></head>


http://bitbucket.org/yt_analysis/yt/changeset/4f5d8e540508/
changeset:   r3961:4f5d8e540508
branch:      yt
user:        Cameron Hummels
date:        2011-03-28 16:11:10
summary:     Added directional buttons to interactive plot window.
affected #:  1 file (389 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 09:24:57 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 10:11:10 2011 -0400
@@ -135,23 +135,29 @@
 
     var NorthButton = new Ext.Button(
         {text : 'North',
- //       pageX : 10,
-//        pageY : 50
-        anchor:'10% 5%'
+        pageX : 205,
+        pageY : 10
+//        handler: function(b, e) { window.open("session.py", "_top"); }
         }
     );
 
     var EastButton = new Ext.Button(
         {text:'East',
-//        pageX : '100%',
- //       pageY : '50%'
+        pageX : 410,
+        pageY : 205
         }
     );
     var SouthButton = new Ext.Button(
-        {text:'South'}
+        {text:'South',
+        pageX : 205,
+        pageY : 410
+        }
     );
     var WestButton = new Ext.Button(
-        {text:'West'}
+        {text:'West',
+        pageX : 10,
+        pageY : 205
+        }
     );
 
     function NewCell(name, input, result) {
@@ -182,9 +188,14 @@
         {
         title: 'Plot Window 1',
         autoScroll: true,
-        items: [ ]
-        }
-    );
+        layout:'absolute',
+        items: [ 
+            NorthButton,
+            EastButton,
+            SouthButton,
+            WestButton
+        ]
+    });
     var examine;
     var notebook;
     var treePanel = new Ext.tree.TreePanel({
@@ -319,14 +330,17 @@
                         html: "",
                         id: "cell_output",
                     }, repl_input, OutputContainer]
-                }, {
-                    title: 'Plot Window 1',
-                    iconCls: 'graph',
-                    closable: true,
-                    autoScroll: true,
-                    items: [ PlotPanel ]
-                        
-                }]
+                }, PlotPanel]
+//                }, {
+ //                   title: 'Plot Window 1',
+  //                  iconCls: 'graph',
+   //                 layout:'anchor',
+    //                anchor:'100% 100%',
+     //               closable: true,
+      //              autoScroll: true,
+       //             items: [ PlotPanel ]
+        //                
+         //       }]
             }]
         });
         // get a reference to the HTML element with id "hideit" and add a click listener to it 


http://bitbucket.org/yt_analysis/yt/changeset/efcdc03a35d6/
changeset:   r3962:efcdc03a35d6
branch:      yt
user:        jsoishi
date:        2011-03-28 15:44:26
summary:     PWViewerExtJS now adds its png strings to the payload handler rather than returning a set of strings. Modified invalidate_data() to no longer expect a return value from _setup_plots(), as this was only added to facilitate returning strings for ExtJS.
affected #:  1 file (87 bytes)

--- a/yt/visualization/plot_window.py	Mon Mar 28 09:24:57 2011 -0400
+++ b/yt/visualization/plot_window.py	Mon Mar 28 06:44:26 2011 -0700
@@ -40,7 +40,7 @@
         args[0]._plot_valid = False
         args[0]._recreate_frb()
         if args[0]._initfinished:
-            return args[0]._setup_plots()
+            args[0]._setup_plots()
 
     return newfunc
 
@@ -208,20 +208,19 @@
         self._field_transform[field] = func
 
     def _setup_plots(self):
-        plots = []
+        from yt.gui.reason.bottle_mods import PayloadHandler
+        import base64
+        ph = PayloadHandler()
         for field in self._frb.data.keys():
             tf = tempfile.TemporaryFile()
             to_plot = apply_colormap(self._frb[field],func = self._field_transform[field])
             write_png_to_file(to_plot, tf)
             tf.seek(0)
-            s = tf.read()
+            img_data = base64.b64encode(tf.read())
             tf.close()
-            ret = {}
-            ret['plot'] = s
-            ret['metadata'] = self.get_metadata()
-            plots.append(ret)
-
-        return plots
+            payload = {'type':'png_string',
+                       'image_data':img_data}
+            ph.add_payload(payload)
 
     def get_metadata(self):
         pass


http://bitbucket.org/yt_analysis/yt/changeset/39f0329c8cec/
changeset:   r3963:39f0329c8cec
branch:      yt
user:        MatthewTurk
date:        2011-03-28 15:54:45
summary:     Images open in another browser
affected #:  1 file (652 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 09:24:57 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 09:54:45 2011 -0400
@@ -64,6 +64,16 @@
     }
     var examine;
     var number_log_records = 0;
+    var number_images = 0;
+    function display_image(image_id) {
+        var image = Ext.get(image_id);
+        var src = image.dom.src;
+        var virtualdom = '<html><title>Image Viewer</title><body><img src="' + src + '"/></body></html>',
+            prev       = window.open('', 'image_viewer');
+        prev.document.open();
+        prev.document.write(virtualdom);
+        prev.document.close();
+    }
 
     function cell_finished(result, new_cell) {
         Ext.each(result['payloads'], function(payload, index) {
@@ -72,9 +82,13 @@
                                 autoEl:{
                                 tag:'img', width:'25%',
                                 src:"data:image/png;base64," +
-                                        payload['image_data']
+                                        payload['image_data'],
+                                id:"payload_image_" + number_images,
+                                onClick: "display_image('payload_image_" +
+                                          number_images + "');"
                               }}));
                 new_cell.doLayout();
+                number_images++;
             } else if (payload['type'] == 'cell_contents') {
                 var input_line = repl_input.get("input_line")
                 input_line.setValue(payload['value']);


http://bitbucket.org/yt_analysis/yt/changeset/4709f439eca9/
changeset:   r3964:4709f439eca9
branch:      yt
user:        MatthewTurk
date:        2011-03-28 15:55:15
summary:     Merging
affected #:  0 files (0 bytes)

--- a/yt/visualization/plot_window.py	Mon Mar 28 09:54:45 2011 -0400
+++ b/yt/visualization/plot_window.py	Mon Mar 28 09:55:15 2011 -0400
@@ -40,7 +40,7 @@
         args[0]._plot_valid = False
         args[0]._recreate_frb()
         if args[0]._initfinished:
-            return args[0]._setup_plots()
+            args[0]._setup_plots()
 
     return newfunc
 
@@ -208,20 +208,19 @@
         self._field_transform[field] = func
 
     def _setup_plots(self):
-        plots = []
+        from yt.gui.reason.bottle_mods import PayloadHandler
+        import base64
+        ph = PayloadHandler()
         for field in self._frb.data.keys():
             tf = tempfile.TemporaryFile()
             to_plot = apply_colormap(self._frb[field],func = self._field_transform[field])
             write_png_to_file(to_plot, tf)
             tf.seek(0)
-            s = tf.read()
+            img_data = base64.b64encode(tf.read())
             tf.close()
-            ret = {}
-            ret['plot'] = s
-            ret['metadata'] = self.get_metadata()
-            plots.append(ret)
-
-        return plots
+            payload = {'type':'png_string',
+                       'image_data':img_data}
+            ph.add_payload(payload)
 
     def get_metadata(self):
         pass


http://bitbucket.org/yt_analysis/yt/changeset/eef1eb4f761b/
changeset:   r3965:eef1eb4f761b
branch:      yt
user:        Cameron Hummels
date:        2011-03-28 16:13:51
summary:     Merged.
affected #:  1 file (652 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 10:11:10 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 10:13:51 2011 -0400
@@ -64,6 +64,16 @@
     }
     var examine;
     var number_log_records = 0;
+    var number_images = 0;
+    function display_image(image_id) {
+        var image = Ext.get(image_id);
+        var src = image.dom.src;
+        var virtualdom = '<html><title>Image Viewer</title><body><img src="' + src + '"/></body></html>',
+            prev       = window.open('', 'image_viewer');
+        prev.document.open();
+        prev.document.write(virtualdom);
+        prev.document.close();
+    }
 
     function cell_finished(result, new_cell) {
         Ext.each(result['payloads'], function(payload, index) {
@@ -72,9 +82,13 @@
                                 autoEl:{
                                 tag:'img', width:'25%',
                                 src:"data:image/png;base64," +
-                                        payload['image_data']
+                                        payload['image_data'],
+                                id:"payload_image_" + number_images,
+                                onClick: "display_image('payload_image_" +
+                                          number_images + "');"
                               }}));
                 new_cell.doLayout();
+                number_images++;
             } else if (payload['type'] == 'cell_contents') {
                 var input_line = repl_input.get("input_line")
                 input_line.setValue(payload['value']);


--- a/yt/visualization/plot_window.py	Mon Mar 28 10:11:10 2011 -0400
+++ b/yt/visualization/plot_window.py	Mon Mar 28 10:13:51 2011 -0400
@@ -40,7 +40,7 @@
         args[0]._plot_valid = False
         args[0]._recreate_frb()
         if args[0]._initfinished:
-            return args[0]._setup_plots()
+            args[0]._setup_plots()
 
     return newfunc
 
@@ -208,20 +208,19 @@
         self._field_transform[field] = func
 
     def _setup_plots(self):
-        plots = []
+        from yt.gui.reason.bottle_mods import PayloadHandler
+        import base64
+        ph = PayloadHandler()
         for field in self._frb.data.keys():
             tf = tempfile.TemporaryFile()
             to_plot = apply_colormap(self._frb[field],func = self._field_transform[field])
             write_png_to_file(to_plot, tf)
             tf.seek(0)
-            s = tf.read()
+            img_data = base64.b64encode(tf.read())
             tf.close()
-            ret = {}
-            ret['plot'] = s
-            ret['metadata'] = self.get_metadata()
-            plots.append(ret)
-
-        return plots
+            payload = {'type':'png_string',
+                       'image_data':img_data}
+            ph.add_payload(payload)
 
     def get_metadata(self):
         pass


http://bitbucket.org/yt_analysis/yt/changeset/b208b434a6ae/
changeset:   r3966:b208b434a6ae
branch:      yt
user:        Cameron Hummels
date:        2011-03-28 16:53:00
summary:     Playing with autoscroll on main yt terminal window.
affected #:  1 file (17 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 10:13:51 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 10:53:00 2011 -0400
@@ -130,6 +130,7 @@
             id: 'input_line',
             xtype: 'textarea',
             width: '100%',
+            autoScroll: true,
             fieldLabel: '>>>',
             name: 'line',
             allowBlank: 'True',
@@ -201,6 +202,7 @@
     var PlotPanel = new Ext.Panel(
         {
         title: 'Plot Window 1',
+        iconCls: 'graph',
         autoScroll: true,
         layout:'absolute',
         items: [ 
@@ -335,9 +337,8 @@
                 items: [{
                     title: 'YT',
                     id: 'notebook',
-                    iconCls: 'console',
                     closable: false,
-                    autoScroll: true,
+                    autoScroll: false,
                     iconCls: 'console',
                     items: [{ 
                         title: 'Output',


http://bitbucket.org/yt_analysis/yt/changeset/c4d5dc273482/
changeset:   r3967:c4d5dc273482
branch:      yt
user:        MatthewTurk
date:        2011-03-28 16:38:00
summary:     Adding ext to the install script
affected #:  1 file (294 bytes)

--- a/doc/install_script.sh	Mon Mar 28 10:13:51 2011 -0400
+++ b/doc/install_script.sh	Mon Mar 28 10:38:00 2011 -0400
@@ -294,6 +294,7 @@
 get_enzotools h5py-1.2.0.tar.gz
 get_enzotools Cython-0.14.tar.gz
 get_enzotools Forthon-0.8.4.tar.gz
+get_enzotools ext-3.3.2.zip
 
 if [ $INST_BZLIB -eq 1 ]
 then
@@ -522,6 +523,15 @@
     cd $MY_PWD
 fi
 
+# Now we open up the ext repository
+if [ ! -e ext-3.3.2/done ]
+then
+    ( unzip ext-3.3.2.zip 2>&1 ) 1>> ${LOG_FILE} || do_exit
+    ( echo "Symlinking ext-3.3.2 as ext-resources" 2>&1 ) 1>> ${LOG_FILE}
+    ln -sf ext-3.3.2 ext-resources
+    touch ext-3.3.2/done
+fi
+
 function print_afterword
 {
     echo


http://bitbucket.org/yt_analysis/yt/changeset/794412a757b9/
changeset:   r3968:794412a757b9
branch:      yt
user:        Cameron Hummels
date:        2011-03-28 16:53:09
summary:     merge.
affected #:  0 files (0 bytes)

--- a/doc/install_script.sh	Mon Mar 28 10:53:00 2011 -0400
+++ b/doc/install_script.sh	Mon Mar 28 10:53:09 2011 -0400
@@ -294,6 +294,7 @@
 get_enzotools h5py-1.2.0.tar.gz
 get_enzotools Cython-0.14.tar.gz
 get_enzotools Forthon-0.8.4.tar.gz
+get_enzotools ext-3.3.2.zip
 
 if [ $INST_BZLIB -eq 1 ]
 then
@@ -522,6 +523,15 @@
     cd $MY_PWD
 fi
 
+# Now we open up the ext repository
+if [ ! -e ext-3.3.2/done ]
+then
+    ( unzip ext-3.3.2.zip 2>&1 ) 1>> ${LOG_FILE} || do_exit
+    ( echo "Symlinking ext-3.3.2 as ext-resources" 2>&1 ) 1>> ${LOG_FILE}
+    ln -sf ext-3.3.2 ext-resources
+    touch ext-3.3.2/done
+fi
+
 function print_afterword
 {
     echo


http://bitbucket.org/yt_analysis/yt/changeset/7baeb49078b7/
changeset:   r3969:7baeb49078b7
branch:      yt
user:        MatthewTurk
date:        2011-03-28 16:54:57
summary:     First pass at externally-locating the extjs resources
affected #:  2 files (447 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Mon Mar 28 10:38:00 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Mon Mar 28 10:54:57 2011 -0400
@@ -58,8 +58,9 @@
     _skip_expose = ('index', 'resources')
     my_name = "ExtDirectREPL"
 
-    def __init__(self, locals=None):
+    def __init__(self, extjs_path, locals=None):
         # First we do the standard initialization
+        self.extjs_path = extjs_path
         ProgrammaticREPL.__init__(self, locals)
         # Now, since we want to only preroute functions we know about, and
         # since they have different arguments, and most of all because we only
@@ -101,7 +102,7 @@
 
     def resources(self, path):
         # This will need to be changed.
-        pp = os.path.join(local_dir, "../../../../misc/ext/ext-3.3.1/", path)
+        pp = os.path.join(self.extjs_path, path)
         if not os.path.exists(pp):
             response.status = 404
             return


--- a/yt/utilities/command_line.py	Mon Mar 28 10:38:00 2011 -0400
+++ b/yt/utilities/command_line.py	Mon Mar 28 10:54:57 2011 -0400
@@ -912,12 +912,21 @@
         """
         Run the Web GUI
         """
+        # We have to do a couple things.
+        # First, we check that YT_DEST is set.
+        if "YT_DEST" not in os.environ:
+            print
+            print "*** You must set the environment variable YT_DEST ***"
+            print "*** to point to the installation location!        ***"
+            print
+            sys.exit(1)
+        extjs_path = os.path.join(os.environ["YT_DEST"], "src", "ext-resources")
         from yt.config import ytcfg;ytcfg["yt","__withinreason"]="True"
         import yt.gui.reason.bottle as bottle
         from yt.gui.reason.extdirect_repl import ExtDirectREPL
         from yt.gui.reason.bottle_mods import uuid_serve_functions
 
-        hr = ExtDirectREPL()
+        hr = ExtDirectREPL(extjs_path)
         bottle.debug()
         uuid_serve_functions(open_browser=True)
 


http://bitbucket.org/yt_analysis/yt/changeset/914e73760ec5/
changeset:   r3970:914e73760ec5
branch:      yt
user:        MatthewTurk
date:        2011-03-28 16:55:13
summary:     Merging
affected #:  0 files (0 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 10:54:57 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 10:55:13 2011 -0400
@@ -130,6 +130,7 @@
             id: 'input_line',
             xtype: 'textarea',
             width: '100%',
+            autoScroll: true,
             fieldLabel: '>>>',
             name: 'line',
             allowBlank: 'True',
@@ -201,6 +202,7 @@
     var PlotPanel = new Ext.Panel(
         {
         title: 'Plot Window 1',
+        iconCls: 'graph',
         autoScroll: true,
         layout:'absolute',
         items: [ 
@@ -335,9 +337,8 @@
                 items: [{
                     title: 'YT',
                     id: 'notebook',
-                    iconCls: 'console',
                     closable: false,
-                    autoScroll: true,
+                    autoScroll: false,
                     iconCls: 'console',
                     items: [{ 
                         title: 'Output',


http://bitbucket.org/yt_analysis/yt/changeset/ae901a8a6b37/
changeset:   r3971:ae901a8a6b37
branch:      yt
user:        brittonsmith
date:        2011-03-28 16:58:51
summary:     Added -o to ext unzip.
affected #:  1 file (3 bytes)

--- a/doc/install_script.sh	Mon Mar 28 10:53:09 2011 -0400
+++ b/doc/install_script.sh	Mon Mar 28 10:58:51 2011 -0400
@@ -526,7 +526,7 @@
 # Now we open up the ext repository
 if [ ! -e ext-3.3.2/done ]
 then
-    ( unzip ext-3.3.2.zip 2>&1 ) 1>> ${LOG_FILE} || do_exit
+    ( unzip -o ext-3.3.2.zip 2>&1 ) 1>> ${LOG_FILE} || do_exit
     ( echo "Symlinking ext-3.3.2 as ext-resources" 2>&1 ) 1>> ${LOG_FILE}
     ln -sf ext-3.3.2 ext-resources
     touch ext-3.3.2/done


http://bitbucket.org/yt_analysis/yt/changeset/f206b2a96834/
changeset:   r3972:f206b2a96834
branch:      yt
user:        brittonsmith
date:        2011-03-28 16:59:02
summary:     Merged.
affected #:  0 files (0 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Mon Mar 28 10:58:51 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Mon Mar 28 10:59:02 2011 -0400
@@ -58,8 +58,9 @@
     _skip_expose = ('index', 'resources')
     my_name = "ExtDirectREPL"
 
-    def __init__(self, locals=None):
+    def __init__(self, extjs_path, locals=None):
         # First we do the standard initialization
+        self.extjs_path = extjs_path
         ProgrammaticREPL.__init__(self, locals)
         # Now, since we want to only preroute functions we know about, and
         # since they have different arguments, and most of all because we only
@@ -101,7 +102,7 @@
 
     def resources(self, path):
         # This will need to be changed.
-        pp = os.path.join(local_dir, "../../../../misc/ext/ext-3.3.1/", path)
+        pp = os.path.join(self.extjs_path, path)
         if not os.path.exists(pp):
             response.status = 404
             return


--- a/yt/utilities/command_line.py	Mon Mar 28 10:58:51 2011 -0400
+++ b/yt/utilities/command_line.py	Mon Mar 28 10:59:02 2011 -0400
@@ -912,12 +912,21 @@
         """
         Run the Web GUI
         """
+        # We have to do a couple things.
+        # First, we check that YT_DEST is set.
+        if "YT_DEST" not in os.environ:
+            print
+            print "*** You must set the environment variable YT_DEST ***"
+            print "*** to point to the installation location!        ***"
+            print
+            sys.exit(1)
+        extjs_path = os.path.join(os.environ["YT_DEST"], "src", "ext-resources")
         from yt.config import ytcfg;ytcfg["yt","__withinreason"]="True"
         import yt.gui.reason.bottle as bottle
         from yt.gui.reason.extdirect_repl import ExtDirectREPL
         from yt.gui.reason.bottle_mods import uuid_serve_functions
 
-        hr = ExtDirectREPL()
+        hr = ExtDirectREPL(extjs_path)
         bottle.debug()
         uuid_serve_functions(open_browser=True)
 


http://bitbucket.org/yt_analysis/yt/changeset/80aa56a9f933/
changeset:   r3973:80aa56a9f933
branch:      yt
user:        brittonsmith
date:        2011-03-28 17:00:13
summary:     Removed fake pf data file.
affected #:  1 file (0 bytes)

--- a/yt/gui/reason/html/pf_data.js	Mon Mar 28 10:59:02 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-var my_pfs = [{name: "pf1", objects: [
-                              {name: "sp1", type: "sphere"},
-                              {name: "sp2", type: "sphere"}
-				      ]},
-              {name: "pf2", objects: [
-                              {name: 'r1', type: "region"},
-                              {name: 'ad', type: "all_data"}]},
-              {name: "pf3", objects: []}]


http://bitbucket.org/yt_analysis/yt/changeset/655373b2e082/
changeset:   r3974:655373b2e082
branch:      yt
user:        MatthewTurk
date:        2011-03-28 17:04:32
summary:     Updating width of the columns
affected #:  1 file (39 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 11:00:13 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 11:04:32 2011 -0400
@@ -296,7 +296,8 @@
                 xtype: 'grid',
                 store: logging_store,
                 columns: [ {id:'record', 
-                            sortable: false} ],
+                            sortable: false,
+                            width:800} ],
                 autofill: true,
                 region: 'south',
                 id: "status-region",


http://bitbucket.org/yt_analysis/yt/changeset/7bee492e30b0/
changeset:   r3975:7bee492e30b0
branch:      yt
user:        brittonsmith
date:        2011-03-28 17:32:23
summary:     Removed some junk, added some icons.
affected #:  3 files (10.8 KB)

Binary file yt/gui/reason/html/images/binary.png has changed


Binary file yt/gui/reason/html/images/kivio_flw.png has changed


--- a/yt/gui/reason/html/index.html	Mon Mar 28 11:04:32 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 11:32:23 2011 -0400
@@ -16,11 +16,11 @@
     p {
         margin:5px;
     }
-    .settings {
-        background-image:url(resources/examples/shared/icons/fam/folder_wrench.png);
+    pf_icon {
+        background-image:url(images/binary.png);
     }
-    .nav {
-        background-image:url(resources/examples/shared/icons/fam/folder_go.png);
+    data_object {
+        background-image:url(images/kivio_flw.png);
     }
     graph { 
         background-image:url(images/graph.png) !important; //add images to tabs
@@ -55,8 +55,7 @@
     <script type="text/javascript" src="resources/examples/shared/examples.js"></script><script type="text/javascript" src="resources/ext-repl-api.js"></script><script type="text/javascript" src="resources/ext-pflist-api.js"></script>
-    <script type="text/javascript" src="pf_data.js"></script>
- 
+
     <script type="text/javascript">
     var viewport;
     function cell_sent() {
@@ -262,11 +261,11 @@
         treePanel.root.removeAll();
       Ext.each(my_pfs, function(pf, index) {
           treePanel.root.appendChild(new Ext.tree.TreeNode({text: pf.name,
-              leaf:false, expanded:true}));
+              leaf:false, expanded:true, iconCls: 'pf_icon'}));
           this_pf = treePanel.root.lastChild
           Ext.each(pf.objects, function(object, obj_index) {
             this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
-                leaf: true}));
+                leaf: true, iconCls: 'data_object'}));
             });
           });
     };


http://bitbucket.org/yt_analysis/yt/changeset/b09277e5ff6a/
changeset:   r3976:b09277e5ff6a
branch:      yt
user:        brittonsmith
date:        2011-03-28 17:44:27
summary:     Removed unused divs.
affected #:  1 file (650 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 11:32:23 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 11:44:27 2011 -0400
@@ -377,14 +377,6 @@
 </head><body><!-- use class="x-hide-display" to prevent a brief flicker of the content -->
-    <div id="west" class="x-hide-display">
-        <p>Hi. I'm the west panel.</p>
-    </div>
-    <div id="center2" class="x-hide-display">
-        <a id="hideit" href="#">Toggle the west region</a>
-        <hr>
-        <p>Duis hendrerit, est vel lobortis sagittis, tortor erat scelerisque tortor, sed pellentesque sem enim id metus. Maecenas at pede. Nulla velit libero, dictum at, mattis quis, sagittis vel, ante. Phasellus faucibus rutrum dui. Cras mauris elit, bibendum at, feugiat non, porta id, neque. Nulla et felis nec odio mollis vehicula. Donec elementum tincidunt mauris. Duis vel dui. Fusce iaculis enim ac nulla. In risus.</p>
-    </div><div id="props-panel" class="x-hide-display" style="width:200px;height:200px;overflow:hidden;"></div><div id="south" class="x-hide-display">


http://bitbucket.org/yt_analysis/yt/changeset/541320308b08/
changeset:   r3977:541320308b08
branch:      yt
user:        MatthewTurk
date:        2011-03-28 17:46:02
summary:     Setting relative/absolute for the notebook
affected #:  1 file (13 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 11:04:32 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 11:46:02 2011 -0400
@@ -126,6 +126,7 @@
 
     var repl_input = new Ext.FormPanel({
         url: 'push',
+        height: 100,
         items: [{
             id: 'input_line',
             xtype: 'textarea',
@@ -196,6 +197,7 @@
           title: 'YT Output',
           id: 'output_container',
           autoScroll: true,
+          flex: 1.0,
           items: []
         });
 
@@ -338,14 +340,12 @@
                 items: [{
                     title: 'YT',
                     id: 'notebook',
+                    layout: 'vbox',
+                    layoutConfig: {align:'stretch'},
                     closable: false,
                     autoScroll: false,
                     iconCls: 'console',
-                    items: [{ 
-                        title: 'Output',
-                        html: "",
-                        id: "cell_output",
-                    }, repl_input, OutputContainer]
+                    items: [repl_input, OutputContainer]
                 }, PlotPanel]
 //                }, {
  //                   title: 'Plot Window 1',


http://bitbucket.org/yt_analysis/yt/changeset/489ce30f5e3d/
changeset:   r3978:489ce30f5e3d
branch:      yt
user:        MatthewTurk
date:        2011-03-28 17:46:24
summary:     Merge
affected #:  1 file (729 bytes)

Binary file yt/gui/reason/html/images/binary.png has changed


Binary file yt/gui/reason/html/images/kivio_flw.png has changed


--- a/yt/gui/reason/html/index.html	Mon Mar 28 11:46:02 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 11:46:24 2011 -0400
@@ -16,11 +16,11 @@
     p {
         margin:5px;
     }
-    .settings {
-        background-image:url(resources/examples/shared/icons/fam/folder_wrench.png);
+    pf_icon {
+        background-image:url(images/binary.png);
     }
-    .nav {
-        background-image:url(resources/examples/shared/icons/fam/folder_go.png);
+    data_object {
+        background-image:url(images/kivio_flw.png);
     }
     graph { 
         background-image:url(images/graph.png) !important; //add images to tabs
@@ -55,8 +55,7 @@
     <script type="text/javascript" src="resources/examples/shared/examples.js"></script><script type="text/javascript" src="resources/ext-repl-api.js"></script><script type="text/javascript" src="resources/ext-pflist-api.js"></script>
-    <script type="text/javascript" src="pf_data.js"></script>
- 
+
     <script type="text/javascript">
     var viewport;
     function cell_sent() {
@@ -264,11 +263,11 @@
         treePanel.root.removeAll();
       Ext.each(my_pfs, function(pf, index) {
           treePanel.root.appendChild(new Ext.tree.TreeNode({text: pf.name,
-              leaf:false, expanded:true}));
+              leaf:false, expanded:true, iconCls: 'pf_icon'}));
           this_pf = treePanel.root.lastChild
           Ext.each(pf.objects, function(object, obj_index) {
             this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
-                leaf: true}));
+                leaf: true, iconCls: 'data_object'}));
             });
           });
     };
@@ -378,14 +377,6 @@
 </head><body><!-- use class="x-hide-display" to prevent a brief flicker of the content -->
-    <div id="west" class="x-hide-display">
-        <p>Hi. I'm the west panel.</p>
-    </div>
-    <div id="center2" class="x-hide-display">
-        <a id="hideit" href="#">Toggle the west region</a>
-        <hr>
-        <p>Duis hendrerit, est vel lobortis sagittis, tortor erat scelerisque tortor, sed pellentesque sem enim id metus. Maecenas at pede. Nulla velit libero, dictum at, mattis quis, sagittis vel, ante. Phasellus faucibus rutrum dui. Cras mauris elit, bibendum at, feugiat non, porta id, neque. Nulla et felis nec odio mollis vehicula. Donec elementum tincidunt mauris. Duis vel dui. Fusce iaculis enim ac nulla. In risus.</p>
-    </div><div id="props-panel" class="x-hide-display" style="width:200px;height:200px;overflow:hidden;"></div><div id="south" class="x-hide-display">


http://bitbucket.org/yt_analysis/yt/changeset/f97c9a059711/
changeset:   r3979:f97c9a059711
branch:      yt
user:        MatthewTurk
date:        2011-03-28 17:53:28
summary:     Flex layout for the notebook and cells, fixing the missing DIV issue
affected #:  1 file (128 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 11:46:24 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 11:53:28 2011 -0400
@@ -125,13 +125,13 @@
 
     var repl_input = new Ext.FormPanel({
         url: 'push',
-        height: 100,
+        flex: 0.2,
+        layout: 'fit',
         items: [{
             id: 'input_line',
             xtype: 'textarea',
             width: '100%',
             autoScroll: true,
-            fieldLabel: '>>>',
             name: 'line',
             allowBlank: 'True',
             bodyStyle: 'font-family: "monospace";',
@@ -196,7 +196,7 @@
           title: 'YT Output',
           id: 'output_container',
           autoScroll: true,
-          flex: 1.0,
+          flex: 0.8,
           items: []
         });
 
@@ -377,10 +377,14 @@
 </head><body><!-- use class="x-hide-display" to prevent a brief flicker of the content -->
+    <div id="west" class="x-hide-display">
+    </div>
+    <div id="center2" class="x-hide-display">
+        <a id="hideit" href="#">Toggle the west region</a>
+    </div><div id="props-panel" class="x-hide-display" style="width:200px;height:200px;overflow:hidden;"></div><div id="south" class="x-hide-display">
-        <p>4d3d3d3 engaged.</p></div></body></html>


http://bitbucket.org/yt_analysis/yt/changeset/ee08efed4970/
changeset:   r3980:ee08efed4970
branch:      yt
user:        Cameron Hummels
date:        2011-03-28 21:23:06
summary:     Added separators between save buttons.
affected #:  1 file (75 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 11:53:28 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 15:23:06 2011 -0400
@@ -234,26 +234,25 @@
      });
 
     var ButtonGroupPanel = new Ext.Panel({
-        layout: 'anchor',
         ButtonAlign: 'center',
+        layout:'anchor',
+        align:'stretch',
         collapsible: false,
         renderTo: document.body,
         tbar: [{
             xtype: 'buttongroup',
-            columns: 3,
+            columns: 5,
             items: [{
                 text: 'Download',
-                layout:'anchor',
-                anchor: '100% 33%',
                 handler: function(b, e) { window.open("session.py", "_top"); }
+            }, {
+                xtype: 'tbseparator'
+            }, {
+                text: 'Save',
             },{
-                text: 'Save',
-                layout:'anchor',
-                anchor: '100% 67%',
-            },{
+                xtype: 'tbseparator'
+            }, {
                 text: 'Pastebin',
-                layout:'anchor',
-                anchor: '100% 100%',
             }]
         }]
     });


http://bitbucket.org/yt_analysis/yt/changeset/1c23f5f16a98/
changeset:   r3981:1c23f5f16a98
branch:      yt
user:        MatthewTurk
date:        2011-03-28 18:14:26
summary:     Adding some more routers
affected #:  2 files (220 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Mon Mar 28 11:53:28 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Mon Mar 28 12:14:26 2011 -0400
@@ -55,7 +55,7 @@
 local_dir = os.path.dirname(__file__)
 
 class ExtDirectREPL(ProgrammaticREPL, BottleDirectRouter):
-    _skip_expose = ('index', 'resources')
+    _skip_expose = ('index')
     my_name = "ExtDirectREPL"
 
     def __init__(self, extjs_path, locals=None):
@@ -69,9 +69,10 @@
         # than through metaclasses or other fancy decorating.
         preroute_table = dict(index = ("/", "GET"),
                               _myapi = ("/resources/ext-repl-api.js", "GET"),
-                              resources = ("/resources/:path#.+#", "GET"),
+                              _resources = ("/resources/:path#.+#", "GET"),
+                              _js = ("/js/:path#.+#", "GET"),
+                              _images = ("/images/:path#.+#", "GET"),
                               _session_py = ("/session.py", "GET"),
-                              _ace = ("/ace/:path#.+#", "GET"),
                               _highlighter_css = ("/highlighter.css", "GET"),
                               )
         for v, args in preroute_table.items():
@@ -100,17 +101,22 @@
         vals = open(os.path.join(local_dir, "html/index.html")).read()
         return vals
 
-    def resources(self, path):
-        # This will need to be changed.
+    def _resources(self, path):
         pp = os.path.join(self.extjs_path, path)
         if not os.path.exists(pp):
             response.status = 404
             return
         return open(pp).read()
 
-    def _ace(self, path):
-        # This will need to be changed.
-        pp = os.path.join(local_dir, "ace", path)
+    def _js(self, path):
+        pp = os.path.join(local_dir, "html", "js", path)
+        if not os.path.exists(pp):
+            response.status = 404
+            return
+        return open(pp).read()
+
+    def _images(self, path):
+        pp = os.path.join(local_dir, "html", "images", path)
         if not os.path.exists(pp):
             response.status = 404
             return


--- a/yt/gui/reason/html/index.html	Mon Mar 28 11:53:28 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 12:14:26 2011 -0400
@@ -124,6 +124,7 @@
     }
 
     var repl_input = new Ext.FormPanel({
+        title: 'YT Input',
         url: 'push',
         flex: 0.2,
         layout: 'fit',


http://bitbucket.org/yt_analysis/yt/changeset/0ffe89a40215/
changeset:   r3982:0ffe89a40215
branch:      yt
user:        brittonsmith
date:        2011-03-28 18:24:59
summary:     Moved fill_tree function to separate file.
affected #:  2 files (940 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 12:14:26 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 12:24:59 2011 -0400
@@ -56,6 +56,9 @@
     <script type="text/javascript" src="resources/ext-repl-api.js"></script><script type="text/javascript" src="resources/ext-pflist-api.js"></script>
 
+    <!-- LOCAL FUNCTIONS -->
+    <script type="text/javascript" src="js/functions.js"></script>
+
     <script type="text/javascript">
     var viewport;
     function cell_sent() {
@@ -259,20 +262,6 @@
         }]
     });
     
-    function fill_tree(my_pfs) {
-        examine = my_pfs;
-        treePanel.root.removeAll();
-      Ext.each(my_pfs, function(pf, index) {
-          treePanel.root.appendChild(new Ext.tree.TreeNode({text: pf.name,
-              leaf:false, expanded:true, iconCls: 'pf_icon'}));
-          this_pf = treePanel.root.lastChild
-          Ext.each(pf.objects, function(object, obj_index) {
-            this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
-                leaf: true, iconCls: 'data_object'}));
-            });
-          });
-    };
-
     var status_panel;
     var logging_store = new Ext.data.Store({
             fields: [{name:'record'}],


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/js/functions.js	Mon Mar 28 12:24:59 2011 -0400
@@ -0,0 +1,13 @@
+function fill_tree(my_pfs) {
+  examine = my_pfs;
+  treePanel.root.removeAll();
+  Ext.each(my_pfs, function(pf, index) {
+      treePanel.root.appendChild(new Ext.tree.TreeNode({text: pf.name,
+              leaf:false, expanded:true, iconCls: 'pf_icon'}));
+      this_pf = treePanel.root.lastChild
+	Ext.each(pf.objects, function(object, obj_index) {
+            this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
+		    leaf: true, iconCls: 'data_object'}));
+	  });
+    });
+};


http://bitbucket.org/yt_analysis/yt/changeset/17e9b1b638cf/
changeset:   r3983:17e9b1b638cf
branch:      yt
user:        brittonsmith
date:        2011-03-28 18:28:58
summary:     Cleaned up a bit.
affected #:  1 file (124 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 12:24:59 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 12:28:58 2011 -0400
@@ -44,15 +44,11 @@
     }
     </style>
 
-    <!-- GC --><!-- LIBS --><script type="text/javascript" src="resources/adapter/ext/ext-base.js"></script>
-    <!-- ENDLIBS -->
-
     <script type="text/javascript" src="resources/ext-all.js"></script>
 
-    <!-- EXAMPLES -->
-    <script type="text/javascript" src="resources/examples/shared/examples.js"></script>
+    <!-- INTERACTIVE --><script type="text/javascript" src="resources/ext-repl-api.js"></script><script type="text/javascript" src="resources/ext-pflist-api.js"></script>
 


http://bitbucket.org/yt_analysis/yt/changeset/7c0e6a612e89/
changeset:   r3984:7c0e6a612e89
branch:      yt
user:        MatthewTurk
date:        2011-03-28 18:33:12
summary:     Adding an auto-scroll mechanism
affected #:  1 file (245 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 12:14:26 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 12:33:12 2011 -0400
@@ -116,11 +116,15 @@
             formatted_input = a.result['input']
         }
         var cell = NewCell("cell_"+cell_count, formatted_input, text);
-        notebook.get("output_container").add(cell);
+        OutputContainer.add(cell);
         notebook.doLayout();
         input_line.setValue("");
-        res = cell;
         cell_finished(a.result, cell);
+        if (OutputContainer.items.length > 1) {
+          OutputContainer.body.dom.scrollTop =
+            OutputContainer.body.dom.scrollHeight -
+            cell.body.dom.scrollHeight - 20;
+        }
     }
 
     var repl_input = new Ext.FormPanel({
@@ -185,6 +189,8 @@
                         }),
                      new Ext.Panel({
                         id:name+"_result",
+                        autoScroll:true,
+                        width: "100%",
                         html:result,
                         })
                     ]


http://bitbucket.org/yt_analysis/yt/changeset/b999ef7f69fe/
changeset:   r3985:b999ef7f69fe
branch:      yt
user:        MatthewTurk
date:        2011-03-28 18:33:21
summary:     Merging
affected #:  1 file (579 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 12:33:12 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 12:33:21 2011 -0400
@@ -44,18 +44,17 @@
     }
     </style>
 
-    <!-- GC --><!-- LIBS --><script type="text/javascript" src="resources/adapter/ext/ext-base.js"></script>
-    <!-- ENDLIBS -->
-
     <script type="text/javascript" src="resources/ext-all.js"></script>
 
-    <!-- EXAMPLES -->
-    <script type="text/javascript" src="resources/examples/shared/examples.js"></script>
+    <!-- INTERACTIVE --><script type="text/javascript" src="resources/ext-repl-api.js"></script><script type="text/javascript" src="resources/ext-pflist-api.js"></script>
 
+    <!-- LOCAL FUNCTIONS -->
+    <script type="text/javascript" src="js/functions.js"></script>
+
     <script type="text/javascript">
     var viewport;
     function cell_sent() {
@@ -265,20 +264,6 @@
         }]
     });
     
-    function fill_tree(my_pfs) {
-        examine = my_pfs;
-        treePanel.root.removeAll();
-      Ext.each(my_pfs, function(pf, index) {
-          treePanel.root.appendChild(new Ext.tree.TreeNode({text: pf.name,
-              leaf:false, expanded:true, iconCls: 'pf_icon'}));
-          this_pf = treePanel.root.lastChild
-          Ext.each(pf.objects, function(object, obj_index) {
-            this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
-                leaf: true, iconCls: 'data_object'}));
-            });
-          });
-    };
-
     var status_panel;
     var logging_store = new Ext.data.Store({
             fields: [{name:'record'}],


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/js/functions.js	Mon Mar 28 12:33:21 2011 -0400
@@ -0,0 +1,13 @@
+function fill_tree(my_pfs) {
+  examine = my_pfs;
+  treePanel.root.removeAll();
+  Ext.each(my_pfs, function(pf, index) {
+      treePanel.root.appendChild(new Ext.tree.TreeNode({text: pf.name,
+              leaf:false, expanded:true, iconCls: 'pf_icon'}));
+      this_pf = treePanel.root.lastChild
+	Ext.each(pf.objects, function(object, obj_index) {
+            this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
+		    leaf: true, iconCls: 'data_object'}));
+	  });
+    });
+};


http://bitbucket.org/yt_analysis/yt/changeset/6918f4771646/
changeset:   r3986:6918f4771646
branch:      yt
user:        brittonsmith
date:        2011-03-28 18:43:04
summary:     Moved functions to functions file.
affected #:  2 files (4.0 KB)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 12:33:21 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 12:43:04 2011 -0400
@@ -57,48 +57,10 @@
 
     <script type="text/javascript">
     var viewport;
-    function cell_sent() {
-        repl_input.get('input_line').setReadOnly(true);
-    }
+
     var examine;
     var number_log_records = 0;
     var number_images = 0;
-    function display_image(image_id) {
-        var image = Ext.get(image_id);
-        var src = image.dom.src;
-        var virtualdom = '<html><title>Image Viewer</title><body><img src="' + src + '"/></body></html>',
-            prev       = window.open('', 'image_viewer');
-        prev.document.open();
-        prev.document.write(virtualdom);
-        prev.document.close();
-    }
-
-    function cell_finished(result, new_cell) {
-        Ext.each(result['payloads'], function(payload, index) {
-            if (payload['type'] == 'png_string') {
-                new_cell.add(new Ext.Panel({
-                                autoEl:{
-                                tag:'img', width:'25%',
-                                src:"data:image/png;base64," +
-                                        payload['image_data'],
-                                id:"payload_image_" + number_images,
-                                onClick: "display_image('payload_image_" +
-                                          number_images + "');"
-                              }}));
-                new_cell.doLayout();
-                number_images++;
-            } else if (payload['type'] == 'cell_contents') {
-                var input_line = repl_input.get("input_line")
-                input_line.setValue(payload['value']);
-            } else if (payload['type'] == 'log_entry') {
-                var record = new logging_store.recordType(
-                                {record: payload['log_entry'] });
-                logging_store.add(record, number_log_records++);
-            }
-        });
-        repl_input.get('input_line').setReadOnly(false);
-        yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
-    }
 
     var res;
     var cell_count = 0;
@@ -114,7 +76,7 @@
             text = "<pre>"+a.result['output']+"</pre>";
             formatted_input = a.result['input']
         }
-        var cell = NewCell("cell_"+cell_count, formatted_input, text);
+        var cell = new_cell("cell_"+cell_count, formatted_input, text);
         OutputContainer.add(cell);
         notebook.doLayout();
         input_line.setValue("");
@@ -179,25 +141,6 @@
         }
     );
 
-    function NewCell(name, input, result) {
-        var CellPanel = new Ext.Panel(
-            {id: name,
-             items: [new Ext.Panel({
-                        id:name+"_input",
-                        html:input,
-                        }),
-                     new Ext.Panel({
-                        id:name+"_result",
-                        autoScroll:true,
-                        width: "100%",
-                        html:result,
-                        })
-                    ]
-            }
-        );
-        return CellPanel;
-    }
-
     var OutputContainer = new Ext.Panel({
           title: 'YT Output',
           id: 'output_container',
@@ -272,7 +215,7 @@
 
     Ext.onReady(function(){
 
-Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
+        Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
 
         // NOTE: This is an example showing simple state management. During development,
         // it is generally best to disable state management as dynamically-generated ids


--- a/yt/gui/reason/html/js/functions.js	Mon Mar 28 12:33:21 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Mon Mar 28 12:43:04 2011 -0400
@@ -1,3 +1,45 @@
+function cell_finished(result, new_cell) {
+  Ext.each(result['payloads'], function(payload, index) {
+      if (payload['type'] == 'png_string') {
+	new_cell.add(new Ext.Panel({
+	    autoEl:{
+	      tag:'img', width:'25%',
+		  src:"data:image/png;base64," +
+		  payload['image_data'],
+		  id:"payload_image_" + number_images,
+		  onClick: "display_image('payload_image_" +
+		  number_images + "');"
+		  }}));
+	new_cell.doLayout();
+	number_images++;
+      } else if (payload['type'] == 'cell_contents') {
+	var input_line = repl_input.get("input_line")
+	  input_line.setValue(payload['value']);
+      } else if (payload['type'] == 'log_entry') {
+	var record = new logging_store.recordType(
+						  {record: payload['log_entry'] });
+	logging_store.add(record, number_log_records++);
+      }
+    });
+  repl_input.get('input_line').setReadOnly(false);
+  yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
+}
+
+function cell_sent() {
+  repl_input.get('input_line').setReadOnly(true);
+}
+
+function display_image(image_id) {
+  var image = Ext.get(image_id);
+  var src = image.dom.src;
+  var virtualdom = '<html><title>Image Viewer</title><body><img src="' + src + '"/></body></html>',
+  prev = window.open('', 'image_viewer');
+  prev.document.open();
+  prev.document.write(virtualdom);
+  prev.document.close();
+}
+
+// Create a tree in the left panel with the pfs and their objects.
 function fill_tree(my_pfs) {
   examine = my_pfs;
   treePanel.root.removeAll();
@@ -11,3 +53,22 @@
 	  });
     });
 };
+
+function new_cell(name, input, result) {
+  var CellPanel = new Ext.Panel(
+		    {id: name,
+		     items: [new Ext.Panel({
+			  id:name+"_input",
+			      html:input,
+			      }),
+		       new Ext.Panel({
+			 id:name+"_result",
+			     autoScroll:true,
+			     width: "100%",
+			     html:result,
+			     })
+		       ]
+			}
+			);
+  return CellPanel;
+}


http://bitbucket.org/yt_analysis/yt/changeset/ad2b16b16717/
changeset:   r3987:ad2b16b16717
branch:      yt
user:        brittonsmith
date:        2011-03-28 20:12:59
summary:     Moving javascript source out of index.html.
affected #:  2 files (14.3 KB)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 12:43:04 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 14:12:59 2011 -0400
@@ -55,260 +55,8 @@
     <!-- LOCAL FUNCTIONS --><script type="text/javascript" src="js/functions.js"></script>
 
-    <script type="text/javascript">
-    var viewport;
-
-    var examine;
-    var number_log_records = 0;
-    var number_images = 0;
-
-    var res;
-    var cell_count = 0;
-
-    var handle_result = function(f, a) {
-        var input_line = repl_input.get("input_line")
-        cell_count += 1;
-        if (a.result == null) {
-            text = "ERROR";
-            formatted_input = input_line.getValue();
-        } else {
-            //text = a.result['output'].replace(/\n/g,"<br/>");
-            text = "<pre>"+a.result['output']+"</pre>";
-            formatted_input = a.result['input']
-        }
-        var cell = new_cell("cell_"+cell_count, formatted_input, text);
-        OutputContainer.add(cell);
-        notebook.doLayout();
-        input_line.setValue("");
-        cell_finished(a.result, cell);
-        if (OutputContainer.items.length > 1) {
-          OutputContainer.body.dom.scrollTop =
-            OutputContainer.body.dom.scrollHeight -
-            cell.body.dom.scrollHeight - 20;
-        }
-    }
-
-    var repl_input = new Ext.FormPanel({
-        title: 'YT Input',
-        url: 'push',
-        flex: 0.2,
-        layout: 'fit',
-        items: [{
-            id: 'input_line',
-            xtype: 'textarea',
-            width: '100%',
-            autoScroll: true,
-            name: 'line',
-            allowBlank: 'True',
-            bodyStyle: 'font-family: "monospace";',
-            listeners: {
-                specialkey: function(f, e){
-                    if (e.getKey() == e.ENTER) {
-                        cell_sent();
-                        yt_rpc.ExtDirectREPL.execute({
-                            code:repl_input.get('input_line').getValue()},
-                            handle_result);
-                    }
-                }
-            },
-        },],
-    });
-
-    var NorthButton = new Ext.Button(
-        {text : 'North',
-        pageX : 205,
-        pageY : 10
-//        handler: function(b, e) { window.open("session.py", "_top"); }
-        }
-    );
-
-    var EastButton = new Ext.Button(
-        {text:'East',
-        pageX : 410,
-        pageY : 205
-        }
-    );
-    var SouthButton = new Ext.Button(
-        {text:'South',
-        pageX : 205,
-        pageY : 410
-        }
-    );
-    var WestButton = new Ext.Button(
-        {text:'West',
-        pageX : 10,
-        pageY : 205
-        }
-    );
-
-    var OutputContainer = new Ext.Panel({
-          title: 'YT Output',
-          id: 'output_container',
-          autoScroll: true,
-          flex: 0.8,
-          items: []
-        });
-
-    var PlotPanel = new Ext.Panel(
-        {
-        title: 'Plot Window 1',
-        iconCls: 'graph',
-        autoScroll: true,
-        layout:'absolute',
-        items: [ 
-            NorthButton,
-            EastButton,
-            SouthButton,
-            WestButton
-        ]
-    });
-    var examine;
-    var notebook;
-    var treePanel = new Ext.tree.TreePanel({
-        iconCls: 'nav',
-    	id: 'tree-panel',
-    	title: 'Objects',
-        layout: 'anchor',
-        region:'west',
-        split: true,
-        anchor: '100% -35',
-        minSize: 150,
-        autoScroll: true,
-        rootVisible: false,
-        root:new Ext.tree.TreeNode({
-          expanded:true
-         ,leaf:false
-         ,text:''
-        })
-     });
-
-    var ButtonGroupPanel = new Ext.Panel({
-        layout: 'anchor',
-        ButtonAlign: 'center',
-        collapsible: false,
-        renderTo: document.body,
-        tbar: [{
-            xtype: 'buttongroup',
-            columns: 3,
-            items: [{
-                text: 'Download',
-                layout:'anchor',
-                anchor: '100% 33%',
-                handler: function(b, e) { window.open("session.py", "_top"); }
-            },{
-                text: 'Save',
-                layout:'anchor',
-                anchor: '100% 67%',
-            },{
-                text: 'Pastebin',
-                layout:'anchor',
-                anchor: '100% 100%',
-            }]
-        }]
-    });
-    
-    var status_panel;
-    var logging_store = new Ext.data.Store({
-            fields: [{name:'record'}],
-            reader: new Ext.data.ArrayReader({}, [{name: 'record'}]),
-            });
-
-    Ext.onReady(function(){
-
-        Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
-
-        // NOTE: This is an example showing simple state management. During development,
-        // it is generally best to disable state management as dynamically-generated ids
-        // can change across page loads, leading to unpredictable results.  The developer
-        // should ensure that stable state ids are set for stateful components in real apps.
-        Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
-
-	// Go ahead and create the TreePanel now so that we can use it below
-        viewport = new Ext.Viewport({
-            layout: 'border',
-            items: [
-            {
-                // lazily created panel (xtype:'panel' is default)
-                xtype: 'grid',
-                store: logging_store,
-                columns: [ {id:'record', 
-                            sortable: false,
-                            width:800} ],
-                autofill: true,
-                region: 'south',
-                id: "status-region",
-                cls: "status-logger",
-                split: true,
-                height: 100,
-                maxSize: 200,
-                collapsible: true,
-                title: 'Status',
-                margins: '0 0 0 0',
-            }, {
-                region: 'west',
-                id: 'west-panel', // see Ext.getCmp() below
-                title: 'BETA Sequences',
-                split: true,
-                width: 200,
-                minSize: 175,
-                maxSize: 400,
-                collapsible: true,
-                margins: '0 0 0 5',
-                layout: {
-                    type: 'anchor',
-                },
-                items: [
-                    treePanel,
-                    ButtonGroupPanel
-                ]
-            },
-            // in this instance the TabPanel is not wrapped by another panel
-            // since no title is needed, this Panel is added directly
-            // as a Container
-            {
-                xtype: 'tabpanel',
-                region: 'center', // a center region is ALWAYS required for border layout
-                id: 'center-panel',
-                deferredRender: false,
-                activeTab: 0,     // first tab initially active
-                items: [{
-                    title: 'YT',
-                    id: 'notebook',
-                    layout: 'vbox',
-                    layoutConfig: {align:'stretch'},
-                    closable: false,
-                    autoScroll: false,
-                    iconCls: 'console',
-                    items: [repl_input, OutputContainer]
-                }, PlotPanel]
-//                }, {
- //                   title: 'Plot Window 1',
-  //                  iconCls: 'graph',
-   //                 layout:'anchor',
-    //                anchor:'100% 100%',
-     //               closable: true,
-      //              autoScroll: true,
-       //             items: [ PlotPanel ]
-        //                
-         //       }]
-            }]
-        });
-        // get a reference to the HTML element with id "hideit" and add a click listener to it 
-        Ext.get("hideit").on('click', function(){
-            // get a reference to the Panel that was created with id = 'west-panel' 
-            var w = Ext.getCmp('west-panel');
-            // expand or collapse that Panel based on its collapsed property state
-            w.collapsed ? w.expand() : w.collapse();
-        });
-        
-        notebook = viewport.get("center-panel").get("notebook");
-        status_panel = viewport.get("status-region").get("status-div");
-
-        var record = new logging_store.recordType(
-                        {record: '4d3d3d3 engaged' });
-        logging_store.add(record, number_log_records++);
-    });
-    </script>
+    <!-- THE MAIN FUNCTION -->
+    <script type="text/javascript" src="js/cinco.js"></script></head><body><!-- use class="x-hide-display" to prevent a brief flicker of the content -->


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/js/cinco.js	Mon Mar 28 14:12:59 2011 -0400
@@ -0,0 +1,255 @@
+var viewport;
+
+var examine;
+var number_log_records = 0;
+var number_images = 0;
+
+var res;
+var cell_count = 0;
+
+var handle_result = function(f, a) {
+  var input_line = repl_input.get("input_line")
+  cell_count += 1;
+  if (a.result == null) {
+    text = "ERROR";
+    formatted_input = input_line.getValue();
+  } else {
+    //text = a.result['output'].replace(/\n/g,"<br/>");
+    text = "<pre>"+a.result['output']+"</pre>";
+    formatted_input = a.result['input']
+  }
+  var cell = new_cell("cell_"+cell_count, formatted_input, text);
+  OutputContainer.add(cell);
+  notebook.doLayout();
+  input_line.setValue("");
+  cell_finished(a.result, cell);
+  if (OutputContainer.items.length > 1) {
+    OutputContainer.body.dom.scrollTop =
+      OutputContainer.body.dom.scrollHeight -
+      cell.body.dom.scrollHeight - 20;
+  }
+}
+
+var repl_input = new Ext.FormPanel({
+  title: 'YT Input',
+      url: 'push',
+      flex: 0.2,
+      layout: 'fit',
+      items: [{
+      id: 'input_line',
+	  xtype: 'textarea',
+	  width: '100%',
+	  autoScroll: true,
+	  name: 'line',
+	  allowBlank: 'True',
+	  bodyStyle: 'font-family: "monospace";',
+	  listeners: {
+	specialkey: function(f, e){
+	    if (e.getKey() == e.ENTER) {
+	      cell_sent();
+	      yt_rpc.ExtDirectREPL.execute({
+		code:repl_input.get('input_line').getValue()},
+		handle_result);
+	    }
+	  }
+	},
+	  },],
+      });
+
+var NorthButton = new Ext.Button(
+				 {text : 'North',
+				     pageX : 205,
+				     pageY : 10
+//        handler: function(b, e) { window.open("session.py", "_top"); }
+				     }
+				 );
+
+var EastButton = new Ext.Button(
+				{text:'East',
+				    pageX : 410,
+				    pageY : 205
+				    }
+				);
+var SouthButton = new Ext.Button(
+				 {text:'South',
+				     pageX : 205,
+				     pageY : 410
+				     }
+				 );
+var WestButton = new Ext.Button(
+				{text:'West',
+				    pageX : 10,
+				    pageY : 205
+				    }
+				);
+
+var OutputContainer = new Ext.Panel({
+  title: 'YT Output',
+      id: 'output_container',
+      autoScroll: true,
+      flex: 0.8,
+      items: []
+      });
+
+var PlotPanel = new Ext.Panel(
+			      {
+			      title: 'Plot Window 1',
+				  iconCls: 'graph',
+				  autoScroll: true,
+				  layout:'absolute',
+				  items: [ 
+					  NorthButton,
+					  EastButton,
+					  SouthButton,
+					  WestButton
+					   ]
+				  });
+var examine;
+var notebook;
+var treePanel = new Ext.tree.TreePanel({
+  iconCls: 'nav',
+      id: 'tree-panel',
+      title: 'Objects',
+      layout: 'anchor',
+      region:'west',
+      split: true,
+      anchor: '100% -35',
+      minSize: 150,
+      autoScroll: true,
+      rootVisible: false,
+      root:new Ext.tree.TreeNode({
+	expanded:true
+	    ,leaf:false
+	    ,text:''
+	    })
+      });
+
+var ButtonGroupPanel = new Ext.Panel({
+  layout: 'anchor',
+      ButtonAlign: 'center',
+      collapsible: false,
+      renderTo: document.body,
+      tbar: [{
+      xtype: 'buttongroup',
+	  columns: 3,
+	  items: [{
+	  text: 'Download',
+	      layout:'anchor',
+	      anchor: '100% 33%',
+	      handler: function(b, e) { window.open("session.py", "_top"); }
+	  },{
+	  text: 'Save',
+	      layout:'anchor',
+	      anchor: '100% 67%',
+	      },{
+	  text: 'Pastebin',
+                layout:'anchor',
+                anchor: '100% 100%',
+		}]
+	  }]
+      });
+
+var status_panel;
+var logging_store = new Ext.data.Store({
+  fields: [{name:'record'}],
+      reader: new Ext.data.ArrayReader({}, [{name: 'record'}]),
+      });
+
+Ext.onReady(function(){
+    
+    Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
+
+    // NOTE: This is an example showing simple state management. During development,
+    // it is generally best to disable state management as dynamically-generated ids
+    // can change across page loads, leading to unpredictable results.  The developer
+    // should ensure that stable state ids are set for stateful components in real apps.
+    // it's a cold day for pontooning.
+    Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
+
+    // Go ahead and create the TreePanel now so that we can use it below
+    viewport = new Ext.Viewport({
+      layout: 'border',
+	  items: [
+		  {
+		    // lazily created panel (xtype:'panel' is default)
+		  xtype: 'grid',
+		      store: logging_store,
+		      columns: [ {id:'record', 
+			  sortable: false,
+			  width:800} ],
+		      autofill: true,
+		      region: 'south',
+		      id: "status-region",
+		      cls: "status-logger",
+		      split: true,
+		      height: 100,
+		      maxSize: 200,
+		      collapsible: true,
+		      title: 'Status',
+		      margins: '0 0 0 0',
+		      }, {
+		  region: 'west',
+		      id: 'west-panel', // see Ext.getCmp() below
+		      title: 'BETA Sequences',
+		      split: true,
+		      width: 200,
+		      minSize: 175,
+		      maxSize: 400,
+		      collapsible: true,
+		      margins: '0 0 0 5',
+		      layout: {
+                    type: 'anchor',
+			},
+		      items: [
+			      treePanel,
+			      ButtonGroupPanel
+			      ]
+		      },
+		  // in this instance the TabPanel is not wrapped by another panel
+		  // since no title is needed, this Panel is added directly
+		  // as a Container
+		  {
+		  xtype: 'tabpanel',
+		      region: 'center', // a center region is ALWAYS required for border layout
+		      id: 'center-panel',
+		      deferredRender: false,
+		      activeTab: 0,     // first tab initially active
+		      items: [{
+		      title: 'YT',
+			  id: 'notebook',
+			  layout: 'vbox',
+			  layoutConfig: {align:'stretch'},
+			  closable: false,
+			  autoScroll: false,
+			  iconCls: 'console',
+			  items: [repl_input, OutputContainer]
+			  }, PlotPanel]
+		      //                }, {
+		      //                   title: 'Plot Window 1',
+		      //                  iconCls: 'graph',
+		      //                 layout:'anchor',
+		      //                anchor:'100% 100%',
+		      //               closable: true,
+		      //              autoScroll: true,
+		      //             items: [ PlotPanel ]
+		      //                
+		      //       }]
+		      }]
+	  });
+    // get a reference to the HTML element with id "hideit" and add a click listener to it 
+    console.log('Mitchell!\nPardon me! Mitchell!')
+    Ext.get("hideit").on('click', function(){
+	// get a reference to the Panel that was created with id = 'west-panel' 
+	var w = Ext.getCmp('west-panel');
+	// expand or collapse that Panel based on its collapsed property state
+	// need to make room for six sour cream burritos
+	w.collapsed ? w.expand() : w.collapse();
+      });
+    
+    notebook = viewport.get("center-panel").get("notebook");
+    status_panel = viewport.get("status-region").get("status-div");
+    
+    var record = new logging_store.recordType(
+					      {record: '4d3d3d3 engaged' });
+    logging_store.add(record, number_log_records++);
+  });


http://bitbucket.org/yt_analysis/yt/changeset/347672a4e56c/
changeset:   r3988:347672a4e56c
branch:      yt
user:        MatthewTurk
date:        2011-03-28 20:44:57
summary:     Removing the cell divivers (overruled!) and adding icons.
affected #:  5 files (1.8 KB)

Binary file yt/gui/reason/html/images/console_tab.png has changed


Binary file yt/gui/reason/html/images/graph_tab.png has changed


--- a/yt/gui/reason/html/index.html	Mon Mar 28 14:12:59 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 14:44:57 2011 -0400
@@ -16,17 +16,17 @@
     p {
         margin:5px;
     }
-    pf_icon {
+    .pf_icon {
         background-image:url(images/binary.png);
     }
-    data_object {
+    .data_object {
         background-image:url(images/kivio_flw.png);
     }
-    graph { 
-        background-image:url(images/graph.png) !important; //add images to tabs
+    .graph { 
+        background-image:url(images/graph_tab.png) !important; //add images to tabs
     }
-    console { 
-        background-image:url(images/console.png) !important;
+    .console { 
+        background-image:url(images/console_tab.png) !important;
     }
     #input_line {
         font-family: monospace;


--- a/yt/gui/reason/html/js/cinco.js	Mon Mar 28 14:12:59 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Mon Mar 28 14:44:57 2011 -0400
@@ -9,7 +9,6 @@
 
 var handle_result = function(f, a) {
   var input_line = repl_input.get("input_line")
-  cell_count += 1;
   if (a.result == null) {
     text = "ERROR";
     formatted_input = input_line.getValue();
@@ -18,7 +17,7 @@
     text = "<pre>"+a.result['output']+"</pre>";
     formatted_input = a.result['input']
   }
-  var cell = new_cell("cell_"+cell_count, formatted_input, text);
+  var cell = new_cell(formatted_input, text);
   OutputContainer.add(cell);
   notebook.doLayout();
   input_line.setValue("");
@@ -214,16 +213,17 @@
 		      id: 'center-panel',
 		      deferredRender: false,
 		      activeTab: 0,     // first tab initially active
-		      items: [{
-		      title: 'YT',
-			  id: 'notebook',
-			  layout: 'vbox',
-			  layoutConfig: {align:'stretch'},
-			  closable: false,
-			  autoScroll: false,
-			  iconCls: 'console',
-			  items: [repl_input, OutputContainer]
-			  }, PlotPanel]
+		      items: [
+                {
+		            title: 'YT',
+			        id: 'notebook',
+			        layout: 'vbox',
+			        layoutConfig: {align:'stretch'},
+			        closable: false,
+			        autoScroll: false,
+			        iconCls: 'console',
+			        items: [repl_input, OutputContainer]
+			    }, PlotPanel]
 		      //                }, {
 		      //                   title: 'Plot Window 1',
 		      //                  iconCls: 'graph',
@@ -252,4 +252,5 @@
     var record = new logging_store.recordType(
 					      {record: '4d3d3d3 engaged' });
     logging_store.add(record, number_log_records++);
+    repl_input.get("input_line").focus();
   });


--- a/yt/gui/reason/html/js/functions.js	Mon Mar 28 14:12:59 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Mon Mar 28 14:44:57 2011 -0400
@@ -23,6 +23,7 @@
     });
   repl_input.get('input_line').setReadOnly(false);
   yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
+  repl_input.get("input_line").focus();
 }
 
 function cell_sent() {
@@ -54,9 +55,10 @@
     });
 };
 
-function new_cell(name, input, result) {
+function new_cell(input, result) {
+  var name = "cell_" + cell_count;
   var CellPanel = new Ext.Panel(
-		    {id: name,
+		    {id: name, //title: "Cell " + cell_count,
 		     items: [new Ext.Panel({
 			  id:name+"_input",
 			      html:input,
@@ -70,5 +72,6 @@
 		       ]
 			}
 			);
+  cell_count++;
   return CellPanel;
 }


http://bitbucket.org/yt_analysis/yt/changeset/a5877c9def7a/
changeset:   r3989:a5877c9def7a
branch:      yt
user:        MatthewTurk
date:        2011-03-28 20:55:54
summary:     Adding icons to the tree
affected #:  5 files (25.8 KB)

Binary file yt/gui/reason/html/images/3d.png has changed


Binary file yt/gui/reason/html/images/3d_tab.png has changed


Binary file yt/gui/reason/html/images/blockdevice.png has changed


Binary file yt/gui/reason/html/images/blockdevice_tab.png has changed


--- a/yt/gui/reason/html/index.html	Mon Mar 28 14:44:57 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 14:55:54 2011 -0400
@@ -17,10 +17,10 @@
         margin:5px;
     }
     .pf_icon {
-        background-image:url(images/binary.png);
+        background-image:url(images/blockdevice_tab.png) !important;
     }
     .data_object {
-        background-image:url(images/kivio_flw.png);
+        background-image:url(images/3d_tab.png) !important;
     }
     .graph { 
         background-image:url(images/graph_tab.png) !important; //add images to tabs


http://bitbucket.org/yt_analysis/yt/changeset/609134aea7a4/
changeset:   r3990:609134aea7a4
branch:      yt
user:        jsoishi
date:        2011-03-28 17:54:42
summary:     refactored PlotWindowViewer.
affected #:  1 file (44 bytes)

--- a/yt/visualization/plot_window.py	Mon Mar 28 11:32:23 2011 -0400
+++ b/yt/visualization/plot_window.py	Mon Mar 28 08:54:42 2011 -0700
@@ -166,22 +166,8 @@
     def set_antialias(self,aa):
         self.antialias = aa
 
-class PWViewerRaw(PlotWindow):
-    """A PlotWindow viewer that writes raw pngs (no MPL, no axes).
-
-    """
-    def _setup_plots(self):
-        self.save('')
-        self._plot_valid = True
-
-    def save(self,name):
-        for field in self._frb.data.keys():
-            nm = "%s_%s.png" % (name,field)
-            print "writing %s" % nm
-            write_image(self._frb[field],nm)
-
-class PWViewerExtJS(PlotWindow):
-    """A viewer for the web interface.
+class PWViewer(PlotWindow):
+    """A viewer for PlotWindows.
 
     """
     def __init__(self, *args,**kwargs):
@@ -207,6 +193,46 @@
     def set_transform(self, field, func):
         self._field_transform[field] = func
 
+    @invalidate_plot
+    def set_cmap(self):
+        pass
+
+    @invalidate_plot
+    def set_zlim(self):
+        pass
+
+class PWViewerMPL(PWViewer):
+    """
+
+    """
+    def _setup_plots(self):
+        for f in self.fields:
+            self.plots[f] = YtWindowPlot(self._frb[f])
+        self._plot_valid = True
+
+    def save(self,name):
+        for k,v in self.plots.iteritems():
+            n = "%s_%s" % (name, k)
+            v.save(n)
+
+class PWViewerRaw(PWViewer):
+    """A PlotWindow viewer that writes raw pngs (no MPL, no axes).
+
+    """
+    def _setup_plots(self):
+        self.save('')
+        self._plot_valid = True
+
+    def save(self,name):
+        for field in self._frb.data.keys():
+            nm = "%s_%s.png" % (name,field)
+            print "writing %s" % nm
+            write_image(self._frb[field],nm)
+
+class PWViewerExtJS(PWViewer):
+    """A viewer for the web interface.
+
+    """
     def _setup_plots(self):
         from yt.gui.reason.bottle_mods import PayloadHandler
         import base64
@@ -225,26 +251,6 @@
     def get_metadata(self):
         pass
 
-class PWWiewer(PlotWindow):
-    """A viewer for PlotWindows.
-
-    """
-    def _setup_plots(self):
-        for f in self.fields:
-            self.plots[f] = YtWindowPlot(self._frb[f])
-        self._plot_valid = True
-
-    def save(self,name):
-        for k,v in self.plots.iteritems():
-            n = "%s_%s" % (name, k)
-            v.save(n)
-    @invalidate_plot
-    def set_cmap(self):
-        pass
-    @invalidate_plot
-    def set_zlim(self):
-        pass
-
 
 
 class YtPlot(object):


http://bitbucket.org/yt_analysis/yt/changeset/b6289a31b09a/
changeset:   r3991:b6289a31b09a
branch:      yt
user:        jsoishi
date:        2011-03-28 21:05:22
summary:     documentation and some refactoring
affected #:  1 file (355 bytes)

--- a/yt/visualization/plot_window.py	Mon Mar 28 08:54:42 2011 -0700
+++ b/yt/visualization/plot_window.py	Mon Mar 28 12:05:22 2011 -0700
@@ -123,8 +123,13 @@
 
     @invalidate_data
     def zoom(self, factor):
-        """
-        This zooms the window by *factor*.
+        r"""This zooms the window by *factor*.
+
+        Parameters
+        ----------
+        factor : float
+            multiplier for the current width
+
         """
         Wx, Wy = self.width
         centerx = self.xlim[0] + Wx*0.5
@@ -132,13 +137,16 @@
         nWx, nWy = Wx/factor, Wy/factor
         self.xlim = (centerx - nWx*0.5, centerx + nWx*0.5)
         self.ylim = (centery - nWy*0.5, centery + nWy*0.5)
-        #self._run_callbacks()
 
     @invalidate_data
     def pan(self, deltas):
-        """
-        This accepts a tuple of *deltas*, composed of (delta_x, delta_y) that
-        will pan the window by those values in absolute coordinates.
+        r"""Pan the image by specifying absolute code unit coordinate deltas.
+        
+        Parameters
+        ----------
+        deltas : sequence of floats
+            (delta_x, delta_y) in *absolute* code unit coordinates
+
         """
         self.xlim = (self.xlim[0] + deltas[0], self.xlim[1] + deltas[0])
         self.ylim = (self.ylim[0] + deltas[1], self.ylim[1] + deltas[1])
@@ -183,6 +191,13 @@
 
     def set_log(self,field,log):
         """set a field to log or linear.
+        
+        Parameters
+        ----------
+        field : string
+            the field to set a transform
+        log : boolean
+            Log on/off.
 
         """
         if log:
@@ -202,7 +217,7 @@
         pass
 
 class PWViewerMPL(PWViewer):
-    """
+    """Viewer using matplotlib as a backend via the YtWindowPlot. 
 
     """
     def _setup_plots(self):


http://bitbucket.org/yt_analysis/yt/changeset/a29f3bb49087/
changeset:   r3992:a29f3bb49087
branch:      yt
user:        jsoishi
date:        2011-03-28 21:05:39
summary:     merged.
affected #:  0 files (0 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Mon Mar 28 12:05:22 2011 -0700
+++ b/yt/gui/reason/extdirect_repl.py	Mon Mar 28 12:05:39 2011 -0700
@@ -55,7 +55,7 @@
 local_dir = os.path.dirname(__file__)
 
 class ExtDirectREPL(ProgrammaticREPL, BottleDirectRouter):
-    _skip_expose = ('index', 'resources')
+    _skip_expose = ('index')
     my_name = "ExtDirectREPL"
 
     def __init__(self, extjs_path, locals=None):
@@ -69,9 +69,10 @@
         # than through metaclasses or other fancy decorating.
         preroute_table = dict(index = ("/", "GET"),
                               _myapi = ("/resources/ext-repl-api.js", "GET"),
-                              resources = ("/resources/:path#.+#", "GET"),
+                              _resources = ("/resources/:path#.+#", "GET"),
+                              _js = ("/js/:path#.+#", "GET"),
+                              _images = ("/images/:path#.+#", "GET"),
                               _session_py = ("/session.py", "GET"),
-                              _ace = ("/ace/:path#.+#", "GET"),
                               _highlighter_css = ("/highlighter.css", "GET"),
                               )
         for v, args in preroute_table.items():
@@ -100,17 +101,22 @@
         vals = open(os.path.join(local_dir, "html/index.html")).read()
         return vals
 
-    def resources(self, path):
-        # This will need to be changed.
+    def _resources(self, path):
         pp = os.path.join(self.extjs_path, path)
         if not os.path.exists(pp):
             response.status = 404
             return
         return open(pp).read()
 
-    def _ace(self, path):
-        # This will need to be changed.
-        pp = os.path.join(local_dir, "ace", path)
+    def _js(self, path):
+        pp = os.path.join(local_dir, "html", "js", path)
+        if not os.path.exists(pp):
+            response.status = 404
+            return
+        return open(pp).read()
+
+    def _images(self, path):
+        pp = os.path.join(local_dir, "html", "images", path)
         if not os.path.exists(pp):
             response.status = 404
             return


Binary file yt/gui/reason/html/images/3d.png has changed


Binary file yt/gui/reason/html/images/3d_tab.png has changed


Binary file yt/gui/reason/html/images/blockdevice.png has changed


Binary file yt/gui/reason/html/images/blockdevice_tab.png has changed


Binary file yt/gui/reason/html/images/console_tab.png has changed


Binary file yt/gui/reason/html/images/graph_tab.png has changed


--- a/yt/gui/reason/html/index.html	Mon Mar 28 12:05:22 2011 -0700
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 12:05:39 2011 -0700
@@ -16,17 +16,17 @@
     p {
         margin:5px;
     }
-    pf_icon {
-        background-image:url(images/binary.png);
+    .pf_icon {
+        background-image:url(images/blockdevice_tab.png) !important;
     }
-    data_object {
-        background-image:url(images/kivio_flw.png);
+    .data_object {
+        background-image:url(images/3d_tab.png) !important;
     }
-    graph { 
-        background-image:url(images/graph.png) !important; //add images to tabs
+    .graph { 
+        background-image:url(images/graph_tab.png) !important; //add images to tabs
     }
-    console { 
-        background-image:url(images/console.png) !important;
+    .console { 
+        background-image:url(images/console_tab.png) !important;
     }
     #input_line {
         font-family: monospace;
@@ -44,351 +44,30 @@
     }
     </style>
 
-    <!-- GC --><!-- LIBS --><script type="text/javascript" src="resources/adapter/ext/ext-base.js"></script>
-    <!-- ENDLIBS -->
-
     <script type="text/javascript" src="resources/ext-all.js"></script>
 
-    <!-- EXAMPLES -->
-    <script type="text/javascript" src="resources/examples/shared/examples.js"></script>
+    <!-- INTERACTIVE --><script type="text/javascript" src="resources/ext-repl-api.js"></script><script type="text/javascript" src="resources/ext-pflist-api.js"></script>
 
-    <script type="text/javascript">
-    var viewport;
-    function cell_sent() {
-        repl_input.get('input_line').setReadOnly(true);
-    }
-    var examine;
-    var number_log_records = 0;
-    var number_images = 0;
-    function display_image(image_id) {
-        var image = Ext.get(image_id);
-        var src = image.dom.src;
-        var virtualdom = '<html><title>Image Viewer</title><body><img src="' + src + '"/></body></html>',
-            prev       = window.open('', 'image_viewer');
-        prev.document.open();
-        prev.document.write(virtualdom);
-        prev.document.close();
-    }
+    <!-- LOCAL FUNCTIONS -->
+    <script type="text/javascript" src="js/functions.js"></script>
 
-    function cell_finished(result, new_cell) {
-        Ext.each(result['payloads'], function(payload, index) {
-            if (payload['type'] == 'png_string') {
-                new_cell.add(new Ext.Panel({
-                                autoEl:{
-                                tag:'img', width:'25%',
-                                src:"data:image/png;base64," +
-                                        payload['image_data'],
-                                id:"payload_image_" + number_images,
-                                onClick: "display_image('payload_image_" +
-                                          number_images + "');"
-                              }}));
-                new_cell.doLayout();
-                number_images++;
-            } else if (payload['type'] == 'cell_contents') {
-                var input_line = repl_input.get("input_line")
-                input_line.setValue(payload['value']);
-            } else if (payload['type'] == 'log_entry') {
-                var record = new logging_store.recordType(
-                                {record: payload['log_entry'] });
-                logging_store.add(record, number_log_records++);
-            }
-        });
-        repl_input.get('input_line').setReadOnly(false);
-        yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
-    }
-
-    var res;
-    var cell_count = 0;
-
-    var handle_result = function(f, a) {
-        var input_line = repl_input.get("input_line")
-        cell_count += 1;
-        if (a.result == null) {
-            text = "ERROR";
-            formatted_input = input_line.getValue();
-        } else {
-            //text = a.result['output'].replace(/\n/g,"<br/>");
-            text = "<pre>"+a.result['output']+"</pre>";
-            formatted_input = a.result['input']
-        }
-        var cell = NewCell("cell_"+cell_count, formatted_input, text);
-        notebook.get("output_container").add(cell);
-        notebook.doLayout();
-        input_line.setValue("");
-        res = cell;
-        cell_finished(a.result, cell);
-    }
-
-    var repl_input = new Ext.FormPanel({
-        url: 'push',
-        items: [{
-            id: 'input_line',
-            xtype: 'textarea',
-            width: '100%',
-            autoScroll: true,
-            fieldLabel: '>>>',
-            name: 'line',
-            allowBlank: 'True',
-            bodyStyle: 'font-family: "monospace";',
-            listeners: {
-                specialkey: function(f, e){
-                    if (e.getKey() == e.ENTER) {
-                        cell_sent();
-                        yt_rpc.ExtDirectREPL.execute({
-                            code:repl_input.get('input_line').getValue()},
-                            handle_result);
-                    }
-                }
-            },
-        },],
-    });
-
-    var NorthButton = new Ext.Button(
-        {text : 'North',
-        pageX : 205,
-        pageY : 10
-//        handler: function(b, e) { window.open("session.py", "_top"); }
-        }
-    );
-
-    var EastButton = new Ext.Button(
-        {text:'East',
-        pageX : 410,
-        pageY : 205
-        }
-    );
-    var SouthButton = new Ext.Button(
-        {text:'South',
-        pageX : 205,
-        pageY : 410
-        }
-    );
-    var WestButton = new Ext.Button(
-        {text:'West',
-        pageX : 10,
-        pageY : 205
-        }
-    );
-
-    function NewCell(name, input, result) {
-        var CellPanel = new Ext.Panel(
-            {id: name,
-             items: [new Ext.Panel({
-                        id:name+"_input",
-                        html:input,
-                        }),
-                     new Ext.Panel({
-                        id:name+"_result",
-                        html:result,
-                        })
-                    ]
-            }
-        );
-        return CellPanel;
-    }
-
-    var OutputContainer = new Ext.Panel({
-          title: 'YT Output',
-          id: 'output_container',
-          autoScroll: true,
-          items: []
-        });
-
-    var PlotPanel = new Ext.Panel(
-        {
-        title: 'Plot Window 1',
-        iconCls: 'graph',
-        autoScroll: true,
-        layout:'absolute',
-        items: [ 
-            NorthButton,
-            EastButton,
-            SouthButton,
-            WestButton
-        ]
-    });
-    var examine;
-    var notebook;
-    var treePanel = new Ext.tree.TreePanel({
-        iconCls: 'nav',
-    	id: 'tree-panel',
-    	title: 'Objects',
-        layout: 'anchor',
-        region:'west',
-        split: true,
-        anchor: '100% -35',
-        minSize: 150,
-        autoScroll: true,
-        rootVisible: false,
-        root:new Ext.tree.TreeNode({
-          expanded:true
-         ,leaf:false
-         ,text:''
-        })
-     });
-
-    var ButtonGroupPanel = new Ext.Panel({
-        layout: 'anchor',
-        ButtonAlign: 'center',
-        collapsible: false,
-        renderTo: document.body,
-        tbar: [{
-            xtype: 'buttongroup',
-            columns: 3,
-            items: [{
-                text: 'Download',
-                layout:'anchor',
-                anchor: '100% 33%',
-                handler: function(b, e) { window.open("session.py", "_top"); }
-            },{
-                text: 'Save',
-                layout:'anchor',
-                anchor: '100% 67%',
-            },{
-                text: 'Pastebin',
-                layout:'anchor',
-                anchor: '100% 100%',
-            }]
-        }]
-    });
-    
-    function fill_tree(my_pfs) {
-        examine = my_pfs;
-        treePanel.root.removeAll();
-      Ext.each(my_pfs, function(pf, index) {
-          treePanel.root.appendChild(new Ext.tree.TreeNode({text: pf.name,
-              leaf:false, expanded:true, iconCls: 'pf_icon'}));
-          this_pf = treePanel.root.lastChild
-          Ext.each(pf.objects, function(object, obj_index) {
-            this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
-                leaf: true, iconCls: 'data_object'}));
-            });
-          });
-    };
-
-    var status_panel;
-    var logging_store = new Ext.data.Store({
-            fields: [{name:'record'}],
-            reader: new Ext.data.ArrayReader({}, [{name: 'record'}]),
-            });
-
-    Ext.onReady(function(){
-
-Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
-
-        // NOTE: This is an example showing simple state management. During development,
-        // it is generally best to disable state management as dynamically-generated ids
-        // can change across page loads, leading to unpredictable results.  The developer
-        // should ensure that stable state ids are set for stateful components in real apps.
-        Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
-
-	// Go ahead and create the TreePanel now so that we can use it below
-        viewport = new Ext.Viewport({
-            layout: 'border',
-            items: [
-            {
-                // lazily created panel (xtype:'panel' is default)
-                xtype: 'grid',
-                store: logging_store,
-                columns: [ {id:'record', 
-                            sortable: false,
-                            width:800} ],
-                autofill: true,
-                region: 'south',
-                id: "status-region",
-                cls: "status-logger",
-                split: true,
-                height: 100,
-                maxSize: 200,
-                collapsible: true,
-                title: 'Status',
-                margins: '0 0 0 0',
-            }, {
-                region: 'west',
-                id: 'west-panel', // see Ext.getCmp() below
-                title: 'BETA Sequences',
-                split: true,
-                width: 200,
-                minSize: 175,
-                maxSize: 400,
-                collapsible: true,
-                margins: '0 0 0 5',
-                layout: {
-                    type: 'anchor',
-                },
-                items: [
-                    treePanel,
-                    ButtonGroupPanel
-                ]
-            },
-            // in this instance the TabPanel is not wrapped by another panel
-            // since no title is needed, this Panel is added directly
-            // as a Container
-            {
-                xtype: 'tabpanel',
-                region: 'center', // a center region is ALWAYS required for border layout
-                id: 'center-panel',
-                deferredRender: false,
-                activeTab: 0,     // first tab initially active
-                items: [{
-                    title: 'YT',
-                    id: 'notebook',
-                    closable: false,
-                    autoScroll: false,
-                    iconCls: 'console',
-                    items: [{ 
-                        title: 'Output',
-                        html: "",
-                        id: "cell_output",
-                    }, repl_input, OutputContainer]
-                }, PlotPanel]
-//                }, {
- //                   title: 'Plot Window 1',
-  //                  iconCls: 'graph',
-   //                 layout:'anchor',
-    //                anchor:'100% 100%',
-     //               closable: true,
-      //              autoScroll: true,
-       //             items: [ PlotPanel ]
-        //                
-         //       }]
-            }]
-        });
-        // get a reference to the HTML element with id "hideit" and add a click listener to it 
-        Ext.get("hideit").on('click', function(){
-            // get a reference to the Panel that was created with id = 'west-panel' 
-            var w = Ext.getCmp('west-panel');
-            // expand or collapse that Panel based on its collapsed property state
-            w.collapsed ? w.expand() : w.collapse();
-        });
-        
-        notebook = viewport.get("center-panel").get("notebook");
-        status_panel = viewport.get("status-region").get("status-div");
-
-        var record = new logging_store.recordType(
-                        {record: '4d3d3d3 engaged' });
-        logging_store.add(record, number_log_records++);
-    });
-    </script>
+    <!-- THE MAIN FUNCTION -->
+    <script type="text/javascript" src="js/cinco.js"></script></head><body><!-- use class="x-hide-display" to prevent a brief flicker of the content --><div id="west" class="x-hide-display">
-        <p>Hi. I'm the west panel.</p></div><div id="center2" class="x-hide-display"><a id="hideit" href="#">Toggle the west region</a>
-        <hr>
-        <p>Duis hendrerit, est vel lobortis sagittis, tortor erat scelerisque tortor, sed pellentesque sem enim id metus. Maecenas at pede. Nulla velit libero, dictum at, mattis quis, sagittis vel, ante. Phasellus faucibus rutrum dui. Cras mauris elit, bibendum at, feugiat non, porta id, neque. Nulla et felis nec odio mollis vehicula. Donec elementum tincidunt mauris. Duis vel dui. Fusce iaculis enim ac nulla. In risus.</p></div><div id="props-panel" class="x-hide-display" style="width:200px;height:200px;overflow:hidden;"></div><div id="south" class="x-hide-display">
-        <p>4d3d3d3 engaged.</p></div></body></html>


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/js/cinco.js	Mon Mar 28 12:05:39 2011 -0700
@@ -0,0 +1,256 @@
+var viewport;
+
+var examine;
+var number_log_records = 0;
+var number_images = 0;
+
+var res;
+var cell_count = 0;
+
+var handle_result = function(f, a) {
+  var input_line = repl_input.get("input_line")
+  if (a.result == null) {
+    text = "ERROR";
+    formatted_input = input_line.getValue();
+  } else {
+    //text = a.result['output'].replace(/\n/g,"<br/>");
+    text = "<pre>"+a.result['output']+"</pre>";
+    formatted_input = a.result['input']
+  }
+  var cell = new_cell(formatted_input, text);
+  OutputContainer.add(cell);
+  notebook.doLayout();
+  input_line.setValue("");
+  cell_finished(a.result, cell);
+  if (OutputContainer.items.length > 1) {
+    OutputContainer.body.dom.scrollTop =
+      OutputContainer.body.dom.scrollHeight -
+      cell.body.dom.scrollHeight - 20;
+  }
+}
+
+var repl_input = new Ext.FormPanel({
+  title: 'YT Input',
+      url: 'push',
+      flex: 0.2,
+      layout: 'fit',
+      items: [{
+      id: 'input_line',
+	  xtype: 'textarea',
+	  width: '100%',
+	  autoScroll: true,
+	  name: 'line',
+	  allowBlank: 'True',
+	  bodyStyle: 'font-family: "monospace";',
+	  listeners: {
+	specialkey: function(f, e){
+	    if (e.getKey() == e.ENTER) {
+	      cell_sent();
+	      yt_rpc.ExtDirectREPL.execute({
+		code:repl_input.get('input_line').getValue()},
+		handle_result);
+	    }
+	  }
+	},
+	  },],
+      });
+
+var NorthButton = new Ext.Button(
+				 {text : 'North',
+				     pageX : 205,
+				     pageY : 10
+//        handler: function(b, e) { window.open("session.py", "_top"); }
+				     }
+				 );
+
+var EastButton = new Ext.Button(
+				{text:'East',
+				    pageX : 410,
+				    pageY : 205
+				    }
+				);
+var SouthButton = new Ext.Button(
+				 {text:'South',
+				     pageX : 205,
+				     pageY : 410
+				     }
+				 );
+var WestButton = new Ext.Button(
+				{text:'West',
+				    pageX : 10,
+				    pageY : 205
+				    }
+				);
+
+var OutputContainer = new Ext.Panel({
+  title: 'YT Output',
+      id: 'output_container',
+      autoScroll: true,
+      flex: 0.8,
+      items: []
+      });
+
+var PlotPanel = new Ext.Panel(
+			      {
+			      title: 'Plot Window 1',
+				  iconCls: 'graph',
+				  autoScroll: true,
+				  layout:'absolute',
+				  items: [ 
+					  NorthButton,
+					  EastButton,
+					  SouthButton,
+					  WestButton
+					   ]
+				  });
+var examine;
+var notebook;
+var treePanel = new Ext.tree.TreePanel({
+  iconCls: 'nav',
+      id: 'tree-panel',
+      title: 'Objects',
+      layout: 'anchor',
+      region:'west',
+      split: true,
+      anchor: '100% -35',
+      minSize: 150,
+      autoScroll: true,
+      rootVisible: false,
+      root:new Ext.tree.TreeNode({
+	expanded:true
+	    ,leaf:false
+	    ,text:''
+	    })
+      });
+
+var ButtonGroupPanel = new Ext.Panel({
+  layout: 'anchor',
+      ButtonAlign: 'center',
+      collapsible: false,
+      renderTo: document.body,
+      tbar: [{
+      xtype: 'buttongroup',
+	  columns: 3,
+	  items: [{
+	  text: 'Download',
+	      layout:'anchor',
+	      anchor: '100% 33%',
+	      handler: function(b, e) { window.open("session.py", "_top"); }
+	  },{
+	  text: 'Save',
+	      layout:'anchor',
+	      anchor: '100% 67%',
+	      },{
+	  text: 'Pastebin',
+                layout:'anchor',
+                anchor: '100% 100%',
+		}]
+	  }]
+      });
+
+var status_panel;
+var logging_store = new Ext.data.Store({
+  fields: [{name:'record'}],
+      reader: new Ext.data.ArrayReader({}, [{name: 'record'}]),
+      });
+
+Ext.onReady(function(){
+    
+    Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
+
+    // NOTE: This is an example showing simple state management. During development,
+    // it is generally best to disable state management as dynamically-generated ids
+    // can change across page loads, leading to unpredictable results.  The developer
+    // should ensure that stable state ids are set for stateful components in real apps.
+    // it's a cold day for pontooning.
+    Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
+
+    // Go ahead and create the TreePanel now so that we can use it below
+    viewport = new Ext.Viewport({
+      layout: 'border',
+	  items: [
+		  {
+		    // lazily created panel (xtype:'panel' is default)
+		  xtype: 'grid',
+		      store: logging_store,
+		      columns: [ {id:'record', 
+			  sortable: false,
+			  width:800} ],
+		      autofill: true,
+		      region: 'south',
+		      id: "status-region",
+		      cls: "status-logger",
+		      split: true,
+		      height: 100,
+		      maxSize: 200,
+		      collapsible: true,
+		      title: 'Status',
+		      margins: '0 0 0 0',
+		      }, {
+		  region: 'west',
+		      id: 'west-panel', // see Ext.getCmp() below
+		      title: 'BETA Sequences',
+		      split: true,
+		      width: 200,
+		      minSize: 175,
+		      maxSize: 400,
+		      collapsible: true,
+		      margins: '0 0 0 5',
+		      layout: {
+                    type: 'anchor',
+			},
+		      items: [
+			      treePanel,
+			      ButtonGroupPanel
+			      ]
+		      },
+		  // in this instance the TabPanel is not wrapped by another panel
+		  // since no title is needed, this Panel is added directly
+		  // as a Container
+		  {
+		  xtype: 'tabpanel',
+		      region: 'center', // a center region is ALWAYS required for border layout
+		      id: 'center-panel',
+		      deferredRender: false,
+		      activeTab: 0,     // first tab initially active
+		      items: [
+                {
+		            title: 'YT',
+			        id: 'notebook',
+			        layout: 'vbox',
+			        layoutConfig: {align:'stretch'},
+			        closable: false,
+			        autoScroll: false,
+			        iconCls: 'console',
+			        items: [repl_input, OutputContainer]
+			    }, PlotPanel]
+		      //                }, {
+		      //                   title: 'Plot Window 1',
+		      //                  iconCls: 'graph',
+		      //                 layout:'anchor',
+		      //                anchor:'100% 100%',
+		      //               closable: true,
+		      //              autoScroll: true,
+		      //             items: [ PlotPanel ]
+		      //                
+		      //       }]
+		      }]
+	  });
+    // get a reference to the HTML element with id "hideit" and add a click listener to it 
+    console.log('Mitchell!\nPardon me! Mitchell!')
+    Ext.get("hideit").on('click', function(){
+	// get a reference to the Panel that was created with id = 'west-panel' 
+	var w = Ext.getCmp('west-panel');
+	// expand or collapse that Panel based on its collapsed property state
+	// need to make room for six sour cream burritos
+	w.collapsed ? w.expand() : w.collapse();
+      });
+    
+    notebook = viewport.get("center-panel").get("notebook");
+    status_panel = viewport.get("status-region").get("status-div");
+    
+    var record = new logging_store.recordType(
+					      {record: '4d3d3d3 engaged' });
+    logging_store.add(record, number_log_records++);
+    repl_input.get("input_line").focus();
+  });


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/js/functions.js	Mon Mar 28 12:05:39 2011 -0700
@@ -0,0 +1,77 @@
+function cell_finished(result, new_cell) {
+  Ext.each(result['payloads'], function(payload, index) {
+      if (payload['type'] == 'png_string') {
+	new_cell.add(new Ext.Panel({
+	    autoEl:{
+	      tag:'img', width:'25%',
+		  src:"data:image/png;base64," +
+		  payload['image_data'],
+		  id:"payload_image_" + number_images,
+		  onClick: "display_image('payload_image_" +
+		  number_images + "');"
+		  }}));
+	new_cell.doLayout();
+	number_images++;
+      } else if (payload['type'] == 'cell_contents') {
+	var input_line = repl_input.get("input_line")
+	  input_line.setValue(payload['value']);
+      } else if (payload['type'] == 'log_entry') {
+	var record = new logging_store.recordType(
+						  {record: payload['log_entry'] });
+	logging_store.add(record, number_log_records++);
+      }
+    });
+  repl_input.get('input_line').setReadOnly(false);
+  yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
+  repl_input.get("input_line").focus();
+}
+
+function cell_sent() {
+  repl_input.get('input_line').setReadOnly(true);
+}
+
+function display_image(image_id) {
+  var image = Ext.get(image_id);
+  var src = image.dom.src;
+  var virtualdom = '<html><title>Image Viewer</title><body><img src="' + src + '"/></body></html>',
+  prev = window.open('', 'image_viewer');
+  prev.document.open();
+  prev.document.write(virtualdom);
+  prev.document.close();
+}
+
+// Create a tree in the left panel with the pfs and their objects.
+function fill_tree(my_pfs) {
+  examine = my_pfs;
+  treePanel.root.removeAll();
+  Ext.each(my_pfs, function(pf, index) {
+      treePanel.root.appendChild(new Ext.tree.TreeNode({text: pf.name,
+              leaf:false, expanded:true, iconCls: 'pf_icon'}));
+      this_pf = treePanel.root.lastChild
+	Ext.each(pf.objects, function(object, obj_index) {
+            this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
+		    leaf: true, iconCls: 'data_object'}));
+	  });
+    });
+};
+
+function new_cell(input, result) {
+  var name = "cell_" + cell_count;
+  var CellPanel = new Ext.Panel(
+		    {id: name, //title: "Cell " + cell_count,
+		     items: [new Ext.Panel({
+			  id:name+"_input",
+			      html:input,
+			      }),
+		       new Ext.Panel({
+			 id:name+"_result",
+			     autoScroll:true,
+			     width: "100%",
+			     html:result,
+			     })
+		       ]
+			}
+			);
+  cell_count++;
+  return CellPanel;
+}


http://bitbucket.org/yt_analysis/yt/changeset/56d5e54714ee/
changeset:   r3993:56d5e54714ee
branch:      yt
user:        brittonsmith
date:        2011-03-28 21:13:57
summary:     Updated .hgignore.
affected #:  1 file (160 bytes)

--- a/.hgignore	Mon Mar 28 14:55:54 2011 -0400
+++ b/.hgignore	Mon Mar 28 15:13:57 2011 -0400
@@ -1,6 +1,13 @@
 build
 yt.egg-info
 __config__.py
+freetype.cfg
+hdf5.cfg
+png.cfg
+yt/frontends/ramses/_ramses_reader.cpp
+yt/utilities/amr_utils.c
+yt/utilities/kdtree/forthonf2c.h
+yt/utilities/libconfig_wrapper.c
 syntax: glob
 *.pyc
 .*.swp


http://bitbucket.org/yt_analysis/yt/changeset/013ed8d17df5/
changeset:   r3994:013ed8d17df5
branch:      yt
user:        brittonsmith
date:        2011-03-28 21:14:15
summary:     Merged.
affected #:  0 files (0 bytes)

--- a/yt/visualization/plot_window.py	Mon Mar 28 15:13:57 2011 -0400
+++ b/yt/visualization/plot_window.py	Mon Mar 28 15:14:15 2011 -0400
@@ -123,8 +123,13 @@
 
     @invalidate_data
     def zoom(self, factor):
-        """
-        This zooms the window by *factor*.
+        r"""This zooms the window by *factor*.
+
+        Parameters
+        ----------
+        factor : float
+            multiplier for the current width
+
         """
         Wx, Wy = self.width
         centerx = self.xlim[0] + Wx*0.5
@@ -132,13 +137,16 @@
         nWx, nWy = Wx/factor, Wy/factor
         self.xlim = (centerx - nWx*0.5, centerx + nWx*0.5)
         self.ylim = (centery - nWy*0.5, centery + nWy*0.5)
-        #self._run_callbacks()
 
     @invalidate_data
     def pan(self, deltas):
-        """
-        This accepts a tuple of *deltas*, composed of (delta_x, delta_y) that
-        will pan the window by those values in absolute coordinates.
+        r"""Pan the image by specifying absolute code unit coordinate deltas.
+        
+        Parameters
+        ----------
+        deltas : sequence of floats
+            (delta_x, delta_y) in *absolute* code unit coordinates
+
         """
         self.xlim = (self.xlim[0] + deltas[0], self.xlim[1] + deltas[0])
         self.ylim = (self.ylim[0] + deltas[1], self.ylim[1] + deltas[1])
@@ -166,22 +174,8 @@
     def set_antialias(self,aa):
         self.antialias = aa
 
-class PWViewerRaw(PlotWindow):
-    """A PlotWindow viewer that writes raw pngs (no MPL, no axes).
-
-    """
-    def _setup_plots(self):
-        self.save('')
-        self._plot_valid = True
-
-    def save(self,name):
-        for field in self._frb.data.keys():
-            nm = "%s_%s.png" % (name,field)
-            print "writing %s" % nm
-            write_image(self._frb[field],nm)
-
-class PWViewerExtJS(PlotWindow):
-    """A viewer for the web interface.
+class PWViewer(PlotWindow):
+    """A viewer for PlotWindows.
 
     """
     def __init__(self, *args,**kwargs):
@@ -197,6 +191,13 @@
 
     def set_log(self,field,log):
         """set a field to log or linear.
+        
+        Parameters
+        ----------
+        field : string
+            the field to set a transform
+        log : boolean
+            Log on/off.
 
         """
         if log:
@@ -207,6 +208,46 @@
     def set_transform(self, field, func):
         self._field_transform[field] = func
 
+    @invalidate_plot
+    def set_cmap(self):
+        pass
+
+    @invalidate_plot
+    def set_zlim(self):
+        pass
+
+class PWViewerMPL(PWViewer):
+    """Viewer using matplotlib as a backend via the YtWindowPlot. 
+
+    """
+    def _setup_plots(self):
+        for f in self.fields:
+            self.plots[f] = YtWindowPlot(self._frb[f])
+        self._plot_valid = True
+
+    def save(self,name):
+        for k,v in self.plots.iteritems():
+            n = "%s_%s" % (name, k)
+            v.save(n)
+
+class PWViewerRaw(PWViewer):
+    """A PlotWindow viewer that writes raw pngs (no MPL, no axes).
+
+    """
+    def _setup_plots(self):
+        self.save('')
+        self._plot_valid = True
+
+    def save(self,name):
+        for field in self._frb.data.keys():
+            nm = "%s_%s.png" % (name,field)
+            print "writing %s" % nm
+            write_image(self._frb[field],nm)
+
+class PWViewerExtJS(PWViewer):
+    """A viewer for the web interface.
+
+    """
     def _setup_plots(self):
         from yt.gui.reason.bottle_mods import PayloadHandler
         import base64
@@ -225,26 +266,6 @@
     def get_metadata(self):
         pass
 
-class PWWiewer(PlotWindow):
-    """A viewer for PlotWindows.
-
-    """
-    def _setup_plots(self):
-        for f in self.fields:
-            self.plots[f] = YtWindowPlot(self._frb[f])
-        self._plot_valid = True
-
-    def save(self,name):
-        for k,v in self.plots.iteritems():
-            n = "%s_%s" % (name, k)
-            v.save(n)
-    @invalidate_plot
-    def set_cmap(self):
-        pass
-    @invalidate_plot
-    def set_zlim(self):
-        pass
-
 
 
 class YtPlot(object):


http://bitbucket.org/yt_analysis/yt/changeset/fde3319827f0/
changeset:   r3995:fde3319827f0
branch:      yt
user:        MatthewTurk
date:        2011-03-28 21:33:11
summary:     Adding favicon support.  Includes a 'magic 8 ball' favicon, but the user can
swap this out by putting something in ~/.yt/favicon.ico .
affected #:  2 files (1.5 KB)

--- a/yt/gui/reason/extdirect_repl.py	Mon Mar 28 14:55:54 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Mon Mar 28 15:33:11 2011 -0400
@@ -32,7 +32,7 @@
 
 from .bottle_mods import preroute, BottleDirectRouter, notify_route, \
                          PayloadHandler
-from .bottle import response, request
+from .bottle import response, request, route
 from .basic_repl import ProgrammaticREPL
 
 try:
@@ -77,6 +77,7 @@
                               )
         for v, args in preroute_table.items():
             preroute(args[0], method=args[1])(getattr(self, v))
+        # This has to be routed to the root directory
         self.api_url = "repl"
         BottleDirectRouter.__init__(self)
         self.pflist = ExtDirectParameterFileList()
@@ -182,3 +183,13 @@
             {'type':'log_entry',
              'log_entry':msg})
 
+if os.path.exists(os.path.expanduser("~/.yt/favicon.ico")):
+    ico = os.path.expanduser("~/.yt/favicon.ico")
+else:
+    ico = os.path.join(local_dir, "html", "images", "favicon.ico")
+ at route("/favicon.ico", method="GET")
+def _favicon_ico():
+    response.headers['Content-Type'] = "image/x-icon"
+    return open(ico).read()
+
+


Binary file yt/gui/reason/html/images/favicon.ico has changed


http://bitbucket.org/yt_analysis/yt/changeset/12a8f2e6db52/
changeset:   r3996:12a8f2e6db52
branch:      yt
user:        MatthewTurk
date:        2011-03-28 21:36:09
summary:     Merge
affected #:  0 files (0 bytes)

--- a/.hgignore	Mon Mar 28 15:33:11 2011 -0400
+++ b/.hgignore	Mon Mar 28 15:36:09 2011 -0400
@@ -1,6 +1,13 @@
 build
 yt.egg-info
 __config__.py
+freetype.cfg
+hdf5.cfg
+png.cfg
+yt/frontends/ramses/_ramses_reader.cpp
+yt/utilities/amr_utils.c
+yt/utilities/kdtree/forthonf2c.h
+yt/utilities/libconfig_wrapper.c
 syntax: glob
 *.pyc
 .*.swp


--- a/yt/visualization/plot_window.py	Mon Mar 28 15:33:11 2011 -0400
+++ b/yt/visualization/plot_window.py	Mon Mar 28 15:36:09 2011 -0400
@@ -123,8 +123,13 @@
 
     @invalidate_data
     def zoom(self, factor):
-        """
-        This zooms the window by *factor*.
+        r"""This zooms the window by *factor*.
+
+        Parameters
+        ----------
+        factor : float
+            multiplier for the current width
+
         """
         Wx, Wy = self.width
         centerx = self.xlim[0] + Wx*0.5
@@ -132,13 +137,16 @@
         nWx, nWy = Wx/factor, Wy/factor
         self.xlim = (centerx - nWx*0.5, centerx + nWx*0.5)
         self.ylim = (centery - nWy*0.5, centery + nWy*0.5)
-        #self._run_callbacks()
 
     @invalidate_data
     def pan(self, deltas):
-        """
-        This accepts a tuple of *deltas*, composed of (delta_x, delta_y) that
-        will pan the window by those values in absolute coordinates.
+        r"""Pan the image by specifying absolute code unit coordinate deltas.
+        
+        Parameters
+        ----------
+        deltas : sequence of floats
+            (delta_x, delta_y) in *absolute* code unit coordinates
+
         """
         self.xlim = (self.xlim[0] + deltas[0], self.xlim[1] + deltas[0])
         self.ylim = (self.ylim[0] + deltas[1], self.ylim[1] + deltas[1])
@@ -166,22 +174,8 @@
     def set_antialias(self,aa):
         self.antialias = aa
 
-class PWViewerRaw(PlotWindow):
-    """A PlotWindow viewer that writes raw pngs (no MPL, no axes).
-
-    """
-    def _setup_plots(self):
-        self.save('')
-        self._plot_valid = True
-
-    def save(self,name):
-        for field in self._frb.data.keys():
-            nm = "%s_%s.png" % (name,field)
-            print "writing %s" % nm
-            write_image(self._frb[field],nm)
-
-class PWViewerExtJS(PlotWindow):
-    """A viewer for the web interface.
+class PWViewer(PlotWindow):
+    """A viewer for PlotWindows.
 
     """
     def __init__(self, *args,**kwargs):
@@ -197,6 +191,13 @@
 
     def set_log(self,field,log):
         """set a field to log or linear.
+        
+        Parameters
+        ----------
+        field : string
+            the field to set a transform
+        log : boolean
+            Log on/off.
 
         """
         if log:
@@ -207,6 +208,46 @@
     def set_transform(self, field, func):
         self._field_transform[field] = func
 
+    @invalidate_plot
+    def set_cmap(self):
+        pass
+
+    @invalidate_plot
+    def set_zlim(self):
+        pass
+
+class PWViewerMPL(PWViewer):
+    """Viewer using matplotlib as a backend via the YtWindowPlot. 
+
+    """
+    def _setup_plots(self):
+        for f in self.fields:
+            self.plots[f] = YtWindowPlot(self._frb[f])
+        self._plot_valid = True
+
+    def save(self,name):
+        for k,v in self.plots.iteritems():
+            n = "%s_%s" % (name, k)
+            v.save(n)
+
+class PWViewerRaw(PWViewer):
+    """A PlotWindow viewer that writes raw pngs (no MPL, no axes).
+
+    """
+    def _setup_plots(self):
+        self.save('')
+        self._plot_valid = True
+
+    def save(self,name):
+        for field in self._frb.data.keys():
+            nm = "%s_%s.png" % (name,field)
+            print "writing %s" % nm
+            write_image(self._frb[field],nm)
+
+class PWViewerExtJS(PWViewer):
+    """A viewer for the web interface.
+
+    """
     def _setup_plots(self):
         from yt.gui.reason.bottle_mods import PayloadHandler
         import base64
@@ -225,26 +266,6 @@
     def get_metadata(self):
         pass
 
-class PWWiewer(PlotWindow):
-    """A viewer for PlotWindows.
-
-    """
-    def _setup_plots(self):
-        for f in self.fields:
-            self.plots[f] = YtWindowPlot(self._frb[f])
-        self._plot_valid = True
-
-    def save(self,name):
-        for k,v in self.plots.iteritems():
-            n = "%s_%s" % (name, k)
-            v.save(n)
-    @invalidate_plot
-    def set_cmap(self):
-        pass
-    @invalidate_plot
-    def set_zlim(self):
-        pass
-
 
 
 class YtPlot(object):


http://bitbucket.org/yt_analysis/yt/changeset/d17d3254ed2c/
changeset:   r3997:d17d3254ed2c
branch:      yt
user:        Cameron Hummels
date:        2011-03-28 21:45:28
summary:     Added separators to buttons in object panel.  Cleaned up some formatting in the code.
affected #:  1 file (147 bytes)

--- a/yt/gui/reason/html/js/cinco.js	Mon Mar 28 15:36:09 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Mon Mar 28 15:45:28 2011 -0400
@@ -124,29 +124,33 @@
       });
 
 var ButtonGroupPanel = new Ext.Panel({
-  layout: 'anchor',
-      ButtonAlign: 'center',
-      collapsible: false,
-      renderTo: document.body,
-      tbar: [{
-      xtype: 'buttongroup',
-	  columns: 3,
-	  items: [{
-	  text: 'Download',
-	      layout:'anchor',
-	      anchor: '100% 33%',
-	      handler: function(b, e) { window.open("session.py", "_top"); }
-	  },{
-	  text: 'Save',
-	      layout:'anchor',
-	      anchor: '100% 67%',
-	      },{
-	  text: 'Pastebin',
-                layout:'anchor',
-                anchor: '100% 100%',
-		}]
-	  }]
-      });
+    layout: 'anchor',
+    ButtonAlign: 'center',
+    collapsible: false,
+    renderTo: document.body,
+    tbar: [{
+        xtype: 'buttongroup',
+        columns: 5,
+        items: [{
+            text: 'Download',
+            layout:'anchor',
+            anchor: '100% 33%',
+            handler: function(b, e) { window.open("session.py", "_top"); }
+        },{
+            xtype: 'tbseparator'
+        },{
+            text: 'Save',
+            layout:'anchor',
+            anchor: '100% 67%',
+        },{
+            xtype: 'tbseparator'
+        },{
+            text: 'Pastebin',
+            layout:'anchor',
+            anchor: '100% 100%',
+        }]
+    }]
+});
 
 var status_panel;
 var logging_store = new Ext.data.Store({


http://bitbucket.org/yt_analysis/yt/changeset/019d22e67ea4/
changeset:   r3998:019d22e67ea4
branch:      yt
user:        MatthewTurk
date:        2011-03-28 21:46:45
summary:     Adding the Slate theme to the install script and also using this theme.
affected #:  4 files (800 bytes)

--- a/doc/install_script.sh	Mon Mar 28 15:36:09 2011 -0400
+++ b/doc/install_script.sh	Mon Mar 28 15:46:45 2011 -0400
@@ -295,6 +295,7 @@
 get_enzotools Cython-0.14.tar.gz
 get_enzotools Forthon-0.8.4.tar.gz
 get_enzotools ext-3.3.2.zip
+get_enzotools ext-slate-110328.zip
 
 if [ $INST_BZLIB -eq 1 ]
 then
@@ -532,6 +533,15 @@
     touch ext-3.3.2/done
 fi
 
+# Now we open up the ext theme
+if [ ! -e ext-slate-110328/done ]
+then
+    ( unzip -o ext-slate-110328.zip 2>&1 ) 1>> ${LOG_FILE} || do_exit
+    ( echo "Symlinking ext-slate-110328 as ext-theme" 2>&1 ) 1>> ${LOG_FILE}
+    ln -sf ext-slate-110328 ext-theme
+    touch ext-slate-110328/done
+fi
+
 function print_afterword
 {
     echo


--- a/yt/gui/reason/extdirect_repl.py	Mon Mar 28 15:36:09 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Mon Mar 28 15:46:45 2011 -0400
@@ -58,9 +58,10 @@
     _skip_expose = ('index')
     my_name = "ExtDirectREPL"
 
-    def __init__(self, extjs_path, locals=None):
+    def __init__(self, base_extjs_path, locals=None):
         # First we do the standard initialization
-        self.extjs_path = extjs_path
+        self.extjs_path = os.path.join(base_extjs_path, "ext-resources")
+        self.extjs_theme_path = os.path.join(base_extjs_path, "ext-theme")
         ProgrammaticREPL.__init__(self, locals)
         # Now, since we want to only preroute functions we know about, and
         # since they have different arguments, and most of all because we only
@@ -72,6 +73,7 @@
                               _resources = ("/resources/:path#.+#", "GET"),
                               _js = ("/js/:path#.+#", "GET"),
                               _images = ("/images/:path#.+#", "GET"),
+                              _theme = ("/theme/:path#.+#", "GET"),
                               _session_py = ("/session.py", "GET"),
                               _highlighter_css = ("/highlighter.css", "GET"),
                               )
@@ -109,6 +111,13 @@
             return
         return open(pp).read()
 
+    def _theme(self, path):
+        pp = os.path.join(self.extjs_theme_path, path)
+        if not os.path.exists(pp):
+            response.status = 404
+            return
+        return open(pp).read()
+
     def _js(self, path):
         pp = os.path.join(local_dir, "html", "js", path)
         if not os.path.exists(pp):


--- a/yt/gui/reason/html/index.html	Mon Mar 28 15:36:09 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 15:46:45 2011 -0400
@@ -3,6 +3,7 @@
   <title>Cinco Analysis Generator</title><link rel="stylesheet" type="text/css" href="resources/resources/css/ext-all.css" /><link rel="stylesheet" type="text/css" href="highlighter.css" />
+    <link rel="stylesheet" type="text/css" href="theme/css/xtheme-slate.css" /><style type="text/css">
     html, body {


--- a/yt/utilities/command_line.py	Mon Mar 28 15:36:09 2011 -0400
+++ b/yt/utilities/command_line.py	Mon Mar 28 15:46:45 2011 -0400
@@ -920,13 +920,13 @@
             print "*** to point to the installation location!        ***"
             print
             sys.exit(1)
-        extjs_path = os.path.join(os.environ["YT_DEST"], "src", "ext-resources")
+        base_extjs_path = os.path.join(os.environ["YT_DEST"], "src")
         from yt.config import ytcfg;ytcfg["yt","__withinreason"]="True"
         import yt.gui.reason.bottle as bottle
         from yt.gui.reason.extdirect_repl import ExtDirectREPL
         from yt.gui.reason.bottle_mods import uuid_serve_functions
 
-        hr = ExtDirectREPL(extjs_path)
+        hr = ExtDirectREPL(base_extjs_path)
         bottle.debug()
         uuid_serve_functions(open_browser=True)
 


http://bitbucket.org/yt_analysis/yt/changeset/df108c29908b/
changeset:   r3999:df108c29908b
branch:      yt
user:        MatthewTurk
date:        2011-03-28 21:47:26
summary:     Merge
affected #:  0 files (0 bytes)

--- a/yt/gui/reason/html/js/cinco.js	Mon Mar 28 15:46:45 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Mon Mar 28 15:47:26 2011 -0400
@@ -124,29 +124,33 @@
       });
 
 var ButtonGroupPanel = new Ext.Panel({
-  layout: 'anchor',
-      ButtonAlign: 'center',
-      collapsible: false,
-      renderTo: document.body,
-      tbar: [{
-      xtype: 'buttongroup',
-	  columns: 3,
-	  items: [{
-	  text: 'Download',
-	      layout:'anchor',
-	      anchor: '100% 33%',
-	      handler: function(b, e) { window.open("session.py", "_top"); }
-	  },{
-	  text: 'Save',
-	      layout:'anchor',
-	      anchor: '100% 67%',
-	      },{
-	  text: 'Pastebin',
-                layout:'anchor',
-                anchor: '100% 100%',
-		}]
-	  }]
-      });
+    layout: 'anchor',
+    ButtonAlign: 'center',
+    collapsible: false,
+    renderTo: document.body,
+    tbar: [{
+        xtype: 'buttongroup',
+        columns: 5,
+        items: [{
+            text: 'Download',
+            layout:'anchor',
+            anchor: '100% 33%',
+            handler: function(b, e) { window.open("session.py", "_top"); }
+        },{
+            xtype: 'tbseparator'
+        },{
+            text: 'Save',
+            layout:'anchor',
+            anchor: '100% 67%',
+        },{
+            xtype: 'tbseparator'
+        },{
+            text: 'Pastebin',
+            layout:'anchor',
+            anchor: '100% 100%',
+        }]
+    }]
+});
 
 var status_panel;
 var logging_store = new Ext.data.Store({


http://bitbucket.org/yt_analysis/yt/changeset/18626a3e194a/
changeset:   r4000:18626a3e194a
branch:      yt
user:        MatthewTurk
date:        2011-03-28 21:48:04
summary:     No-op merge
affected #:  1 file (0 bytes)

http://bitbucket.org/yt_analysis/yt/changeset/b96e6c7297ab/
changeset:   r4001:b96e6c7297ab
branch:      yt
user:        MatthewTurk
date:        2011-03-29 01:36:50
summary:     Adding 'cell_waiting' indicator in the form of a red box
affected #:  3 files (174 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 15:48:04 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 19:36:50 2011 -0400
@@ -43,6 +43,9 @@
         font-family: monospace;
         font-size: 120%;
     }
+    .cell_waiting {
+        background-color: #FF0000;
+    }
     </style><!-- LIBS -->


--- a/yt/gui/reason/html/js/cinco.js	Mon Mar 28 15:48:04 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Mon Mar 28 19:36:50 2011 -0400
@@ -21,6 +21,7 @@
   OutputContainer.add(cell);
   notebook.doLayout();
   input_line.setValue("");
+  repl_input.body.removeClass("cell_waiting");
   cell_finished(a.result, cell);
   if (OutputContainer.items.length > 1) {
     OutputContainer.body.dom.scrollTop =
@@ -34,6 +35,7 @@
       url: 'push',
       flex: 0.2,
       layout: 'fit',
+      padding: 5,
       items: [{
       id: 'input_line',
 	  xtype: 'textarea',


--- a/yt/gui/reason/html/js/functions.js	Mon Mar 28 15:48:04 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Mon Mar 28 19:36:50 2011 -0400
@@ -27,7 +27,8 @@
 }
 
 function cell_sent() {
-  repl_input.get('input_line').setReadOnly(true);
+    repl_input.get('input_line').setReadOnly(true);
+    repl_input.body.addClass("cell_waiting");
 }
 
 function display_image(image_id) {


http://bitbucket.org/yt_analysis/yt/changeset/e03d5c87d4d7/
changeset:   r4002:e03d5c87d4d7
branch:      yt
user:        Cameron Hummels
date:        2011-03-29 04:59:29
summary:     Added js/widget_plotwindow.js to hold code for creating the interactive plot window.
affected #:  1 file (787 bytes)

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Mon Mar 28 22:59:29 2011 -0400
@@ -0,0 +1,41 @@
+var NorthButton = new Ext.Button(
+				 {text : 'North',
+				     pageX : 205,
+				     pageY : 10
+//        handler: function(b, e) { window.open("session.py", "_top"); }
+				     }
+				 );
+
+var EastButton = new Ext.Button(
+				{text:'East',
+				    pageX : 410,
+				    pageY : 205
+				    }
+				);
+var SouthButton = new Ext.Button(
+				 {text:'South',
+				     pageX : 205,
+				     pageY : 410
+				     }
+				 );
+var WestButton = new Ext.Button(
+				{text:'West',
+				    pageX : 10,
+				    pageY : 205
+				    }
+				);
+
+
+var PlotPanel = new Ext.Panel(
+			      {
+			      title: 'Plot Window 1',
+				  iconCls: 'graph',
+				  autoScroll: true,
+				  layout:'absolute',
+				  items: [ 
+					  NorthButton,
+					  EastButton,
+					  SouthButton,
+					  WestButton
+					   ]
+				  });


http://bitbucket.org/yt_analysis/yt/changeset/d5a8f2322e60/
changeset:   r4003:d5a8f2322e60
branch:      yt
user:        Cameron Hummels
date:        2011-03-29 05:34:46
summary:     Cleaning up functions.js for formatting.
affected #:  1 file (246 bytes)

--- a/yt/gui/reason/html/js/functions.js	Mon Mar 28 22:59:29 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Mon Mar 28 23:34:46 2011 -0400
@@ -1,29 +1,30 @@
 function cell_finished(result, new_cell) {
-  Ext.each(result['payloads'], function(payload, index) {
-      if (payload['type'] == 'png_string') {
-	new_cell.add(new Ext.Panel({
-	    autoEl:{
-	      tag:'img', width:'25%',
-		  src:"data:image/png;base64," +
-		  payload['image_data'],
-		  id:"payload_image_" + number_images,
-		  onClick: "display_image('payload_image_" +
-		  number_images + "');"
-		  }}));
-	new_cell.doLayout();
-	number_images++;
-      } else if (payload['type'] == 'cell_contents') {
-	var input_line = repl_input.get("input_line")
-	  input_line.setValue(payload['value']);
-      } else if (payload['type'] == 'log_entry') {
-	var record = new logging_store.recordType(
-						  {record: payload['log_entry'] });
-	logging_store.add(record, number_log_records++);
-      }
+    Ext.each(result['payloads'], 
+    function(payload, index) {
+        if (payload['type'] == 'png_string') {
+            new_cell.add(new Ext.Panel({
+                autoEl:{
+                    tag:'img', 
+                    width:'25%',
+                    src:"data:image/png;base64," + payload['image_data'],
+                    id:"payload_image_" + number_images,
+                    onClick: "display_image('payload_image_" + number_images + "');"
+		        }
+            }));
+	        new_cell.doLayout();
+	        number_images++;
+        } else if (payload['type'] == 'cell_contents') {
+	        var input_line = repl_input.get("input_line");
+	        input_line.setValue(payload['value']);
+        } else if (payload['type'] == 'log_entry') {
+	        var record = new logging_store.recordType(
+		        {record: payload['log_entry'] });
+	        logging_store.add(record, number_log_records++);
+        }
     });
-  repl_input.get('input_line').setReadOnly(false);
-  yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
-  repl_input.get("input_line").focus();
+    repl_input.get('input_line').setReadOnly(false);
+    yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
+    repl_input.get("input_line").focus();
 }
 
 function cell_sent() {
@@ -32,23 +33,26 @@
 }
 
 function display_image(image_id) {
-  var image = Ext.get(image_id);
-  var src = image.dom.src;
-  var virtualdom = '<html><title>Image Viewer</title><body><img src="' + src + '"/></body></html>',
-  prev = window.open('', 'image_viewer');
-  prev.document.open();
-  prev.document.write(virtualdom);
-  prev.document.close();
+    var image = Ext.get(image_id);
+    var src = image.dom.src;
+    var virtualdom = '<html><title>Image Viewer</title><body><img src="' + src + '"/></body></html>',
+    prev = window.open('', 'image_viewer');
+    prev.document.open();
+    prev.document.write(virtualdom);
+    prev.document.close();
 }
 
 // Create a tree in the left panel with the pfs and their objects.
 function fill_tree(my_pfs) {
-  examine = my_pfs;
-  treePanel.root.removeAll();
-  Ext.each(my_pfs, function(pf, index) {
-      treePanel.root.appendChild(new Ext.tree.TreeNode({text: pf.name,
-              leaf:false, expanded:true, iconCls: 'pf_icon'}));
-      this_pf = treePanel.root.lastChild
+    examine = my_pfs;
+    treePanel.root.removeAll();
+    Ext.each(my_pfs, function(pf, index) {
+        treePanel.root.appendChild(new Ext.tree.TreeNode({
+            text: pf.name,
+            leaf:false, 
+            expanded:true, 
+            iconCls: 'pf_icon'}));
+        this_pf = treePanel.root.lastChild
 	Ext.each(pf.objects, function(object, obj_index) {
             this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
 		    leaf: true, iconCls: 'data_object'}));


http://bitbucket.org/yt_analysis/yt/changeset/98bc9abf0343/
changeset:   r4004:98bc9abf0343
branch:      yt
user:        MatthewTurk
date:        2011-03-29 04:59:02
summary:     Adding a welcome message, as well as a first setup of the __widgets variable in
the REPL.
affected #:  3 files (551 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Mon Mar 28 19:36:50 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Mon Mar 28 22:59:02 2011 -0400
@@ -89,6 +89,7 @@
         # setting up.
         self.execute("from yt.mods import *")
         self.locals['load_script'] = ext_load_script
+        self.locals['__widgets'] = {}
         self._setup_logging_handlers()
 
     def _setup_logging_handlers(self):


--- a/yt/gui/reason/html/js/cinco.js	Mon Mar 28 19:36:50 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Mon Mar 28 22:59:02 2011 -0400
@@ -21,7 +21,6 @@
   OutputContainer.add(cell);
   notebook.doLayout();
   input_line.setValue("");
-  repl_input.body.removeClass("cell_waiting");
   cell_finished(a.result, cell);
   if (OutputContainer.items.length > 1) {
     OutputContainer.body.dom.scrollTop =
@@ -256,7 +255,15 @@
     status_panel = viewport.get("status-region").get("status-div");
     
     var record = new logging_store.recordType(
-					      {record: '4d3d3d3 engaged' });
+                        {record: '4d3d3d3 engaged' });
     logging_store.add(record, number_log_records++);
-    repl_input.get("input_line").focus();
+    var record = new logging_store.recordType(
+                        {record: 'Welcome to yt.  Press Shift-Enter to evaluate.' });
+    logging_store.add(record, number_log_records++);
+    if (!Ext.state.Manager.get("cinco_welcomed", false)) {
+        Ext.MessageBox.alert("yt - Reason v5",
+                "Welcome to Reason.  Press shift-enter to evaluate.",
+                function(b,e){ repl_input.get("input_line").focus(); });
+        Ext.state.Manager.set("cinco_welcomed", true);
+    } else{ repl_input.get("input_line").focus(); }
   });


--- a/yt/gui/reason/html/js/functions.js	Mon Mar 28 19:36:50 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Mon Mar 28 22:59:02 2011 -0400
@@ -21,8 +21,9 @@
 	logging_store.add(record, number_log_records++);
       }
     });
+  yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
+  repl_input.body.removeClass("cell_waiting");
   repl_input.get('input_line').setReadOnly(false);
-  yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
   repl_input.get("input_line").focus();
 }
 


http://bitbucket.org/yt_analysis/yt/changeset/4d47694296f3/
changeset:   r4005:4d47694296f3
branch:      yt
user:        MatthewTurk
date:        2011-03-29 04:59:54
summary:     Merging
affected #:  0 files (0 bytes)

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Mon Mar 28 22:59:54 2011 -0400
@@ -0,0 +1,41 @@
+var NorthButton = new Ext.Button(
+				 {text : 'North',
+				     pageX : 205,
+				     pageY : 10
+//        handler: function(b, e) { window.open("session.py", "_top"); }
+				     }
+				 );
+
+var EastButton = new Ext.Button(
+				{text:'East',
+				    pageX : 410,
+				    pageY : 205
+				    }
+				);
+var SouthButton = new Ext.Button(
+				 {text:'South',
+				     pageX : 205,
+				     pageY : 410
+				     }
+				 );
+var WestButton = new Ext.Button(
+				{text:'West',
+				    pageX : 10,
+				    pageY : 205
+				    }
+				);
+
+
+var PlotPanel = new Ext.Panel(
+			      {
+			      title: 'Plot Window 1',
+				  iconCls: 'graph',
+				  autoScroll: true,
+				  layout:'absolute',
+				  items: [ 
+					  NorthButton,
+					  EastButton,
+					  SouthButton,
+					  WestButton
+					   ]
+				  });


http://bitbucket.org/yt_analysis/yt/changeset/cb7fcf3c3d5b/
changeset:   r4006:cb7fcf3c3d5b
branch:      yt
user:        brittonsmith
date:        2011-03-29 05:15:00
summary:     Added prompt window action for clicking save button.
affected #:  1 file (254 bytes)

--- a/yt/gui/reason/html/js/cinco.js	Mon Mar 28 19:36:50 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Mon Mar 28 23:15:00 2011 -0400
@@ -137,13 +137,20 @@
             text: 'Download',
             layout:'anchor',
             anchor: '100% 33%',
-            handler: function(b, e) { window.open("session.py", "_top"); }
+	      handler: function(b, e) { window.open("session.py", "_top"); }
         },{
             xtype: 'tbseparator'
         },{
             text: 'Save',
             layout:'anchor',
-            anchor: '100% 67%',
+	      anchor: '100% 67%',
+	      handler: function (b,e) { Ext.Msg.prompt("We have important work to do.", 
+		                                       "Enter filename.", 
+					function(btn, text) {
+						 if (btn == 'ok'){
+						   console.log('Call save function here.')
+						 }
+					}); }
         },{
             xtype: 'tbseparator'
         },{


http://bitbucket.org/yt_analysis/yt/changeset/016a2539b8b6/
changeset:   r4007:016a2539b8b6
branch:      yt
user:        brittonsmith
date:        2011-03-29 05:15:49
summary:     Merged.
affected #:  1 file (466 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Mon Mar 28 23:15:00 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Mon Mar 28 23:15:49 2011 -0400
@@ -89,6 +89,7 @@
         # setting up.
         self.execute("from yt.mods import *")
         self.locals['load_script'] = ext_load_script
+        self.locals['__widgets'] = {}
         self._setup_logging_handlers()
 
     def _setup_logging_handlers(self):


--- a/yt/gui/reason/html/js/cinco.js	Mon Mar 28 23:15:00 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Mon Mar 28 23:15:49 2011 -0400
@@ -21,7 +21,6 @@
   OutputContainer.add(cell);
   notebook.doLayout();
   input_line.setValue("");
-  repl_input.body.removeClass("cell_waiting");
   cell_finished(a.result, cell);
   if (OutputContainer.items.length > 1) {
     OutputContainer.body.dom.scrollTop =
@@ -263,7 +262,15 @@
     status_panel = viewport.get("status-region").get("status-div");
     
     var record = new logging_store.recordType(
-					      {record: '4d3d3d3 engaged' });
+                        {record: '4d3d3d3 engaged' });
     logging_store.add(record, number_log_records++);
-    repl_input.get("input_line").focus();
+    var record = new logging_store.recordType(
+                        {record: 'Welcome to yt.  Press Shift-Enter to evaluate.' });
+    logging_store.add(record, number_log_records++);
+    if (!Ext.state.Manager.get("cinco_welcomed", false)) {
+        Ext.MessageBox.alert("yt - Reason v5",
+                "Welcome to Reason.  Press shift-enter to evaluate.",
+                function(b,e){ repl_input.get("input_line").focus(); });
+        Ext.state.Manager.set("cinco_welcomed", true);
+    } else{ repl_input.get("input_line").focus(); }
   });


--- a/yt/gui/reason/html/js/functions.js	Mon Mar 28 23:15:00 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Mon Mar 28 23:15:49 2011 -0400
@@ -21,8 +21,9 @@
 	logging_store.add(record, number_log_records++);
       }
     });
+  yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
+  repl_input.body.removeClass("cell_waiting");
   repl_input.get('input_line').setReadOnly(false);
-  yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
   repl_input.get("input_line").focus();
 }
 


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Mon Mar 28 23:15:49 2011 -0400
@@ -0,0 +1,41 @@
+var NorthButton = new Ext.Button(
+				 {text : 'North',
+				     pageX : 205,
+				     pageY : 10
+//        handler: function(b, e) { window.open("session.py", "_top"); }
+				     }
+				 );
+
+var EastButton = new Ext.Button(
+				{text:'East',
+				    pageX : 410,
+				    pageY : 205
+				    }
+				);
+var SouthButton = new Ext.Button(
+				 {text:'South',
+				     pageX : 205,
+				     pageY : 410
+				     }
+				 );
+var WestButton = new Ext.Button(
+				{text:'West',
+				    pageX : 10,
+				    pageY : 205
+				    }
+				);
+
+
+var PlotPanel = new Ext.Panel(
+			      {
+			      title: 'Plot Window 1',
+				  iconCls: 'graph',
+				  autoScroll: true,
+				  layout:'absolute',
+				  items: [ 
+					  NorthButton,
+					  EastButton,
+					  SouthButton,
+					  WestButton
+					   ]
+				  });


http://bitbucket.org/yt_analysis/yt/changeset/afc355794c02/
changeset:   r4008:afc355794c02
branch:      yt
user:        jsoishi
date:        2011-03-29 05:17:45
summary:     added set_width function
affected #:  1 file (462 bytes)

--- a/yt/visualization/plot_window.py	Mon Mar 28 23:15:49 2011 -0400
+++ b/yt/visualization/plot_window.py	Mon Mar 28 20:17:45 2011 -0700
@@ -161,8 +161,22 @@
         self.ylim = bounds[2:]
 
     @invalidate_data
-    def set_width(self):
-        pass
+    def set_width(self, new_width):
+        """set the width of the plot window
+
+        parameters
+        ----------
+        new_width : float
+            the width of the image in code units.
+
+        """
+        Wx, Wy = self.width
+        centerx = self.xlim[0] + Wx*0.5
+        centery = self.ylim[0] + Wy*0.5
+        self.xlim[0] = centerx - new_width/2.
+        self.xlim[1] = centerx + new_width/2.
+        self.ylim[0] = centery - new_width/2.
+        self.ylim[1] = centery + new_width/2.
 
     @property
     def width(self):


http://bitbucket.org/yt_analysis/yt/changeset/61c4fc5693a6/
changeset:   r4009:61c4fc5693a6
branch:      yt
user:        MatthewTurk
date:        2011-03-29 05:36:38
summary:     Reformatting the PlotWindow to be an object
affected #:  2 files (759 bytes)

--- a/yt/gui/reason/html/index.html	Mon Mar 28 22:59:54 2011 -0400
+++ b/yt/gui/reason/html/index.html	Mon Mar 28 23:36:38 2011 -0400
@@ -61,6 +61,9 @@
 
     <!-- THE MAIN FUNCTION --><script type="text/javascript" src="js/cinco.js"></script>
+
+    <!-- THE PLOT WINDOW FUNCTIONS -->
+    <script type="text/javascript" src="js/widget_plotwindow.js"></script></head><body><!-- use class="x-hide-display" to prevent a brief flicker of the content -->


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Mon Mar 28 22:59:54 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Mon Mar 28 23:36:38 2011 -0400
@@ -1,41 +1,41 @@
-var NorthButton = new Ext.Button(
-				 {text : 'North',
-				     pageX : 205,
-				     pageY : 10
-//        handler: function(b, e) { window.open("session.py", "_top"); }
-				     }
-				 );
+var WidgetPlotWindow = function(python_varname, viewport) {
+    this.vn = "pw_" + python_varname;
+    this.print_python = function(b, e) {
+        yt_rpc.ExtDirectREPL.execute({code:'print 1,2,3, "' + python_varname + '"'},
+                                     function(f, a)
+                                     {alert(a.result['output']);});
+    }
 
-var EastButton = new Ext.Button(
-				{text:'East',
-				    pageX : 410,
-				    pageY : 205
-				    }
-				);
-var SouthButton = new Ext.Button(
-				 {text:'South',
-				     pageX : 205,
-				     pageY : 410
-				     }
-				 );
-var WestButton = new Ext.Button(
-				{text:'West',
-				    pageX : 10,
-				    pageY : 205
-				    }
-				);
+    viewport.get("center-panel").add(
+                  {
+                  xtype: 'panel',
+                  id: this.vn,
+                  title: this.vn,
+                  iconCls: 'graph',
+                  autoScroll: true,
+                  layout:'absolute',
+                  items: [ 
+                      {xtype:'button',
+                       text: 'North',
+                       x: 205,
+                       y: 10},
+                      {xtype:'button',
+                       text:'East',
+                       x : 410,
+                       y : 205,
+                       handler: this.print_python},
+                      {xtype:'button',
+                       text: 'South',
+                       x: 205,
+                       y: 410},
+                      {xtype: 'button',
+                       text: 'West',
+                       x: 10,
+                       y: 205},
+                       ]
+                  });
 
-
-var PlotPanel = new Ext.Panel(
-			      {
-			      title: 'Plot Window 1',
-				  iconCls: 'graph',
-				  autoScroll: true,
-				  layout:'absolute',
-				  items: [ 
-					  NorthButton,
-					  EastButton,
-					  SouthButton,
-					  WestButton
-					   ]
-				  });
+    viewport.doLayout();
+    this.panel = viewport.get("center-panel").get("pw_" + python_varname);
+    this.panel.doLayout();
+}


http://bitbucket.org/yt_analysis/yt/changeset/1de56bb81f32/
changeset:   r4010:1de56bb81f32
branch:      yt
user:        MatthewTurk
date:        2011-03-29 05:36:52
summary:     Merge
affected #:  0 files (0 bytes)

--- a/yt/gui/reason/html/js/cinco.js	Mon Mar 28 23:36:38 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Mon Mar 28 23:36:52 2011 -0400
@@ -136,13 +136,20 @@
             text: 'Download',
             layout:'anchor',
             anchor: '100% 33%',
-            handler: function(b, e) { window.open("session.py", "_top"); }
+	      handler: function(b, e) { window.open("session.py", "_top"); }
         },{
             xtype: 'tbseparator'
         },{
             text: 'Save',
             layout:'anchor',
-            anchor: '100% 67%',
+	      anchor: '100% 67%',
+	      handler: function (b,e) { Ext.Msg.prompt("We have important work to do.", 
+		                                       "Enter filename.", 
+					function(btn, text) {
+						 if (btn == 'ok'){
+						   console.log('Call save function here.')
+						 }
+					}); }
         },{
             xtype: 'tbseparator'
         },{


--- a/yt/visualization/plot_window.py	Mon Mar 28 23:36:38 2011 -0400
+++ b/yt/visualization/plot_window.py	Mon Mar 28 23:36:52 2011 -0400
@@ -161,8 +161,22 @@
         self.ylim = bounds[2:]
 
     @invalidate_data
-    def set_width(self):
-        pass
+    def set_width(self, new_width):
+        """set the width of the plot window
+
+        parameters
+        ----------
+        new_width : float
+            the width of the image in code units.
+
+        """
+        Wx, Wy = self.width
+        centerx = self.xlim[0] + Wx*0.5
+        centery = self.ylim[0] + Wy*0.5
+        self.xlim[0] = centerx - new_width/2.
+        self.xlim[1] = centerx + new_width/2.
+        self.ylim[0] = centery - new_width/2.
+        self.ylim[1] = centery + new_width/2.
 
     @property
     def width(self):


http://bitbucket.org/yt_analysis/yt/changeset/46cfaade8eea/
changeset:   r4011:46cfaade8eea
branch:      yt
user:        MatthewTurk
date:        2011-03-29 05:37:54
summary:     Merging
affected #:  1 file (248 bytes)

--- a/yt/gui/reason/html/js/functions.js	Mon Mar 28 23:36:52 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Mon Mar 28 23:37:54 2011 -0400
@@ -1,30 +1,31 @@
 function cell_finished(result, new_cell) {
-  Ext.each(result['payloads'], function(payload, index) {
-      if (payload['type'] == 'png_string') {
-	new_cell.add(new Ext.Panel({
-	    autoEl:{
-	      tag:'img', width:'25%',
-		  src:"data:image/png;base64," +
-		  payload['image_data'],
-		  id:"payload_image_" + number_images,
-		  onClick: "display_image('payload_image_" +
-		  number_images + "');"
-		  }}));
-	new_cell.doLayout();
-	number_images++;
-      } else if (payload['type'] == 'cell_contents') {
-	var input_line = repl_input.get("input_line")
-	  input_line.setValue(payload['value']);
-      } else if (payload['type'] == 'log_entry') {
-	var record = new logging_store.recordType(
-						  {record: payload['log_entry'] });
-	logging_store.add(record, number_log_records++);
-      }
+    Ext.each(result['payloads'], 
+    function(payload, index) {
+        if (payload['type'] == 'png_string') {
+            new_cell.add(new Ext.Panel({
+                autoEl:{
+                    tag:'img', 
+                    width:'25%',
+                    src:"data:image/png;base64," + payload['image_data'],
+                    id:"payload_image_" + number_images,
+                    onClick: "display_image('payload_image_" + number_images + "');"
+		        }
+            }));
+	        new_cell.doLayout();
+	        number_images++;
+        } else if (payload['type'] == 'cell_contents') {
+	        var input_line = repl_input.get("input_line");
+	        input_line.setValue(payload['value']);
+        } else if (payload['type'] == 'log_entry') {
+	        var record = new logging_store.recordType(
+		        {record: payload['log_entry'] });
+	        logging_store.add(record, number_log_records++);
+        }
     });
-  yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
-  repl_input.body.removeClass("cell_waiting");
-  repl_input.get('input_line').setReadOnly(false);
-  repl_input.get("input_line").focus();
+    yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
+    repl_input.body.removeClass("cell_waiting");
+    repl_input.get('input_line').setReadOnly(false);
+    repl_input.get("input_line").focus();
 }
 
 function cell_sent() {
@@ -33,23 +34,26 @@
 }
 
 function display_image(image_id) {
-  var image = Ext.get(image_id);
-  var src = image.dom.src;
-  var virtualdom = '<html><title>Image Viewer</title><body><img src="' + src + '"/></body></html>',
-  prev = window.open('', 'image_viewer');
-  prev.document.open();
-  prev.document.write(virtualdom);
-  prev.document.close();
+    var image = Ext.get(image_id);
+    var src = image.dom.src;
+    var virtualdom = '<html><title>Image Viewer</title><body><img src="' + src + '"/></body></html>',
+    prev = window.open('', 'image_viewer');
+    prev.document.open();
+    prev.document.write(virtualdom);
+    prev.document.close();
 }
 
 // Create a tree in the left panel with the pfs and their objects.
 function fill_tree(my_pfs) {
-  examine = my_pfs;
-  treePanel.root.removeAll();
-  Ext.each(my_pfs, function(pf, index) {
-      treePanel.root.appendChild(new Ext.tree.TreeNode({text: pf.name,
-              leaf:false, expanded:true, iconCls: 'pf_icon'}));
-      this_pf = treePanel.root.lastChild
+    examine = my_pfs;
+    treePanel.root.removeAll();
+    Ext.each(my_pfs, function(pf, index) {
+        treePanel.root.appendChild(new Ext.tree.TreeNode({
+            text: pf.name,
+            leaf:false, 
+            expanded:true, 
+            iconCls: 'pf_icon'}));
+        this_pf = treePanel.root.lastChild
 	Ext.each(pf.objects, function(object, obj_index) {
             this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
 		    leaf: true, iconCls: 'data_object'}));


http://bitbucket.org/yt_analysis/yt/changeset/b819a08d6606/
changeset:   r4012:b819a08d6606
branch:      yt
user:        MatthewTurk
date:        2011-03-29 06:21:10
summary:     Initial widget creation mechanism
affected #:  4 files (1.3 KB)

--- a/yt/gui/reason/extdirect_repl.py	Mon Mar 28 23:37:54 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Tue Mar 29 00:21:10 2011 -0400
@@ -28,6 +28,7 @@
 import os
 import cStringIO
 import logging
+import uuid
 from yt.utilities.logger import ytLogger, ufstring
 
 from .bottle_mods import preroute, BottleDirectRouter, notify_route, \
@@ -89,7 +90,9 @@
         # setting up.
         self.execute("from yt.mods import *")
         self.locals['load_script'] = ext_load_script
-        self.locals['__widgets'] = {}
+        self.locals['_widgets'] = {}
+        self.locals['add_widget'] = self._add_widget
+        self.locals['test_widget'] = self._test_widget
         self._setup_logging_handlers()
 
     def _setup_logging_handlers(self):
@@ -155,6 +158,23 @@
         response.headers["content-disposition"] = "attachment;"
         return cs
 
+    def _add_widget(self, widget):
+        # This should be sanitized
+        uu = str(uuid.uuid1()).replace("-","_")
+        varname = "%s_%s" % (widget._widget_name, uu)
+        self.locals[varname] = widget
+        payload = {'type': 'widget',
+                   'widget_type': widget._widget_name,
+                   'varname': varname}
+        print payload
+        self.payload_handler.add_payload(payload)
+
+    def _test_widget(self):
+        class tt(object):
+            _widget_name = "plot_window"
+        mm = tt()
+        return mm
+
 class ExtDirectParameterFileList(BottleDirectRouter):
     my_name = "ExtDirectParameterFileList"
     api_url = "pflist"


--- a/yt/gui/reason/html/js/cinco.js	Mon Mar 28 23:37:54 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Tue Mar 29 00:21:10 2011 -0400
@@ -1,4 +1,5 @@
 var viewport;
+var widget_types = {}
 
 var examine;
 var number_log_records = 0;


--- a/yt/gui/reason/html/js/functions.js	Mon Mar 28 23:37:54 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Tue Mar 29 00:21:10 2011 -0400
@@ -20,6 +20,9 @@
 	        var record = new logging_store.recordType(
 		        {record: payload['log_entry'] });
 	        logging_store.add(record, number_log_records++);
+        } else if (payload['type'] == 'widget') {
+            var widget_type = payload['widget_type'];
+            var widget = new widget_types[widget_type](payload['varname']);
         }
     });
     yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Mon Mar 28 23:37:54 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Tue Mar 29 00:21:10 2011 -0400
@@ -1,7 +1,7 @@
-var WidgetPlotWindow = function(python_varname, viewport) {
+var WidgetPlotWindow = function(python_varname) {
     this.vn = "pw_" + python_varname;
     this.print_python = function(b, e) {
-        yt_rpc.ExtDirectREPL.execute({code:'print 1,2,3, "' + python_varname + '"'},
+        yt_rpc.ExtDirectREPL.execute({code:'print "' + python_varname + '"'},
                                      function(f, a)
                                      {alert(a.result['output']);});
     }
@@ -15,6 +15,18 @@
                   autoScroll: true,
                   layout:'absolute',
                   items: [ 
+                      {xtype:'panel',
+                       autoEl: {
+                         tag: 'img',
+                         id: "img_" + this.vn,
+                         width: 400,
+                         height: 400,
+                       },
+                       x: 10,
+                       y: 10,
+                       width: 400,
+                       height: 400,
+                      },
                       {xtype:'button',
                        text: 'North',
                        x: 205,
@@ -39,3 +51,5 @@
     this.panel = viewport.get("center-panel").get("pw_" + python_varname);
     this.panel.doLayout();
 }
+
+widget_types['plot_window'] = WidgetPlotWindow;


http://bitbucket.org/yt_analysis/yt/changeset/6c97cc3da1a3/
changeset:   r4013:6c97cc3da1a3
branch:      yt
user:        brittonsmith
date:        2011-03-29 06:55:36
summary:     Added save session function.
affected #:  2 files (1.1 KB)

--- a/yt/gui/reason/extdirect_repl.py	Mon Mar 28 23:15:49 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Tue Mar 29 00:55:36 2011 -0400
@@ -148,6 +148,24 @@
     def get_history(self):
         return self.executed_cell_texts[:]
 
+    def save_session(self, filename):
+        if not filename.startswith('/'):
+            filename = os.path.join(os.path.expanduser('~/'), filename)
+        if os.path.exists(filename):
+            return {'status': 'FAIL', 'filename': filename,
+                    'error': 'File exists!'}
+        try:
+            f = open(filename, 'w')
+            f.write("\n######\n".join(self.executed_cell_texts))
+            f.close()
+        except IOError as (errno, strerror):
+            return {'status': 'FAIL', 'filename': filename,
+                    'error': strerror}
+        except:
+            return {'status': 'FAIL', 'filename': filename,
+                    'error': 'Unexpected error.'}
+        return {'status': 'SUCCESS', 'filename': filename}
+
     def _session_py(self):
         cs = cStringIO.StringIO()
         cs.write("\n######\n".join(self.executed_cell_texts))


--- a/yt/gui/reason/html/js/cinco.js	Mon Mar 28 23:15:49 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Tue Mar 29 00:55:36 2011 -0400
@@ -143,13 +143,28 @@
             text: 'Save',
             layout:'anchor',
 	      anchor: '100% 67%',
-	      handler: function (b,e) { Ext.Msg.prompt("We have important work to do.", 
-		                                       "Enter filename.", 
-					function(btn, text) {
-						 if (btn == 'ok'){
-						   console.log('Call save function here.')
+	      handler: function (b,e) { 
+	      Ext.Msg.prompt("We have important work to do.", 
+			     "Enter filename.", 
+			     function(btn, text) {
+			       if (btn == 'ok'){
+				 yt_rpc.ExtDirectREPL.save_session({filename:text}, 
+						      function(f, a) {
+							if (a.result['status'] == 'SUCCESS') {
+							  Ext.Msg.alert('Success!',
+									'Saved session to ' + 
+									a.result['filename']);
+							}
+							else {
+							  Ext.Msg.alert('Always naysaying!',
+									'Failed to save to ' + 
+									a.result['filename'] + 
+									'<br>Error: ' + 
+									a.result['error']);
+							}
+						      });
 						 }
-					}); }
+			     }); }
         },{
             xtype: 'tbseparator'
         },{


http://bitbucket.org/yt_analysis/yt/changeset/618f1655862b/
changeset:   r4014:618f1655862b
branch:      yt
user:        brittonsmith
date:        2011-03-29 06:56:52
summary:     Merged.  Not forgetting to commit.
affected #:  2 files (687 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Tue Mar 29 00:55:36 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Tue Mar 29 00:56:52 2011 -0400
@@ -28,6 +28,7 @@
 import os
 import cStringIO
 import logging
+import uuid
 from yt.utilities.logger import ytLogger, ufstring
 
 from .bottle_mods import preroute, BottleDirectRouter, notify_route, \
@@ -89,7 +90,9 @@
         # setting up.
         self.execute("from yt.mods import *")
         self.locals['load_script'] = ext_load_script
-        self.locals['__widgets'] = {}
+        self.locals['_widgets'] = {}
+        self.locals['add_widget'] = self._add_widget
+        self.locals['test_widget'] = self._test_widget
         self._setup_logging_handlers()
 
     def _setup_logging_handlers(self):
@@ -173,6 +176,23 @@
         response.headers["content-disposition"] = "attachment;"
         return cs
 
+    def _add_widget(self, widget):
+        # This should be sanitized
+        uu = str(uuid.uuid1()).replace("-","_")
+        varname = "%s_%s" % (widget._widget_name, uu)
+        self.locals[varname] = widget
+        payload = {'type': 'widget',
+                   'widget_type': widget._widget_name,
+                   'varname': varname}
+        print payload
+        self.payload_handler.add_payload(payload)
+
+    def _test_widget(self):
+        class tt(object):
+            _widget_name = "plot_window"
+        mm = tt()
+        return mm
+
 class ExtDirectParameterFileList(BottleDirectRouter):
     my_name = "ExtDirectParameterFileList"
     api_url = "pflist"


--- a/yt/gui/reason/html/index.html	Tue Mar 29 00:55:36 2011 -0400
+++ b/yt/gui/reason/html/index.html	Tue Mar 29 00:56:52 2011 -0400
@@ -61,6 +61,9 @@
 
     <!-- THE MAIN FUNCTION --><script type="text/javascript" src="js/cinco.js"></script>
+
+    <!-- THE PLOT WINDOW FUNCTIONS -->
+    <script type="text/javascript" src="js/widget_plotwindow.js"></script></head><body><!-- use class="x-hide-display" to prevent a brief flicker of the content -->


--- a/yt/gui/reason/html/js/cinco.js	Tue Mar 29 00:55:36 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Tue Mar 29 00:56:52 2011 -0400
@@ -1,4 +1,5 @@
 var viewport;
+var widget_types = {}
 
 var examine;
 var number_log_records = 0;


--- a/yt/gui/reason/html/js/functions.js	Tue Mar 29 00:55:36 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Tue Mar 29 00:56:52 2011 -0400
@@ -1,30 +1,34 @@
 function cell_finished(result, new_cell) {
-  Ext.each(result['payloads'], function(payload, index) {
-      if (payload['type'] == 'png_string') {
-	new_cell.add(new Ext.Panel({
-	    autoEl:{
-	      tag:'img', width:'25%',
-		  src:"data:image/png;base64," +
-		  payload['image_data'],
-		  id:"payload_image_" + number_images,
-		  onClick: "display_image('payload_image_" +
-		  number_images + "');"
-		  }}));
-	new_cell.doLayout();
-	number_images++;
-      } else if (payload['type'] == 'cell_contents') {
-	var input_line = repl_input.get("input_line")
-	  input_line.setValue(payload['value']);
-      } else if (payload['type'] == 'log_entry') {
-	var record = new logging_store.recordType(
-						  {record: payload['log_entry'] });
-	logging_store.add(record, number_log_records++);
-      }
+    Ext.each(result['payloads'], 
+    function(payload, index) {
+        if (payload['type'] == 'png_string') {
+            new_cell.add(new Ext.Panel({
+                autoEl:{
+                    tag:'img', 
+                    width:'25%',
+                    src:"data:image/png;base64," + payload['image_data'],
+                    id:"payload_image_" + number_images,
+                    onClick: "display_image('payload_image_" + number_images + "');"
+		        }
+            }));
+	        new_cell.doLayout();
+	        number_images++;
+        } else if (payload['type'] == 'cell_contents') {
+	        var input_line = repl_input.get("input_line");
+	        input_line.setValue(payload['value']);
+        } else if (payload['type'] == 'log_entry') {
+	        var record = new logging_store.recordType(
+		        {record: payload['log_entry'] });
+	        logging_store.add(record, number_log_records++);
+        } else if (payload['type'] == 'widget') {
+            var widget_type = payload['widget_type'];
+            var widget = new widget_types[widget_type](payload['varname']);
+        }
     });
-  yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
-  repl_input.body.removeClass("cell_waiting");
-  repl_input.get('input_line').setReadOnly(false);
-  repl_input.get("input_line").focus();
+    yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
+    repl_input.body.removeClass("cell_waiting");
+    repl_input.get('input_line').setReadOnly(false);
+    repl_input.get("input_line").focus();
 }
 
 function cell_sent() {
@@ -33,23 +37,26 @@
 }
 
 function display_image(image_id) {
-  var image = Ext.get(image_id);
-  var src = image.dom.src;
-  var virtualdom = '<html><title>Image Viewer</title><body><img src="' + src + '"/></body></html>',
-  prev = window.open('', 'image_viewer');
-  prev.document.open();
-  prev.document.write(virtualdom);
-  prev.document.close();
+    var image = Ext.get(image_id);
+    var src = image.dom.src;
+    var virtualdom = '<html><title>Image Viewer</title><body><img src="' + src + '"/></body></html>',
+    prev = window.open('', 'image_viewer');
+    prev.document.open();
+    prev.document.write(virtualdom);
+    prev.document.close();
 }
 
 // Create a tree in the left panel with the pfs and their objects.
 function fill_tree(my_pfs) {
-  examine = my_pfs;
-  treePanel.root.removeAll();
-  Ext.each(my_pfs, function(pf, index) {
-      treePanel.root.appendChild(new Ext.tree.TreeNode({text: pf.name,
-              leaf:false, expanded:true, iconCls: 'pf_icon'}));
-      this_pf = treePanel.root.lastChild
+    examine = my_pfs;
+    treePanel.root.removeAll();
+    Ext.each(my_pfs, function(pf, index) {
+        treePanel.root.appendChild(new Ext.tree.TreeNode({
+            text: pf.name,
+            leaf:false, 
+            expanded:true, 
+            iconCls: 'pf_icon'}));
+        this_pf = treePanel.root.lastChild
 	Ext.each(pf.objects, function(object, obj_index) {
             this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
 		    leaf: true, iconCls: 'data_object'}));


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Tue Mar 29 00:55:36 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Tue Mar 29 00:56:52 2011 -0400
@@ -1,41 +1,55 @@
-var NorthButton = new Ext.Button(
-				 {text : 'North',
-				     pageX : 205,
-				     pageY : 10
-//        handler: function(b, e) { window.open("session.py", "_top"); }
-				     }
-				 );
+var WidgetPlotWindow = function(python_varname) {
+    this.vn = "pw_" + python_varname;
+    this.print_python = function(b, e) {
+        yt_rpc.ExtDirectREPL.execute({code:'print "' + python_varname + '"'},
+                                     function(f, a)
+                                     {alert(a.result['output']);});
+    }
 
-var EastButton = new Ext.Button(
-				{text:'East',
-				    pageX : 410,
-				    pageY : 205
-				    }
-				);
-var SouthButton = new Ext.Button(
-				 {text:'South',
-				     pageX : 205,
-				     pageY : 410
-				     }
-				 );
-var WestButton = new Ext.Button(
-				{text:'West',
-				    pageX : 10,
-				    pageY : 205
-				    }
-				);
+    viewport.get("center-panel").add(
+                  {
+                  xtype: 'panel',
+                  id: this.vn,
+                  title: this.vn,
+                  iconCls: 'graph',
+                  autoScroll: true,
+                  layout:'absolute',
+                  items: [ 
+                      {xtype:'panel',
+                       autoEl: {
+                         tag: 'img',
+                         id: "img_" + this.vn,
+                         width: 400,
+                         height: 400,
+                       },
+                       x: 10,
+                       y: 10,
+                       width: 400,
+                       height: 400,
+                      },
+                      {xtype:'button',
+                       text: 'North',
+                       x: 205,
+                       y: 10},
+                      {xtype:'button',
+                       text:'East',
+                       x : 410,
+                       y : 205,
+                       handler: this.print_python},
+                      {xtype:'button',
+                       text: 'South',
+                       x: 205,
+                       y: 410},
+                      {xtype: 'button',
+                       text: 'West',
+                       x: 10,
+                       y: 205},
+                       ]
+                  });
 
+    viewport.doLayout();
+    this.panel = viewport.get("center-panel").get("pw_" + python_varname);
+    this.panel.doLayout();
+}
 
-var PlotPanel = new Ext.Panel(
-			      {
-			      title: 'Plot Window 1',
-				  iconCls: 'graph',
-				  autoScroll: true,
-				  layout:'absolute',
-				  items: [ 
-					  NorthButton,
-					  EastButton,
-					  SouthButton,
-					  WestButton
-					   ]
-				  });
+widget_types['plot_window'] = WidgetPlotWindow;


--- a/yt/visualization/plot_window.py	Tue Mar 29 00:55:36 2011 -0400
+++ b/yt/visualization/plot_window.py	Tue Mar 29 00:56:52 2011 -0400
@@ -161,8 +161,22 @@
         self.ylim = bounds[2:]
 
     @invalidate_data
-    def set_width(self):
-        pass
+    def set_width(self, new_width):
+        """set the width of the plot window
+
+        parameters
+        ----------
+        new_width : float
+            the width of the image in code units.
+
+        """
+        Wx, Wy = self.width
+        centerx = self.xlim[0] + Wx*0.5
+        centery = self.ylim[0] + Wy*0.5
+        self.xlim[0] = centerx - new_width/2.
+        self.xlim[1] = centerx + new_width/2.
+        self.ylim[0] = centery - new_width/2.
+        self.ylim[1] = centery + new_width/2.
 
     @property
     def width(self):


http://bitbucket.org/yt_analysis/yt/changeset/438c50d806bc/
changeset:   r4015:438c50d806bc
branch:      yt
user:        MatthewTurk
date:        2011-03-29 07:06:59
summary:     Setting up the plot window widget
affected #:  5 files (948 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Tue Mar 29 00:21:10 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Tue Mar 29 01:06:59 2011 -0400
@@ -162,6 +162,7 @@
         # This should be sanitized
         uu = str(uuid.uuid1()).replace("-","_")
         varname = "%s_%s" % (widget._widget_name, uu)
+        widget._ext_widget_id = varname
         self.locals[varname] = widget
         payload = {'type': 'widget',
                    'widget_type': widget._widget_name,


--- a/yt/gui/reason/html/js/cinco.js	Tue Mar 29 00:21:10 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Tue Mar 29 01:06:59 2011 -0400
@@ -1,5 +1,6 @@
 var viewport;
 var widget_types = {}
+var widget_list = {}
 
 var examine;
 var number_log_records = 0;


--- a/yt/gui/reason/html/js/functions.js	Tue Mar 29 00:21:10 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Tue Mar 29 01:06:59 2011 -0400
@@ -23,6 +23,10 @@
         } else if (payload['type'] == 'widget') {
             var widget_type = payload['widget_type'];
             var widget = new widget_types[widget_type](payload['varname']);
+            widget_list[widget.id] = widget;
+        } else if (payload['type'] == 'widget_payload') {
+            var widget = widget_list[payload['widget_id']];
+            widget.handle_payload(payload);
         }
     });
     yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
@@ -48,7 +52,6 @@
 
 // Create a tree in the left panel with the pfs and their objects.
 function fill_tree(my_pfs) {
-    examine = my_pfs;
     treePanel.root.removeAll();
     Ext.each(my_pfs, function(pf, index) {
         treePanel.root.appendChild(new Ext.tree.TreeNode({


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Tue Mar 29 00:21:10 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Tue Mar 29 01:06:59 2011 -0400
@@ -1,5 +1,5 @@
 var WidgetPlotWindow = function(python_varname) {
-    this.vn = "pw_" + python_varname;
+    this.id = python_varname;
     this.print_python = function(b, e) {
         yt_rpc.ExtDirectREPL.execute({code:'print "' + python_varname + '"'},
                                      function(f, a)
@@ -9,16 +9,17 @@
     viewport.get("center-panel").add(
                   {
                   xtype: 'panel',
-                  id: this.vn,
-                  title: this.vn,
+                  id: "pw_" + this.id,
+                  title: this.id,
                   iconCls: 'graph',
                   autoScroll: true,
                   layout:'absolute',
                   items: [ 
                       {xtype:'panel',
+                       id: 'image_panel_' + this.id,
                        autoEl: {
                          tag: 'img',
-                         id: "img_" + this.vn,
+                         id: "img_" + this.id,
                          width: 400,
                          height: 400,
                        },
@@ -50,6 +51,11 @@
     viewport.doLayout();
     this.panel = viewport.get("center-panel").get("pw_" + python_varname);
     this.panel.doLayout();
+    this.image_panel = this.panel.get("image_panel_"+python_varname);
+
+    this.handle_payload = function(payload) {
+        this.image_panel.el.dom.src = "data:image/png;base64," + payload['image_data'];
+    }
 }
 
 widget_types['plot_window'] = WidgetPlotWindow;


--- a/yt/visualization/plot_window.py	Tue Mar 29 00:21:10 2011 -0400
+++ b/yt/visualization/plot_window.py	Tue Mar 29 01:06:59 2011 -0400
@@ -262,11 +262,22 @@
     """A viewer for the web interface.
 
     """
+    _ext_widget_id = None
+    _current_field = None
+    _widget_name = "plot_window"
     def _setup_plots(self):
         from yt.gui.reason.bottle_mods import PayloadHandler
         import base64
         ph = PayloadHandler()
-        for field in self._frb.data.keys():
+        if self._current_field is not None \
+           and self._ext_widget_id is not None:
+            fields = [self._current_field]
+            addl_keys = {'type': 'widget_payload',
+                         'widget_id': self._ext_widget_id}
+        else:
+            fields = self._frb.data.keys()
+            addl_keys = {}
+        for field in fields:
             tf = tempfile.TemporaryFile()
             to_plot = apply_colormap(self._frb[field],func = self._field_transform[field])
             write_png_to_file(to_plot, tf)
@@ -275,6 +286,7 @@
             tf.close()
             payload = {'type':'png_string',
                        'image_data':img_data}
+            payload.update(addl_keys)
             ph.add_payload(payload)
 
     def get_metadata(self):


http://bitbucket.org/yt_analysis/yt/changeset/0ffc1086941b/
changeset:   r4016:0ffc1086941b
branch:      yt
user:        MatthewTurk
date:        2011-03-29 07:07:06
summary:     Merge
affected #:  2 files (1.1 KB)

--- a/yt/gui/reason/extdirect_repl.py	Tue Mar 29 01:06:59 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Tue Mar 29 01:07:06 2011 -0400
@@ -151,6 +151,24 @@
     def get_history(self):
         return self.executed_cell_texts[:]
 
+    def save_session(self, filename):
+        if not filename.startswith('/'):
+            filename = os.path.join(os.path.expanduser('~/'), filename)
+        if os.path.exists(filename):
+            return {'status': 'FAIL', 'filename': filename,
+                    'error': 'File exists!'}
+        try:
+            f = open(filename, 'w')
+            f.write("\n######\n".join(self.executed_cell_texts))
+            f.close()
+        except IOError as (errno, strerror):
+            return {'status': 'FAIL', 'filename': filename,
+                    'error': strerror}
+        except:
+            return {'status': 'FAIL', 'filename': filename,
+                    'error': 'Unexpected error.'}
+        return {'status': 'SUCCESS', 'filename': filename}
+
     def _session_py(self):
         cs = cStringIO.StringIO()
         cs.write("\n######\n".join(self.executed_cell_texts))


--- a/yt/gui/reason/html/js/cinco.js	Tue Mar 29 01:06:59 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Tue Mar 29 01:07:06 2011 -0400
@@ -145,13 +145,28 @@
             text: 'Save',
             layout:'anchor',
 	      anchor: '100% 67%',
-	      handler: function (b,e) { Ext.Msg.prompt("We have important work to do.", 
-		                                       "Enter filename.", 
-					function(btn, text) {
-						 if (btn == 'ok'){
-						   console.log('Call save function here.')
+	      handler: function (b,e) { 
+	      Ext.Msg.prompt("We have important work to do.", 
+			     "Enter filename.", 
+			     function(btn, text) {
+			       if (btn == 'ok'){
+				 yt_rpc.ExtDirectREPL.save_session({filename:text}, 
+						      function(f, a) {
+							if (a.result['status'] == 'SUCCESS') {
+							  Ext.Msg.alert('Success!',
+									'Saved session to ' + 
+									a.result['filename']);
+							}
+							else {
+							  Ext.Msg.alert('Always naysaying!',
+									'Failed to save to ' + 
+									a.result['filename'] + 
+									'<br>Error: ' + 
+									a.result['error']);
+							}
+						      });
 						 }
-					}); }
+			     }); }
         },{
             xtype: 'tbseparator'
         },{


http://bitbucket.org/yt_analysis/yt/changeset/653e4088682f/
changeset:   r4017:653e4088682f
branch:      yt
user:        brittonsmith
date:        2011-03-29 07:18:10
summary:     Added pastebin function.
affected #:  2 files (734 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Tue Mar 29 00:56:52 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Tue Mar 29 01:18:10 2011 -0400
@@ -169,6 +169,18 @@
                     'error': 'Unexpected error.'}
         return {'status': 'SUCCESS', 'filename': filename}
 
+    def paste_session(self):
+        import xmlrpclib, cStringIO
+        p = xmlrpclib.ServerProxy(
+            "http://paste.enzotools.org/xmlrpc/",
+            allow_none=True)
+        cs = cStringIO.StringIO()
+        cs.write("\n######\n".join(self.executed_cell_texts))
+        cs = cs.getvalue()
+        ret = p.pastes.newPaste('pytb', cs, None, '', '', True)
+        site = "http://paste.enzotools.org/show/%s" % ret
+        return {'status': 'SUCCESS', 'site': site}
+
     def _session_py(self):
         cs = cStringIO.StringIO()
         cs.write("\n######\n".join(self.executed_cell_texts))


--- a/yt/gui/reason/html/js/cinco.js	Tue Mar 29 00:56:52 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Tue Mar 29 01:18:10 2011 -0400
@@ -172,6 +172,14 @@
             text: 'Pastebin',
             layout:'anchor',
             anchor: '100% 100%',
+	    handler: function (b,e) { 
+	      yt_rpc.ExtDirectREPL.paste_session({}, function(f, a) {
+							if (a.result['status'] == 'SUCCESS') {
+							  Ext.Msg.alert('Pastebin',
+									'Pasted session to:<br>' + 
+									a.result['site']);
+							}
+		}); }
         }]
     }]
 });


http://bitbucket.org/yt_analysis/yt/changeset/8b5641fd63b7/
changeset:   r4018:8b5641fd63b7
branch:      yt
user:        brittonsmith
date:        2011-03-29 07:18:31
summary:     Merged.
affected #:  2 files (61 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Tue Mar 29 01:18:10 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Tue Mar 29 01:18:31 2011 -0400
@@ -192,6 +192,7 @@
         # This should be sanitized
         uu = str(uuid.uuid1()).replace("-","_")
         varname = "%s_%s" % (widget._widget_name, uu)
+        widget._ext_widget_id = varname
         self.locals[varname] = widget
         payload = {'type': 'widget',
                    'widget_type': widget._widget_name,


--- a/yt/gui/reason/html/js/cinco.js	Tue Mar 29 01:18:10 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Tue Mar 29 01:18:31 2011 -0400
@@ -1,5 +1,6 @@
 var viewport;
 var widget_types = {}
+var widget_list = {}
 
 var examine;
 var number_log_records = 0;


--- a/yt/gui/reason/html/js/functions.js	Tue Mar 29 01:18:10 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Tue Mar 29 01:18:31 2011 -0400
@@ -23,6 +23,10 @@
         } else if (payload['type'] == 'widget') {
             var widget_type = payload['widget_type'];
             var widget = new widget_types[widget_type](payload['varname']);
+            widget_list[widget.id] = widget;
+        } else if (payload['type'] == 'widget_payload') {
+            var widget = widget_list[payload['widget_id']];
+            widget.handle_payload(payload);
         }
     });
     yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
@@ -48,7 +52,6 @@
 
 // Create a tree in the left panel with the pfs and their objects.
 function fill_tree(my_pfs) {
-    examine = my_pfs;
     treePanel.root.removeAll();
     Ext.each(my_pfs, function(pf, index) {
         treePanel.root.appendChild(new Ext.tree.TreeNode({


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Tue Mar 29 01:18:10 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Tue Mar 29 01:18:31 2011 -0400
@@ -1,5 +1,5 @@
 var WidgetPlotWindow = function(python_varname) {
-    this.vn = "pw_" + python_varname;
+    this.id = python_varname;
     this.print_python = function(b, e) {
         yt_rpc.ExtDirectREPL.execute({code:'print "' + python_varname + '"'},
                                      function(f, a)
@@ -9,16 +9,17 @@
     viewport.get("center-panel").add(
                   {
                   xtype: 'panel',
-                  id: this.vn,
-                  title: this.vn,
+                  id: "pw_" + this.id,
+                  title: this.id,
                   iconCls: 'graph',
                   autoScroll: true,
                   layout:'absolute',
                   items: [ 
                       {xtype:'panel',
+                       id: 'image_panel_' + this.id,
                        autoEl: {
                          tag: 'img',
-                         id: "img_" + this.vn,
+                         id: "img_" + this.id,
                          width: 400,
                          height: 400,
                        },
@@ -50,6 +51,11 @@
     viewport.doLayout();
     this.panel = viewport.get("center-panel").get("pw_" + python_varname);
     this.panel.doLayout();
+    this.image_panel = this.panel.get("image_panel_"+python_varname);
+
+    this.handle_payload = function(payload) {
+        this.image_panel.el.dom.src = "data:image/png;base64," + payload['image_data'];
+    }
 }
 
 widget_types['plot_window'] = WidgetPlotWindow;


--- a/yt/visualization/plot_window.py	Tue Mar 29 01:18:10 2011 -0400
+++ b/yt/visualization/plot_window.py	Tue Mar 29 01:18:31 2011 -0400
@@ -262,11 +262,22 @@
     """A viewer for the web interface.
 
     """
+    _ext_widget_id = None
+    _current_field = None
+    _widget_name = "plot_window"
     def _setup_plots(self):
         from yt.gui.reason.bottle_mods import PayloadHandler
         import base64
         ph = PayloadHandler()
-        for field in self._frb.data.keys():
+        if self._current_field is not None \
+           and self._ext_widget_id is not None:
+            fields = [self._current_field]
+            addl_keys = {'type': 'widget_payload',
+                         'widget_id': self._ext_widget_id}
+        else:
+            fields = self._frb.data.keys()
+            addl_keys = {}
+        for field in fields:
             tf = tempfile.TemporaryFile()
             to_plot = apply_colormap(self._frb[field],func = self._field_transform[field])
             write_png_to_file(to_plot, tf)
@@ -275,6 +286,7 @@
             tf.close()
             payload = {'type':'png_string',
                        'image_data':img_data}
+            payload.update(addl_keys)
             ph.add_payload(payload)
 
     def get_metadata(self):


http://bitbucket.org/yt_analysis/yt/changeset/e70cc4010623/
changeset:   r4019:e70cc4010623
branch:      yt
user:        MatthewTurk
date:        2011-03-29 07:41:27
summary:     Plot window sort of works
affected #:  4 files (1.3 KB)

--- a/yt/gui/reason/html/js/cinco.js	Tue Mar 29 01:07:06 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Tue Mar 29 01:41:27 2011 -0400
@@ -31,6 +31,10 @@
   }
 }
 
+var handle_payload = function(pp) {
+    cell_finished(pp, null);
+}
+
 var repl_input = new Ext.FormPanel({
   title: 'YT Input',
       url: 'push',


--- a/yt/gui/reason/html/js/functions.js	Tue Mar 29 01:07:06 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Tue Mar 29 01:41:27 2011 -0400
@@ -26,7 +26,7 @@
             widget_list[widget.id] = widget;
         } else if (payload['type'] == 'widget_payload') {
             var widget = widget_list[payload['widget_id']];
-            widget.handle_payload(payload);
+            widget.accept_results(payload);
         }
     });
     yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Tue Mar 29 01:07:06 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Tue Mar 29 01:41:27 2011 -0400
@@ -31,20 +31,36 @@
                       {xtype:'button',
                        text: 'North',
                        x: 205,
-                       y: 10},
+                       y: 10,
+                       handler: function(b,e) {
+                       cc = python_varname + '.pan_rel((0.0, 0.5))'
+	            yt_rpc.ExtDirectREPL.execute(
+                    {code:cc}, handle_payload); }
+                       },
                       {xtype:'button',
                        text:'East',
                        x : 410,
                        y : 205,
-                       handler: this.print_python},
+                       handler: function(b,e) {
+	            yt_rpc.ExtDirectREPL.execute(
+                    {code:python_varname + '.pan_rel((0.5, 0.0))'},
+                    handle_payload); }},
                       {xtype:'button',
                        text: 'South',
                        x: 205,
-                       y: 410},
+                       y: 410,
+                       handler: function(b,e) {
+	            yt_rpc.ExtDirectREPL.execute(
+                    {code:python_varname + '.pan_rel((0.0, -0.5))'},
+                    handle_payload); }},
                       {xtype: 'button',
                        text: 'West',
                        x: 10,
-                       y: 205},
+                       y: 205,
+                       handler: function(b,e) {
+	            yt_rpc.ExtDirectREPL.execute(
+                    {code:python_varname + '.pan_rel((-0.5, 0.0))'},
+                    handle_payload); }},
                        ]
                   });
 
@@ -53,7 +69,7 @@
     this.panel.doLayout();
     this.image_panel = this.panel.get("image_panel_"+python_varname);
 
-    this.handle_payload = function(payload) {
+    this.accept_results = function(payload) {
         this.image_panel.el.dom.src = "data:image/png;base64," + payload['image_data'];
     }
 }


--- a/yt/visualization/plot_window.py	Tue Mar 29 01:07:06 2011 -0400
+++ b/yt/visualization/plot_window.py	Tue Mar 29 01:41:27 2011 -0400
@@ -152,6 +152,20 @@
         self.ylim = (self.ylim[0] + deltas[1], self.ylim[1] + deltas[1])
 
     @invalidate_data
+    def pan_rel(self, deltas):
+        r"""Pan the image by specifying relative deltas, to the FOV.
+        
+        Parameters
+        ----------
+        deltas : sequence of floats
+            (delta_x, delta_y) in *relative* code unit coordinates
+
+        """
+        Wx, Wy = self.width
+        self.xlim = (self.xlim[0] + Wx*deltas[0], self.xlim[1] + Wx*deltas[0])
+        self.ylim = (self.ylim[0] + Wy*deltas[1], self.ylim[1] + Wy*deltas[1])
+
+    @invalidate_data
     def set_field(self):
         pass
 


http://bitbucket.org/yt_analysis/yt/changeset/fd9559955368/
changeset:   r4020:fd9559955368
branch:      yt
user:        MatthewTurk
date:        2011-03-29 07:42:06
summary:     Merge
affected #:  1 file (258 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Tue Mar 29 01:41:27 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Tue Mar 29 01:42:06 2011 -0400
@@ -169,6 +169,18 @@
                     'error': 'Unexpected error.'}
         return {'status': 'SUCCESS', 'filename': filename}
 
+    def paste_session(self):
+        import xmlrpclib, cStringIO
+        p = xmlrpclib.ServerProxy(
+            "http://paste.enzotools.org/xmlrpc/",
+            allow_none=True)
+        cs = cStringIO.StringIO()
+        cs.write("\n######\n".join(self.executed_cell_texts))
+        cs = cs.getvalue()
+        ret = p.pastes.newPaste('pytb', cs, None, '', '', True)
+        site = "http://paste.enzotools.org/show/%s" % ret
+        return {'status': 'SUCCESS', 'site': site}
+
     def _session_py(self):
         cs = cStringIO.StringIO()
         cs.write("\n######\n".join(self.executed_cell_texts))


--- a/yt/gui/reason/html/js/cinco.js	Tue Mar 29 01:41:27 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Tue Mar 29 01:42:06 2011 -0400
@@ -177,6 +177,14 @@
             text: 'Pastebin',
             layout:'anchor',
             anchor: '100% 100%',
+	    handler: function (b,e) { 
+	      yt_rpc.ExtDirectREPL.paste_session({}, function(f, a) {
+							if (a.result['status'] == 'SUCCESS') {
+							  Ext.Msg.alert('Pastebin',
+									'Pasted session to:<br>' + 
+									a.result['site']);
+							}
+		}); }
         }]
     }]
 });


http://bitbucket.org/yt_analysis/yt/changeset/9da8c50a07a8/
changeset:   r4021:9da8c50a07a8
branch:      yt
user:        brittonsmith
date:        2011-03-29 08:06:02
summary:     Added status bar update on download, save, and pastebin button use.
affected #:  2 files (673 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Tue Mar 29 01:18:31 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Tue Mar 29 02:06:02 2011 -0400
@@ -152,8 +152,10 @@
         return self.executed_cell_texts[:]
 
     def save_session(self, filename):
-        if not filename.startswith('/'):
-            filename = os.path.join(os.path.expanduser('~/'), filename)
+        if filename.startswith('~'):
+            filename = os.path.expanduser(filename)
+        elif not filename.startswith('/'):
+            filename = os.path.join(os.getcwd(), filename)
         if os.path.exists(filename):
             return {'status': 'FAIL', 'filename': filename,
                     'error': 'File exists!'}


--- a/yt/gui/reason/html/js/cinco.js	Tue Mar 29 01:18:31 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Tue Mar 29 02:06:02 2011 -0400
@@ -138,7 +138,11 @@
             text: 'Download',
             layout:'anchor',
             anchor: '100% 33%',
-	      handler: function(b, e) { window.open("session.py", "_top"); }
+	      handler: function(b, e) { 
+	      window.open("session.py", "_top"); 
+	      var record = new logging_store.recordType({record: 'Saved session locally.'});
+	      logging_store.add(record, number_log_records++);
+	    }
         },{
             xtype: 'tbseparator'
         },{
@@ -153,9 +157,12 @@
 				 yt_rpc.ExtDirectREPL.save_session({filename:text}, 
 						      function(f, a) {
 							if (a.result['status'] == 'SUCCESS') {
-							  Ext.Msg.alert('Success!',
-									'Saved session to ' + 
-									a.result['filename']);
+							  var alert_text = 'Saved session to ' + 
+							    a.result['filename']
+							  Ext.Msg.alert('Success!', alert_text);
+							  var record = new logging_store.recordType(
+									   {record: alert_text });
+							  logging_store.add(record, number_log_records++);
 							}
 							else {
 							  Ext.Msg.alert('Always naysaying!',
@@ -176,9 +183,14 @@
 	    handler: function (b,e) { 
 	      yt_rpc.ExtDirectREPL.paste_session({}, function(f, a) {
 							if (a.result['status'] == 'SUCCESS') {
-							  Ext.Msg.alert('Pastebin',
-									'Pasted session to:<br>' + 
-									a.result['site']);
+							  var alert_text = 'Pasted session to:<br>' + 
+							    a.result['site']
+							  var alert_text_rec = 'Pasted session to: ' + 
+							    a.result['site']
+							  Ext.Msg.alert('Pastebin', alert_text);
+							  var record = new logging_store.recordType(
+									   {record: alert_text_rec });
+							  logging_store.add(record, number_log_records++);
 							}
 		}); }
         }]


http://bitbucket.org/yt_analysis/yt/changeset/2e5d09c71275/
changeset:   r4022:2e5d09c71275
branch:      yt
user:        brittonsmith
date:        2011-03-29 08:07:06
summary:     Merged.
affected #:  1 file (68 bytes)

--- a/yt/gui/reason/html/js/cinco.js	Tue Mar 29 02:06:02 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Tue Mar 29 02:07:06 2011 -0400
@@ -31,6 +31,10 @@
   }
 }
 
+var handle_payload = function(pp) {
+    cell_finished(pp, null);
+}
+
 var repl_input = new Ext.FormPanel({
   title: 'YT Input',
       url: 'push',


--- a/yt/gui/reason/html/js/functions.js	Tue Mar 29 02:06:02 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Tue Mar 29 02:07:06 2011 -0400
@@ -26,7 +26,7 @@
             widget_list[widget.id] = widget;
         } else if (payload['type'] == 'widget_payload') {
             var widget = widget_list[payload['widget_id']];
-            widget.handle_payload(payload);
+            widget.accept_results(payload);
         }
     });
     yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Tue Mar 29 02:06:02 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Tue Mar 29 02:07:06 2011 -0400
@@ -31,20 +31,36 @@
                       {xtype:'button',
                        text: 'North',
                        x: 205,
-                       y: 10},
+                       y: 10,
+                       handler: function(b,e) {
+                       cc = python_varname + '.pan_rel((0.0, 0.5))'
+	            yt_rpc.ExtDirectREPL.execute(
+                    {code:cc}, handle_payload); }
+                       },
                       {xtype:'button',
                        text:'East',
                        x : 410,
                        y : 205,
-                       handler: this.print_python},
+                       handler: function(b,e) {
+	            yt_rpc.ExtDirectREPL.execute(
+                    {code:python_varname + '.pan_rel((0.5, 0.0))'},
+                    handle_payload); }},
                       {xtype:'button',
                        text: 'South',
                        x: 205,
-                       y: 410},
+                       y: 410,
+                       handler: function(b,e) {
+	            yt_rpc.ExtDirectREPL.execute(
+                    {code:python_varname + '.pan_rel((0.0, -0.5))'},
+                    handle_payload); }},
                       {xtype: 'button',
                        text: 'West',
                        x: 10,
-                       y: 205},
+                       y: 205,
+                       handler: function(b,e) {
+	            yt_rpc.ExtDirectREPL.execute(
+                    {code:python_varname + '.pan_rel((-0.5, 0.0))'},
+                    handle_payload); }},
                        ]
                   });
 
@@ -53,7 +69,7 @@
     this.panel.doLayout();
     this.image_panel = this.panel.get("image_panel_"+python_varname);
 
-    this.handle_payload = function(payload) {
+    this.accept_results = function(payload) {
         this.image_panel.el.dom.src = "data:image/png;base64," + payload['image_data'];
     }
 }


--- a/yt/visualization/plot_window.py	Tue Mar 29 02:06:02 2011 -0400
+++ b/yt/visualization/plot_window.py	Tue Mar 29 02:07:06 2011 -0400
@@ -152,6 +152,20 @@
         self.ylim = (self.ylim[0] + deltas[1], self.ylim[1] + deltas[1])
 
     @invalidate_data
+    def pan_rel(self, deltas):
+        r"""Pan the image by specifying relative deltas, to the FOV.
+        
+        Parameters
+        ----------
+        deltas : sequence of floats
+            (delta_x, delta_y) in *relative* code unit coordinates
+
+        """
+        Wx, Wy = self.width
+        self.xlim = (self.xlim[0] + Wx*deltas[0], self.xlim[1] + Wx*deltas[0])
+        self.ylim = (self.ylim[0] + Wy*deltas[1], self.ylim[1] + Wy*deltas[1])
+
+    @invalidate_data
     def set_field(self):
         pass
 


http://bitbucket.org/yt_analysis/yt/changeset/b202ed6849c3/
changeset:   r4023:b202ed6849c3
branch:      yt
user:        MatthewTurk
date:        2011-03-29 08:07:17
summary:     Fixing some activation code for the plot window, added optional rocket import
affected #:  3 files (427 bytes)

--- a/yt/gui/reason/bottle_mods.py	Tue Mar 29 01:42:06 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Tue Mar 29 02:07:17 2011 -0400
@@ -28,6 +28,7 @@
 import uuid
 from extdirect_router import DirectRouter, DirectProviderDefinition
 import json
+import logging
 from yt.utilities.logger import ytLogger as mylog
 
 route_functions = {}
@@ -125,10 +126,16 @@
             thread = threading.Timer(0.5, _local_browse)
             thread.start()
         local_browse()
-    # Right now we only really support the built-in wsgiref, but this may
-    # change if we start using Rocket.
-    server_type = server_names.get("wsgiref")
-    server = server_type(host='localhost', port=8080)
+    try:
+        import rocket
+        server_name = "rocket"
+        log = logging.getLogger('Rocket')
+        log.setLevel(logging.INFO)
+        kwargs = {'timeout': 600}
+    except ImportError:
+        server_name = "wsgiref"
+    server_type = server_names.get(server_name)
+    server = server_type(host='localhost', port=8080, **kwargs)
     #repl.locals['server'] = server
     mylog.info("Starting up the server.")
     run(server=server)


--- a/yt/gui/reason/extdirect_repl.py	Tue Mar 29 01:42:06 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Tue Mar 29 02:07:17 2011 -0400
@@ -193,6 +193,8 @@
         uu = str(uuid.uuid1()).replace("-","_")
         varname = "%s_%s" % (widget._widget_name, uu)
         widget._ext_widget_id = varname
+        # THIS BREAKS THE SCRIPT DOWNLOAD!
+        # We need to make the variable be bound via an execution mechanism
         self.locals[varname] = widget
         payload = {'type': 'widget',
                    'widget_type': widget._widget_name,


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Tue Mar 29 01:42:06 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Tue Mar 29 02:07:17 2011 -0400
@@ -64,6 +64,7 @@
                        ]
                   });
 
+    viewport.get("center-panel").activate("pw_" + this.id);
     viewport.doLayout();
     this.panel = viewport.get("center-panel").get("pw_" + python_varname);
     this.panel.doLayout();
@@ -72,6 +73,10 @@
     this.accept_results = function(payload) {
         this.image_panel.el.dom.src = "data:image/png;base64," + payload['image_data'];
     }
+
+    yt_rpc.ExtDirectREPL.execute(
+        {code:python_varname + '.zoom(1.0)'},
+        handle_payload);
 }
 
 widget_types['plot_window'] = WidgetPlotWindow;


http://bitbucket.org/yt_analysis/yt/changeset/e5c0f8491f0e/
changeset:   r4024:e5c0f8491f0e
branch:      yt
user:        MatthewTurk
date:        2011-03-29 08:07:31
summary:     Merging
affected #:  1 file (78 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Tue Mar 29 02:07:17 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Tue Mar 29 02:07:31 2011 -0400
@@ -152,8 +152,10 @@
         return self.executed_cell_texts[:]
 
     def save_session(self, filename):
-        if not filename.startswith('/'):
-            filename = os.path.join(os.path.expanduser('~/'), filename)
+        if filename.startswith('~'):
+            filename = os.path.expanduser(filename)
+        elif not filename.startswith('/'):
+            filename = os.path.join(os.getcwd(), filename)
         if os.path.exists(filename):
             return {'status': 'FAIL', 'filename': filename,
                     'error': 'File exists!'}


--- a/yt/gui/reason/html/js/cinco.js	Tue Mar 29 02:07:17 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Tue Mar 29 02:07:31 2011 -0400
@@ -142,7 +142,11 @@
             text: 'Download',
             layout:'anchor',
             anchor: '100% 33%',
-	      handler: function(b, e) { window.open("session.py", "_top"); }
+	      handler: function(b, e) { 
+	      window.open("session.py", "_top"); 
+	      var record = new logging_store.recordType({record: 'Saved session locally.'});
+	      logging_store.add(record, number_log_records++);
+	    }
         },{
             xtype: 'tbseparator'
         },{
@@ -157,9 +161,12 @@
 				 yt_rpc.ExtDirectREPL.save_session({filename:text}, 
 						      function(f, a) {
 							if (a.result['status'] == 'SUCCESS') {
-							  Ext.Msg.alert('Success!',
-									'Saved session to ' + 
-									a.result['filename']);
+							  var alert_text = 'Saved session to ' + 
+							    a.result['filename']
+							  Ext.Msg.alert('Success!', alert_text);
+							  var record = new logging_store.recordType(
+									   {record: alert_text });
+							  logging_store.add(record, number_log_records++);
 							}
 							else {
 							  Ext.Msg.alert('Always naysaying!',
@@ -180,9 +187,14 @@
 	    handler: function (b,e) { 
 	      yt_rpc.ExtDirectREPL.paste_session({}, function(f, a) {
 							if (a.result['status'] == 'SUCCESS') {
-							  Ext.Msg.alert('Pastebin',
-									'Pasted session to:<br>' + 
-									a.result['site']);
+							  var alert_text = 'Pasted session to:<br>' + 
+							    a.result['site']
+							  var alert_text_rec = 'Pasted session to: ' + 
+							    a.result['site']
+							  Ext.Msg.alert('Pastebin', alert_text);
+							  var record = new logging_store.recordType(
+									   {record: alert_text_rec });
+							  logging_store.add(record, number_log_records++);
 							}
 		}); }
         }]


http://bitbucket.org/yt_analysis/yt/changeset/7bd3d2912a53/
changeset:   r4025:7bd3d2912a53
branch:      yt
user:        Cameron Hummels
date:        2011-03-29 08:16:15
summary:     Made Plot Window closable.
affected #:  1 file (34 bytes)

--- a/yt/gui/reason/html/js/cinco.js	Tue Mar 29 02:07:31 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Tue Mar 29 02:16:15 2011 -0400
@@ -103,6 +103,7 @@
 				  iconCls: 'graph',
 				  autoScroll: true,
 				  layout:'absolute',
+                  closable: true,
 				  items: [ 
 					  NorthButton,
 					  EastButton,


http://bitbucket.org/yt_analysis/yt/changeset/26ef421939d3/
changeset:   r4026:26ef421939d3
branch:      yt
user:        MatthewTurk
date:        2011-03-29 15:59:53
summary:     Fixing up some rocket issues and adding optional ports and browser-openings
affected #:  2 files (395 bytes)

--- a/yt/gui/reason/bottle_mods.py	Tue Mar 29 02:07:31 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Tue Mar 29 06:59:53 2011 -0700
@@ -91,7 +91,7 @@
         #print "With this response:", rv
         return rv
 
-def uuid_serve_functions(pre_routed = None, open_browser=False):
+def uuid_serve_functions(pre_routed = None, open_browser=False, port=9099):
     if pre_routed == None: pre_routed = route_functions
     debug(mode=True)
     token = uuid.uuid1()
@@ -111,7 +111,7 @@
     print
     print "Please direct your browser to:"
     print
-    print "     http://localhost:8080/%s/" % token
+    print "     http://localhost:%s/%s/" % (port, token)
     print
     print
     if open_browser:
@@ -122,7 +122,7 @@
             """Start a browser after waiting for half a second."""
             import webbrowser, threading
             def _local_browse():
-                webbrowser.open('http://localhost:%s/%s/' % (8080, token))
+                webbrowser.open('http://localhost:%s/%s/' % (port, token))
             thread = threading.Timer(0.5, _local_browse)
             thread.start()
         local_browse()
@@ -131,11 +131,11 @@
         server_name = "rocket"
         log = logging.getLogger('Rocket')
         log.setLevel(logging.INFO)
-        kwargs = {'timeout': 600}
+        kwargs = {'timeout': 600, 'max_threads': 1}
     except ImportError:
         server_name = "wsgiref"
     server_type = server_names.get(server_name)
-    server = server_type(host='localhost', port=8080, **kwargs)
+    server = server_type(host='localhost', port=port, **kwargs)
     #repl.locals['server'] = server
     mylog.info("Starting up the server.")
     run(server=server)


--- a/yt/utilities/command_line.py	Tue Mar 29 02:07:31 2011 -0400
+++ b/yt/utilities/command_line.py	Tue Mar 29 06:59:53 2011 -0700
@@ -908,6 +908,12 @@
         print
         print "Good luck!"
 
+    @cmdln.option("-o", "--open-browser", action="store_true",
+                  default = False, dest='open_browser',
+                  help="Open a web browser.")
+    @cmdln.option("-p", "--port", action="store",
+                  default = 9099, dest='port',
+                  help="Port to listen on")
     def do_serve(self, subcmd, opts):
         """
         Run the Web GUI
@@ -928,7 +934,8 @@
 
         hr = ExtDirectREPL(base_extjs_path)
         bottle.debug()
-        uuid_serve_functions(open_browser=True)
+        uuid_serve_functions(open_browser=opts.open_browser,
+                    port=int(opts.port))
 
 def run_main():
     for co in ["--parallel", "--paste"]:


http://bitbucket.org/yt_analysis/yt/changeset/643bab4e5acd/
changeset:   r4027:643bab4e5acd
branch:      yt
user:        MatthewTurk
date:        2011-03-29 16:28:14
summary:     This fixes WSGIRef serving.
affected #:  1 file (20 bytes)

--- a/yt/gui/reason/bottle_mods.py	Tue Mar 29 06:59:53 2011 -0700
+++ b/yt/gui/reason/bottle_mods.py	Tue Mar 29 10:28:14 2011 -0400
@@ -134,6 +134,7 @@
         kwargs = {'timeout': 600, 'max_threads': 1}
     except ImportError:
         server_name = "wsgiref"
+        kwargs = {}
     server_type = server_names.get(server_name)
     server = server_type(host='localhost', port=port, **kwargs)
     #repl.locals['server'] = server


http://bitbucket.org/yt_analysis/yt/changeset/b6ce1c5042e4/
changeset:   r4028:b6ce1c5042e4
branch:      yt
user:        MatthewTurk
date:        2011-03-30 05:47:45
summary:     Defaulting to a random port for the server.
affected #:  1 file (337 bytes)

--- a/yt/utilities/command_line.py	Tue Mar 29 10:28:14 2011 -0400
+++ b/yt/utilities/command_line.py	Tue Mar 29 23:47:45 2011 -0400
@@ -912,7 +912,7 @@
                   default = False, dest='open_browser',
                   help="Open a web browser.")
     @cmdln.option("-p", "--port", action="store",
-                  default = 9099, dest='port',
+                  default = 0, dest='port',
                   help="Port to listen on")
     def do_serve(self, subcmd, opts):
         """
@@ -926,6 +926,14 @@
             print "*** to point to the installation location!        ***"
             print
             sys.exit(1)
+        if opts.port == 0:
+            # This means, choose one at random.  We do this by binding to a
+            # socket and allowing the OS to choose the port for that socket.
+            import socket
+            sock = socket.socket()
+            sock.bind(('', 0))
+            opts.port = sock.getsockname()[-1]
+            del sock
         base_extjs_path = os.path.join(os.environ["YT_DEST"], "src")
         from yt.config import ytcfg;ytcfg["yt","__withinreason"]="True"
         import yt.gui.reason.bottle as bottle


http://bitbucket.org/yt_analysis/yt/changeset/237ea2329464/
changeset:   r4029:237ea2329464
branch:      yt
user:        Cameron Hummels
date:        2011-03-30 21:33:08
summary:     Reformatted all javascript files.
affected #:  3 files (1.8 KB)

--- a/yt/gui/reason/html/js/cinco.js	Tue Mar 29 23:47:45 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Wed Mar 30 15:33:08 2011 -0400
@@ -10,308 +10,302 @@
 var cell_count = 0;
 
 var handle_result = function(f, a) {
-  var input_line = repl_input.get("input_line")
-  if (a.result == null) {
-    text = "ERROR";
-    formatted_input = input_line.getValue();
-  } else {
-    //text = a.result['output'].replace(/\n/g,"<br/>");
-    text = "<pre>"+a.result['output']+"</pre>";
-    formatted_input = a.result['input']
-  }
-  var cell = new_cell(formatted_input, text);
-  OutputContainer.add(cell);
-  notebook.doLayout();
-  input_line.setValue("");
-  cell_finished(a.result, cell);
-  if (OutputContainer.items.length > 1) {
-    OutputContainer.body.dom.scrollTop =
-      OutputContainer.body.dom.scrollHeight -
-      cell.body.dom.scrollHeight - 20;
-  }
-}
+    var input_line = repl_input.get("input_line")
+    if (a.result == null) {
+        text = "ERROR";
+        formatted_input = input_line.getValue();
+    } else {
+//        text = a.result['output'].replace(/\n/g,"<br/>");
+        text = "<pre>"+a.result['output']+"</pre>";
+        formatted_input = a.result['input']
+    }
+    var cell = new_cell(formatted_input, text);
+    OutputContainer.add(cell);
+    notebook.doLayout();
+    input_line.setValue("");
+    cell_finished(a.result, cell);
+    if (OutputContainer.items.length > 1) {
+        OutputContainer.body.dom.scrollTop = 
+        OutputContainer.body.dom.scrollHeight -
+        cell.body.dom.scrollHeight - 20;
+    }
 
-var handle_payload = function(pp) {
-    cell_finished(pp, null);
-}
+    var handle_payload = function(pp) {
+        cell_finished(pp, null);
+    }
 
-var repl_input = new Ext.FormPanel({
-  title: 'YT Input',
-      url: 'push',
-      flex: 0.2,
-      layout: 'fit',
-      padding: 5,
-      items: [{
-      id: 'input_line',
-	  xtype: 'textarea',
-	  width: '100%',
-	  autoScroll: true,
-	  name: 'line',
-	  allowBlank: 'True',
-	  bodyStyle: 'font-family: "monospace";',
-	  listeners: {
-	specialkey: function(f, e){
-	    if (e.getKey() == e.ENTER) {
-	      cell_sent();
-	      yt_rpc.ExtDirectREPL.execute({
-		code:repl_input.get('input_line').getValue()},
-		handle_result);
-	    }
-	  }
-	},
-	  },],
-      });
+    var repl_input = new Ext.FormPanel({
+        title: 'YT Input',
+        url: 'push',
+        flex: 0.2,
+        layout: 'fit',
+        padding: 5,
+        items: [{
+            id: 'input_line',
+            xtype: 'textarea',
+            width: '100%',
+            autoScroll: true,
+            name: 'line',
+            allowBlank: 'True',
+            bodyStyle: 'font-family: "monospace";',
+            listeners: {
+                specialkey: function(f, e){
+                    if (e.getKey() == e.ENTER) {
+                        cell_sent();
+                        yt_rpc.ExtDirectREPL.execute({
+                            code:repl_input.get('input_line').getValue()},
+                        handle_result);
+	                }
+	            }
+            },
+        },],
+    });
 
-var NorthButton = new Ext.Button(
-				 {text : 'North',
-				     pageX : 205,
-				     pageY : 10
+    var NorthButton = new Ext.Button({
+        text : 'North',
+	    pageX : 205,
+        pageY : 10
 //        handler: function(b, e) { window.open("session.py", "_top"); }
-				     }
-				 );
+    });
 
-var EastButton = new Ext.Button(
-				{text:'East',
-				    pageX : 410,
-				    pageY : 205
-				    }
-				);
-var SouthButton = new Ext.Button(
-				 {text:'South',
-				     pageX : 205,
-				     pageY : 410
-				     }
-				 );
-var WestButton = new Ext.Button(
-				{text:'West',
-				    pageX : 10,
-				    pageY : 205
-				    }
-				);
+    var EastButton = new Ext.Button({
+        text:'East',
+        pageX : 410,
+        pageY : 205
+    });
 
-var OutputContainer = new Ext.Panel({
-  title: 'YT Output',
-      id: 'output_container',
-      autoScroll: true,
-      flex: 0.8,
-      items: []
-      });
+    var SouthButton = new Ext.Button({
+        text:'South',
+        pageX : 205,
+        pageY : 410
+    });
 
-var PlotPanel = new Ext.Panel(
-			      {
-			      title: 'Plot Window 1',
-				  iconCls: 'graph',
-				  autoScroll: true,
-				  layout:'absolute',
-				  items: [ 
-					  NorthButton,
-					  EastButton,
-					  SouthButton,
-					  WestButton
-					   ]
-				  });
-var examine;
-var notebook;
-var treePanel = new Ext.tree.TreePanel({
-  iconCls: 'nav',
-      id: 'tree-panel',
-      title: 'Objects',
-      layout: 'anchor',
-      region:'west',
-      split: true,
-      anchor: '100% -35',
-      minSize: 150,
-      autoScroll: true,
-      rootVisible: false,
-      root:new Ext.tree.TreeNode({
-	expanded:true
-	    ,leaf:false
-	    ,text:''
-	    })
-      });
+    var WestButton = new Ext.Button({
+        text:'West',
+        pageX : 10,
+        pageY : 205
+    });
 
-var ButtonGroupPanel = new Ext.Panel({
-    layout: 'anchor',
-    ButtonAlign: 'center',
-    collapsible: false,
-    renderTo: document.body,
-    tbar: [{
-        xtype: 'buttongroup',
-        columns: 5,
-        items: [{
-            text: 'Download',
-            layout:'anchor',
-            anchor: '100% 33%',
-	      handler: function(b, e) { 
-	      window.open("session.py", "_top"); 
-	      var record = new logging_store.recordType({record: 'Saved session locally.'});
-	      logging_store.add(record, number_log_records++);
-	    }
-        },{
-            xtype: 'tbseparator'
-        },{
-            text: 'Save',
-            layout:'anchor',
-	      anchor: '100% 67%',
-	      handler: function (b,e) { 
-	      Ext.Msg.prompt("We have important work to do.", 
-			     "Enter filename.", 
-			     function(btn, text) {
-			       if (btn == 'ok'){
-				 yt_rpc.ExtDirectREPL.save_session({filename:text}, 
-						      function(f, a) {
-							if (a.result['status'] == 'SUCCESS') {
-							  var alert_text = 'Saved session to ' + 
-							    a.result['filename']
-							  Ext.Msg.alert('Success!', alert_text);
-							  var record = new logging_store.recordType(
-									   {record: alert_text });
-							  logging_store.add(record, number_log_records++);
-							}
-							else {
-							  Ext.Msg.alert('Always naysaying!',
-									'Failed to save to ' + 
-									a.result['filename'] + 
-									'<br>Error: ' + 
-									a.result['error']);
-							}
-						      });
-						 }
-			     }); }
-        },{
-            xtype: 'tbseparator'
-        },{
-            text: 'Pastebin',
-            layout:'anchor',
-            anchor: '100% 100%',
-	    handler: function (b,e) { 
-	      yt_rpc.ExtDirectREPL.paste_session({}, function(f, a) {
-							if (a.result['status'] == 'SUCCESS') {
-							  var alert_text = 'Pasted session to:<br>' + 
-							    a.result['site']
-							  var alert_text_rec = 'Pasted session to: ' + 
-							    a.result['site']
-							  Ext.Msg.alert('Pastebin', alert_text);
-							  var record = new logging_store.recordType(
-									   {record: alert_text_rec });
-							  logging_store.add(record, number_log_records++);
-							}
-		}); }
+    var OutputContainer = new Ext.Panel({
+        title: 'YT Output',
+        id: 'output_container',
+        autoScroll: true,
+        flex: 0.8,
+        items: []
+    });
+
+    var PlotPanel = new Ext.Panel({
+        title: 'Plot Window 1',
+        iconCls: 'graph',
+        autoScroll: true,
+        layout:'absolute',
+        items: [ 
+            NorthButton,
+            EastButton,
+            SouthButton,
+            WestButton
+        ]
+    });
+
+    var examine;
+    var notebook;
+
+    var treePanel = new Ext.tree.TreePanel({
+        iconCls: 'nav',
+        id: 'tree-panel',
+        title: 'Objects',
+        layout: 'anchor',
+        region:'west',
+        split: true,
+        anchor: '100% -35',
+        minSize: 150,
+        autoScroll: true,
+        rootVisible: false,
+        root:new Ext.tree.TreeNode({
+            expanded:true,
+            leaf:false,
+            text:''
+        })
+    });
+
+    var ButtonGroupPanel = new Ext.Panel({
+        layout: 'anchor',
+        ButtonAlign: 'center',
+        collapsible: false,
+        renderTo: document.body,
+        tbar: [{
+            xtype: 'buttongroup',
+            columns: 5,
+            items: [{
+                text: 'Download',
+                layout:'anchor',
+                anchor: '100% 33%',
+                handler: function(b, e) { 
+                    window.open("session.py", "_top"); 
+                    var record = new logging_store.recordType({
+                        record: 'Saved session locally.'});
+                    logging_store.add(record, number_log_records++);
+	            }
+            },{
+                xtype: 'tbseparator'
+            },{
+                text: 'Save',
+                layout:'anchor',
+	            anchor: '100% 67%',
+	            handler: function (b,e) { 
+                    Ext.Msg.prompt("We have important work to do.", 
+                    "Enter filename.", 
+                    function(btn, text) {
+                        if (btn == 'ok'){
+                            yt_rpc.ExtDirectREPL.save_session({filename:text}, 
+                            function(f, a) {
+                                if (a.result['status'] == 'SUCCESS') {
+                                    var alert_text = 'Saved session to ' + 
+                                    a.result['filename']
+                                    Ext.Msg.alert('Success!', alert_text);
+                                    var record = new logging_store.recordType(
+                                        {record: alert_text });
+                                    logging_store.add(record, number_log_records++);
+							    } else {
+							        Ext.Msg.alert('Always naysaying!',
+                                        'Failed to save to ' + 
+                                        a.result['filename'] + 
+                                        '<br>Error: ' + 
+                                        a.result['error']);
+                                }
+                            });
+                        }
+                    });
+                }
+            },{
+                xtype: 'tbseparator'
+            },{
+                text: 'Pastebin',
+                layout:'anchor',
+                anchor: '100% 100%',
+                handler: function (b,e) { 
+                    yt_rpc.ExtDirectREPL.paste_session({}, function(f, a) {
+                        if (a.result['status'] == 'SUCCESS') {
+                            var alert_text = 'Pasted session to:<br>' + 
+                            a.result['site']
+                            var alert_text_rec = 'Pasted session to: ' + 
+                            a.result['site']
+                            Ext.Msg.alert('Pastebin', alert_text);
+                            var record = new logging_store.recordType(
+                                {record: alert_text_rec });
+                            logging_store.add(record, number_log_records++);
+                        }
+                    }); 
+                }
+            }]
         }]
-    }]
-});
+    });
 
-var status_panel;
-var logging_store = new Ext.data.Store({
-  fields: [{name:'record'}],
-      reader: new Ext.data.ArrayReader({}, [{name: 'record'}]),
-      });
+    var status_panel;
+    var logging_store = new Ext.data.Store({
+        fields: [{name:'record'}],
+        reader: new Ext.data.ArrayReader({}, [{name: 'record'}]),
+    });
 
-Ext.onReady(function(){
-    
-    Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
+    Ext.onReady(function(){
+        Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
 
     // NOTE: This is an example showing simple state management. During development,
     // it is generally best to disable state management as dynamically-generated ids
     // can change across page loads, leading to unpredictable results.  The developer
     // should ensure that stable state ids are set for stateful components in real apps.
     // it's a cold day for pontooning.
-    Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
+        Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
 
     // Go ahead and create the TreePanel now so that we can use it below
-    viewport = new Ext.Viewport({
-      layout: 'border',
-	  items: [
-		  {
+        viewport = new Ext.Viewport({
+            layout: 'border',
+            items: [
 		    // lazily created panel (xtype:'panel' is default)
-		  xtype: 'grid',
-		      store: logging_store,
-		      columns: [ {id:'record', 
-			  sortable: false,
-			  width:800} ],
-		      autofill: true,
-		      region: 'south',
-		      id: "status-region",
-		      cls: "status-logger",
-		      split: true,
-		      height: 100,
-		      maxSize: 200,
-		      collapsible: true,
-		      title: 'Status',
-		      margins: '0 0 0 0',
-		      }, {
-		  region: 'west',
-		      id: 'west-panel', // see Ext.getCmp() below
-		      title: 'BETA Sequences',
-		      split: true,
-		      width: 200,
-		      minSize: 175,
-		      maxSize: 400,
-		      collapsible: true,
-		      margins: '0 0 0 5',
-		      layout: {
-                    type: 'anchor',
-			},
-		      items: [
-			      treePanel,
-			      ButtonGroupPanel
-			      ]
-		      },
+                {
+                    xtype: 'grid',
+                    store: logging_store,
+                    columns: [ {id:'record', 
+                        sortable: false,
+                        width:800} ],
+                    autofill: true,
+                    region: 'south',
+                    id: "status-region",
+                    cls: "status-logger",
+                    split: true,
+                    height: 100,
+                    maxSize: 200,
+                    collapsible: true,
+                    title: 'Status',
+                    margins: '0 0 0 0',
+                }, {
+                    region: 'west',
+                    id: 'west-panel', // see Ext.getCmp() below
+                    title: 'BETA Sequences',
+                    split: true,
+                    width: 200,
+                    minSize: 175,
+                    maxSize: 400,
+                    collapsible: true,
+                    margins: '0 0 0 5',
+                    layout: {
+                        type: 'anchor',
+                    },
+                    items: [
+                        treePanel,
+                        ButtonGroupPanel
+                    ]
 		  // in this instance the TabPanel is not wrapped by another panel
 		  // since no title is needed, this Panel is added directly
 		  // as a Container
-		  {
-		  xtype: 'tabpanel',
-		      region: 'center', // a center region is ALWAYS required for border layout
-		      id: 'center-panel',
-		      deferredRender: false,
-		      activeTab: 0,     // first tab initially active
-		      items: [
-                {
-		            title: 'YT',
-			        id: 'notebook',
-			        layout: 'vbox',
-			        layoutConfig: {align:'stretch'},
-			        closable: false,
-			        autoScroll: false,
-			        iconCls: 'console',
-			        items: [repl_input, OutputContainer]
-			    }, PlotPanel]
-		      //                }, {
-		      //                   title: 'Plot Window 1',
-		      //                  iconCls: 'graph',
-		      //                 layout:'anchor',
-		      //                anchor:'100% 100%',
-		      //               closable: true,
-		      //              autoScroll: true,
-		      //             items: [ PlotPanel ]
-		      //                
-		      //       }]
-		      }]
-	  });
-    // get a reference to the HTML element with id "hideit" and add a click listener to it 
+                },{
+                    xtype: 'tabpanel',
+                    region: 'center', 
+                    id: 'center-panel',
+                    deferredRender: false,
+                    activeTab: 0,     
+                    items: [
+                        {
+                            title: 'YT',
+                            id: 'notebook',
+                            layout: 'vbox',
+                            layoutConfig: {align:'stretch'},
+                            closable: false,
+                            autoScroll: false,
+                            iconCls: 'console',
+                            items: [repl_input, OutputContainer]
+                        }, 
+                        PlotPanel
+                    ]
+                }
+            ]
+        });
+
+// get a reference to the HTML element with id "hideit" and add a click listener to it 
     console.log('Mitchell!\nPardon me! Mitchell!')
     Ext.get("hideit").on('click', function(){
-	// get a reference to the Panel that was created with id = 'west-panel' 
-	var w = Ext.getCmp('west-panel');
-	// expand or collapse that Panel based on its collapsed property state
-	// need to make room for six sour cream burritos
-	w.collapsed ? w.expand() : w.collapse();
-      });
+// get a reference to the Panel that was created with id = 'west-panel' 
+	    var w = Ext.getCmp('west-panel');
+// expand or collapse that Panel based on its collapsed property state
+// need to make room for six sour cream burritos
+        w.collapsed ? w.expand() : w.collapse();
+    });
     
     notebook = viewport.get("center-panel").get("notebook");
     status_panel = viewport.get("status-region").get("status-div");
     
     var record = new logging_store.recordType(
-                        {record: '4d3d3d3 engaged' });
+        {record: '4d3d3d3 engaged' });
+
     logging_store.add(record, number_log_records++);
     var record = new logging_store.recordType(
-                        {record: 'Welcome to yt.  Press Shift-Enter to evaluate.' });
+        {record: 'Welcome to yt.  Press Shift-Enter to evaluate.' });
     logging_store.add(record, number_log_records++);
     if (!Ext.state.Manager.get("cinco_welcomed", false)) {
         Ext.MessageBox.alert("yt - Reason v5",
-                "Welcome to Reason.  Press shift-enter to evaluate.",
-                function(b,e){ repl_input.get("input_line").focus(); });
+        "Welcome to Reason.  Press shift-enter to evaluate.",
+        function(b,e){ repl_input.get("input_line").focus(); });
         Ext.state.Manager.set("cinco_welcomed", true);
-    } else{ repl_input.get("input_line").focus(); }
-  });
+    } else { 
+        repl_input.get("input_line").focus(); }
+    });


--- a/yt/gui/reason/html/js/functions.js	Tue Mar 29 23:47:45 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Wed Mar 30 15:33:08 2011 -0400
@@ -43,7 +43,8 @@
 function display_image(image_id) {
     var image = Ext.get(image_id);
     var src = image.dom.src;
-    var virtualdom = '<html><title>Image Viewer</title><body><img src="' + src + '"/></body></html>',
+    var virtualdom = '<html><title>Image Viewer</title><body><img src="' 
+        + src + '"/></body></html>',
     prev = window.open('', 'image_viewer');
     prev.document.open();
     prev.document.write(virtualdom);
@@ -60,30 +61,33 @@
             expanded:true, 
             iconCls: 'pf_icon'}));
         this_pf = treePanel.root.lastChild
-	Ext.each(pf.objects, function(object, obj_index) {
+        Ext.each(pf.objects, function(object, obj_index) {
             this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
-		    leaf: true, iconCls: 'data_object'}));
-	  });
+            leaf: true, iconCls: 'data_object'}));
+        });
     });
-};
+}
 
 function new_cell(input, result) {
-  var name = "cell_" + cell_count;
-  var CellPanel = new Ext.Panel(
-		    {id: name, //title: "Cell " + cell_count,
-		     items: [new Ext.Panel({
-			  id:name+"_input",
-			      html:input,
-			      }),
-		       new Ext.Panel({
-			 id:name+"_result",
-			     autoScroll:true,
-			     width: "100%",
-			     html:result,
-			     })
-		       ]
-			}
-			);
-  cell_count++;
-  return CellPanel;
+    var name = "cell_" + cell_count;
+    var CellPanel = new Ext.Panel(
+        { 
+            id: name, 
+            //title: "Cell " + cell_count,
+            items: [
+                new Ext.Panel({
+                    id:name+"_input",
+                    html:input,
+                }),
+                new Ext.Panel({
+                    id:name+"_result",
+                    autoScroll:true,
+                    width: "100%",
+                    html:result,
+                })
+            ]
+        }
+    );
+    cell_count++;
+    return CellPanel;
 }


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Tue Mar 29 23:47:45 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Wed Mar 30 15:33:08 2011 -0400
@@ -1,68 +1,78 @@
 var WidgetPlotWindow = function(python_varname) {
     this.id = python_varname;
     this.print_python = function(b, e) {
-        yt_rpc.ExtDirectREPL.execute({code:'print "' + python_varname + '"'},
-                                     function(f, a)
-                                     {alert(a.result['output']);});
+        yt_rpc.ExtDirectREPL.execute(
+            {code:'print "' + python_varname + '"'},
+            function(f, a) {alert(a.result['output']);}
+        );
     }
 
     viewport.get("center-panel").add(
-                  {
-                  xtype: 'panel',
-                  id: "pw_" + this.id,
-                  title: this.id,
-                  iconCls: 'graph',
-                  autoScroll: true,
-                  layout:'absolute',
-                  items: [ 
-                      {xtype:'panel',
-                       id: 'image_panel_' + this.id,
-                       autoEl: {
-                         tag: 'img',
-                         id: "img_" + this.id,
-                         width: 400,
-                         height: 400,
-                       },
-                       x: 10,
-                       y: 10,
-                       width: 400,
-                       height: 400,
-                      },
-                      {xtype:'button',
-                       text: 'North',
-                       x: 205,
-                       y: 10,
-                       handler: function(b,e) {
-                       cc = python_varname + '.pan_rel((0.0, 0.5))'
-	            yt_rpc.ExtDirectREPL.execute(
-                    {code:cc}, handle_payload); }
-                       },
-                      {xtype:'button',
-                       text:'East',
-                       x : 410,
-                       y : 205,
-                       handler: function(b,e) {
-	            yt_rpc.ExtDirectREPL.execute(
-                    {code:python_varname + '.pan_rel((0.5, 0.0))'},
-                    handle_payload); }},
-                      {xtype:'button',
-                       text: 'South',
-                       x: 205,
-                       y: 410,
-                       handler: function(b,e) {
-	            yt_rpc.ExtDirectREPL.execute(
-                    {code:python_varname + '.pan_rel((0.0, -0.5))'},
-                    handle_payload); }},
-                      {xtype: 'button',
-                       text: 'West',
-                       x: 10,
-                       y: 205,
-                       handler: function(b,e) {
-	            yt_rpc.ExtDirectREPL.execute(
-                    {code:python_varname + '.pan_rel((-0.5, 0.0))'},
-                    handle_payload); }},
-                       ]
-                  });
+        {
+            xtype: 'panel',
+            id: "pw_" + this.id,
+            title: this.id,
+            iconCls: 'graph',
+            autoScroll: true,
+            layout:'absolute',
+            items: [ 
+                {
+                    xtype:'panel',
+                    id: 'image_panel_' + this.id,
+                    autoEl: {
+                        tag: 'img',
+                        id: "img_" + this.id,
+                        width: 400,
+                        height: 400,
+                    },
+                    x: 10,
+                    y: 10,
+                    width: 400,
+                    height: 400,
+                }, {
+                    xtype:'button',
+                    text: 'North',
+                    x: 205,
+                    y: 10,
+                    handler: function(b,e) {
+                        cc = python_varname + '.pan_rel((0.0, 0.5))'
+                        yt_rpc.ExtDirectREPL.execute(
+                        {code:cc}, handle_payload); 
+                    }
+                }, {
+                    xtype:'button',
+                    text:'East',
+                    x : 410,
+                    y : 205,
+                    handler: function(b,e) {
+                        yt_rpc.ExtDirectREPL.execute(
+                            {code:python_varname + '.pan_rel((0.5, 0.0))'},
+                        handle_payload); 
+                    }
+                }, {
+                    xtype:'button',
+                    text: 'South',
+                    x: 205,
+                    y: 410,
+                    handler: function(b,e) {
+                        yt_rpc.ExtDirectREPL.execute(
+                            {code:python_varname + '.pan_rel((0.0, -0.5))'},
+                        handle_payload); 
+                    }
+                }, {
+                    xtype: 'button',
+                    text: 'West',
+                    x: 10,
+                    y: 205,
+                    handler: function(b,e) {
+                        yt_rpc.ExtDirectREPL.execute(
+                            {code:python_varname + '.pan_rel((-0.5, 0.0))'},
+                        handle_payload); 
+                    }
+                },
+            ]
+        }
+    );
 
     viewport.get("center-panel").activate("pw_" + this.id);
     viewport.doLayout();


http://bitbucket.org/yt_analysis/yt/changeset/0d424b12ddf5/
changeset:   r4030:0d424b12ddf5
branch:      yt
user:        Cameron Hummels
date:        2011-03-30 21:35:47
summary:     Made newly created plot windows "closable".
affected #:  1 file (28 bytes)

--- a/yt/gui/reason/html/js/widget_plotwindow.js	Wed Mar 30 15:33:08 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Wed Mar 30 15:35:47 2011 -0400
@@ -15,6 +15,7 @@
             iconCls: 'graph',
             autoScroll: true,
             layout:'absolute',
+            closable: true,
             items: [ 
                 {
                     xtype:'panel',


http://bitbucket.org/yt_analysis/yt/changeset/36acb1d5ab1c/
changeset:   r4031:36acb1d5ab1c
branch:      yt
user:        Cameron Hummels
date:        2011-03-30 22:10:22
summary:     Fixed a formatting error.  Commented out the 'naked' plot window tab from the default loadup ('plotpanel').
affected #:  1 file (4 bytes)

--- a/yt/gui/reason/html/js/cinco.js	Wed Mar 30 15:35:47 2011 -0400
+++ b/yt/gui/reason/html/js/cinco.js	Wed Mar 30 16:10:22 2011 -0400
@@ -29,6 +29,7 @@
         OutputContainer.body.dom.scrollHeight -
         cell.body.dom.scrollHeight - 20;
     }
+}
 
     var handle_payload = function(pp) {
         cell_finished(pp, null);
@@ -275,7 +276,7 @@
                             iconCls: 'console',
                             items: [repl_input, OutputContainer]
                         }, 
-                        PlotPanel
+//                        PlotPanel
                     ]
                 }
             ]


http://bitbucket.org/yt_analysis/yt/changeset/4587bff8d0f7/
changeset:   r4032:4587bff8d0f7
branch:      yt
user:        Cameron Hummels
date:        2011-03-30 22:34:50
summary:     Tried to remove extraneous cinco and paul rudd references in code.
affected #:  3 files (10.7 KB)

--- a/yt/gui/reason/html/index.html	Wed Mar 30 16:10:22 2011 -0400
+++ b/yt/gui/reason/html/index.html	Wed Mar 30 16:34:50 2011 -0400
@@ -1,6 +1,6 @@
 <html><head>
-  <title>Cinco Analysis Generator</title>
+  <title>Reason YT GUI</title><link rel="stylesheet" type="text/css" href="resources/resources/css/ext-all.css" /><link rel="stylesheet" type="text/css" href="highlighter.css" /><link rel="stylesheet" type="text/css" href="theme/css/xtheme-slate.css" />
@@ -60,7 +60,7 @@
     <script type="text/javascript" src="js/functions.js"></script><!-- THE MAIN FUNCTION -->
-    <script type="text/javascript" src="js/cinco.js"></script>
+    <script type="text/javascript" src="js/reason.js"></script><!-- THE PLOT WINDOW FUNCTIONS --><script type="text/javascript" src="js/widget_plotwindow.js"></script>


--- a/yt/gui/reason/html/js/cinco.js	Wed Mar 30 16:10:22 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,312 +0,0 @@
-var viewport;
-var widget_types = {}
-var widget_list = {}
-
-var examine;
-var number_log_records = 0;
-var number_images = 0;
-
-var res;
-var cell_count = 0;
-
-var handle_result = function(f, a) {
-    var input_line = repl_input.get("input_line")
-    if (a.result == null) {
-        text = "ERROR";
-        formatted_input = input_line.getValue();
-    } else {
-//        text = a.result['output'].replace(/\n/g,"<br/>");
-        text = "<pre>"+a.result['output']+"</pre>";
-        formatted_input = a.result['input']
-    }
-    var cell = new_cell(formatted_input, text);
-    OutputContainer.add(cell);
-    notebook.doLayout();
-    input_line.setValue("");
-    cell_finished(a.result, cell);
-    if (OutputContainer.items.length > 1) {
-        OutputContainer.body.dom.scrollTop = 
-        OutputContainer.body.dom.scrollHeight -
-        cell.body.dom.scrollHeight - 20;
-    }
-}
-
-    var handle_payload = function(pp) {
-        cell_finished(pp, null);
-    }
-
-    var repl_input = new Ext.FormPanel({
-        title: 'YT Input',
-        url: 'push',
-        flex: 0.2,
-        layout: 'fit',
-        padding: 5,
-        items: [{
-            id: 'input_line',
-            xtype: 'textarea',
-            width: '100%',
-            autoScroll: true,
-            name: 'line',
-            allowBlank: 'True',
-            bodyStyle: 'font-family: "monospace";',
-            listeners: {
-                specialkey: function(f, e){
-                    if (e.getKey() == e.ENTER) {
-                        cell_sent();
-                        yt_rpc.ExtDirectREPL.execute({
-                            code:repl_input.get('input_line').getValue()},
-                        handle_result);
-	                }
-	            }
-            },
-        },],
-    });
-
-    var NorthButton = new Ext.Button({
-        text : 'North',
-	    pageX : 205,
-        pageY : 10
-//        handler: function(b, e) { window.open("session.py", "_top"); }
-    });
-
-    var EastButton = new Ext.Button({
-        text:'East',
-        pageX : 410,
-        pageY : 205
-    });
-
-    var SouthButton = new Ext.Button({
-        text:'South',
-        pageX : 205,
-        pageY : 410
-    });
-
-    var WestButton = new Ext.Button({
-        text:'West',
-        pageX : 10,
-        pageY : 205
-    });
-
-    var OutputContainer = new Ext.Panel({
-        title: 'YT Output',
-        id: 'output_container',
-        autoScroll: true,
-        flex: 0.8,
-        items: []
-    });
-
-    var PlotPanel = new Ext.Panel({
-        title: 'Plot Window 1',
-        iconCls: 'graph',
-        autoScroll: true,
-        layout:'absolute',
-        items: [ 
-            NorthButton,
-            EastButton,
-            SouthButton,
-            WestButton
-        ]
-    });
-
-    var examine;
-    var notebook;
-
-    var treePanel = new Ext.tree.TreePanel({
-        iconCls: 'nav',
-        id: 'tree-panel',
-        title: 'Objects',
-        layout: 'anchor',
-        region:'west',
-        split: true,
-        anchor: '100% -35',
-        minSize: 150,
-        autoScroll: true,
-        rootVisible: false,
-        root:new Ext.tree.TreeNode({
-            expanded:true,
-            leaf:false,
-            text:''
-        })
-    });
-
-    var ButtonGroupPanel = new Ext.Panel({
-        layout: 'anchor',
-        ButtonAlign: 'center',
-        collapsible: false,
-        renderTo: document.body,
-        tbar: [{
-            xtype: 'buttongroup',
-            columns: 5,
-            items: [{
-                text: 'Download',
-                layout:'anchor',
-                anchor: '100% 33%',
-                handler: function(b, e) { 
-                    window.open("session.py", "_top"); 
-                    var record = new logging_store.recordType({
-                        record: 'Saved session locally.'});
-                    logging_store.add(record, number_log_records++);
-	            }
-            },{
-                xtype: 'tbseparator'
-            },{
-                text: 'Save',
-                layout:'anchor',
-	            anchor: '100% 67%',
-	            handler: function (b,e) { 
-                    Ext.Msg.prompt("We have important work to do.", 
-                    "Enter filename.", 
-                    function(btn, text) {
-                        if (btn == 'ok'){
-                            yt_rpc.ExtDirectREPL.save_session({filename:text}, 
-                            function(f, a) {
-                                if (a.result['status'] == 'SUCCESS') {
-                                    var alert_text = 'Saved session to ' + 
-                                    a.result['filename']
-                                    Ext.Msg.alert('Success!', alert_text);
-                                    var record = new logging_store.recordType(
-                                        {record: alert_text });
-                                    logging_store.add(record, number_log_records++);
-							    } else {
-							        Ext.Msg.alert('Always naysaying!',
-                                        'Failed to save to ' + 
-                                        a.result['filename'] + 
-                                        '<br>Error: ' + 
-                                        a.result['error']);
-                                }
-                            });
-                        }
-                    });
-                }
-            },{
-                xtype: 'tbseparator'
-            },{
-                text: 'Pastebin',
-                layout:'anchor',
-                anchor: '100% 100%',
-                handler: function (b,e) { 
-                    yt_rpc.ExtDirectREPL.paste_session({}, function(f, a) {
-                        if (a.result['status'] == 'SUCCESS') {
-                            var alert_text = 'Pasted session to:<br>' + 
-                            a.result['site']
-                            var alert_text_rec = 'Pasted session to: ' + 
-                            a.result['site']
-                            Ext.Msg.alert('Pastebin', alert_text);
-                            var record = new logging_store.recordType(
-                                {record: alert_text_rec });
-                            logging_store.add(record, number_log_records++);
-                        }
-                    }); 
-                }
-            }]
-        }]
-    });
-
-    var status_panel;
-    var logging_store = new Ext.data.Store({
-        fields: [{name:'record'}],
-        reader: new Ext.data.ArrayReader({}, [{name: 'record'}]),
-    });
-
-    Ext.onReady(function(){
-        Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
-
-    // NOTE: This is an example showing simple state management. During development,
-    // it is generally best to disable state management as dynamically-generated ids
-    // can change across page loads, leading to unpredictable results.  The developer
-    // should ensure that stable state ids are set for stateful components in real apps.
-    // it's a cold day for pontooning.
-        Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
-
-    // Go ahead and create the TreePanel now so that we can use it below
-        viewport = new Ext.Viewport({
-            layout: 'border',
-            items: [
-		    // lazily created panel (xtype:'panel' is default)
-                {
-                    xtype: 'grid',
-                    store: logging_store,
-                    columns: [ {id:'record', 
-                        sortable: false,
-                        width:800} ],
-                    autofill: true,
-                    region: 'south',
-                    id: "status-region",
-                    cls: "status-logger",
-                    split: true,
-                    height: 100,
-                    maxSize: 200,
-                    collapsible: true,
-                    title: 'Status',
-                    margins: '0 0 0 0',
-                }, {
-                    region: 'west',
-                    id: 'west-panel', // see Ext.getCmp() below
-                    title: 'BETA Sequences',
-                    split: true,
-                    width: 200,
-                    minSize: 175,
-                    maxSize: 400,
-                    collapsible: true,
-                    margins: '0 0 0 5',
-                    layout: {
-                        type: 'anchor',
-                    },
-                    items: [
-                        treePanel,
-                        ButtonGroupPanel
-                    ]
-		  // in this instance the TabPanel is not wrapped by another panel
-		  // since no title is needed, this Panel is added directly
-		  // as a Container
-                },{
-                    xtype: 'tabpanel',
-                    region: 'center', 
-                    id: 'center-panel',
-                    deferredRender: false,
-                    activeTab: 0,     
-                    items: [
-                        {
-                            title: 'YT',
-                            id: 'notebook',
-                            layout: 'vbox',
-                            layoutConfig: {align:'stretch'},
-                            closable: false,
-                            autoScroll: false,
-                            iconCls: 'console',
-                            items: [repl_input, OutputContainer]
-                        }, 
-//                        PlotPanel
-                    ]
-                }
-            ]
-        });
-
-// get a reference to the HTML element with id "hideit" and add a click listener to it 
-    console.log('Mitchell!\nPardon me! Mitchell!')
-    Ext.get("hideit").on('click', function(){
-// get a reference to the Panel that was created with id = 'west-panel' 
-	    var w = Ext.getCmp('west-panel');
-// expand or collapse that Panel based on its collapsed property state
-// need to make room for six sour cream burritos
-        w.collapsed ? w.expand() : w.collapse();
-    });
-    
-    notebook = viewport.get("center-panel").get("notebook");
-    status_panel = viewport.get("status-region").get("status-div");
-    
-    var record = new logging_store.recordType(
-        {record: '4d3d3d3 engaged' });
-
-    logging_store.add(record, number_log_records++);
-    var record = new logging_store.recordType(
-        {record: 'Welcome to yt.  Press Shift-Enter to evaluate.' });
-    logging_store.add(record, number_log_records++);
-    if (!Ext.state.Manager.get("cinco_welcomed", false)) {
-        Ext.MessageBox.alert("yt - Reason v5",
-        "Welcome to Reason.  Press shift-enter to evaluate.",
-        function(b,e){ repl_input.get("input_line").focus(); });
-        Ext.state.Manager.set("cinco_welcomed", true);
-    } else { 
-        repl_input.get("input_line").focus(); }
-    });


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/js/reason.js	Wed Mar 30 16:34:50 2011 -0400
@@ -0,0 +1,318 @@
+var viewport;
+var widget_types = {}
+var widget_list = {}
+
+var examine;
+var number_log_records = 0;
+var number_images = 0;
+
+var res;
+var cell_count = 0;
+
+var handle_result = function(f, a) {
+    var input_line = repl_input.get("input_line")
+    if (a.result == null) {
+        text = "ERROR";
+        formatted_input = input_line.getValue();
+    } else {
+//        text = a.result['output'].replace(/\n/g,"<br/>");
+        text = "<pre>"+a.result['output']+"</pre>";
+        formatted_input = a.result['input']
+    }
+    var cell = new_cell(formatted_input, text);
+    OutputContainer.add(cell);
+    notebook.doLayout();
+    input_line.setValue("");
+    cell_finished(a.result, cell);
+    if (OutputContainer.items.length > 1) {
+        OutputContainer.body.dom.scrollTop = 
+        OutputContainer.body.dom.scrollHeight -
+        cell.body.dom.scrollHeight - 20;
+    }
+}
+
+    var handle_payload = function(pp) {
+        cell_finished(pp, null);
+    }
+
+    var repl_input = new Ext.FormPanel({
+        title: 'YT Input',
+        url: 'push',
+        flex: 0.2,
+        layout: 'fit',
+        padding: 5,
+        items: [{
+            id: 'input_line',
+            xtype: 'textarea',
+            width: '100%',
+            autoScroll: true,
+            name: 'line',
+            allowBlank: 'True',
+            bodyStyle: 'font-family: "monospace";',
+            listeners: {
+                specialkey: function(f, e){
+                    if (e.getKey() == e.ENTER) {
+                        cell_sent();
+                        yt_rpc.ExtDirectREPL.execute({
+                            code:repl_input.get('input_line').getValue()},
+                        handle_result);
+	                }
+	            }
+            },
+        },],
+    });
+
+    var NorthButton = new Ext.Button({
+        text : 'North',
+	    pageX : 205,
+        pageY : 10
+//        handler: function(b, e) { window.open("session.py", "_top"); }
+    });
+
+    var EastButton = new Ext.Button({
+        text:'East',
+        pageX : 410,
+        pageY : 205
+    });
+
+    var SouthButton = new Ext.Button({
+        text:'South',
+        pageX : 205,
+        pageY : 410
+    });
+
+    var WestButton = new Ext.Button({
+        text:'West',
+        pageX : 10,
+        pageY : 205
+    });
+
+    var OutputContainer = new Ext.Panel({
+        title: 'YT Output',
+        id: 'output_container',
+        autoScroll: true,
+        flex: 0.8,
+        items: []
+    });
+
+    var PlotPanel = new Ext.Panel({
+        title: 'Plot Window 1',
+        iconCls: 'graph',
+        autoScroll: true,
+        layout:'absolute',
+        items: [ 
+            NorthButton,
+            EastButton,
+            SouthButton,
+            WestButton
+        ]
+    });
+
+    var examine;
+    var notebook;
+
+    var treePanel = new Ext.tree.TreePanel({
+        iconCls: 'nav',
+        id: 'tree-panel',
+        title: 'Objects',
+        layout: 'anchor',
+        region:'west',
+        split: true,
+        anchor: '100% -35',
+        minSize: 150,
+        autoScroll: true,
+        rootVisible: false,
+        root:new Ext.tree.TreeNode({
+            expanded:true,
+            leaf:false,
+            text:''
+        })
+    });
+
+    var ButtonGroupPanel = new Ext.Panel({
+        layout: 'anchor',
+        ButtonAlign: 'center',
+        collapsible: false,
+        renderTo: document.body,
+        tbar: [{
+            xtype: 'buttongroup',
+            columns: 5,
+            items: [{
+                text: 'Download',
+                layout:'anchor',
+                anchor: '100% 33%',
+                handler: function(b, e) { 
+                    window.open("session.py", "_top"); 
+                    var record = new logging_store.recordType({
+                        record: 'Saved session locally.'});
+                    logging_store.add(record, number_log_records++);
+	            }
+            },{
+                xtype: 'tbseparator'
+            },{
+                text: 'Save',
+                layout:'anchor',
+	            anchor: '100% 67%',
+	            handler: function (b,e) { 
+                    Ext.Msg.prompt("We have important work to do.", 
+                    "Enter filename.", 
+                    function(btn, text) {
+                        if (btn == 'ok'){
+                            yt_rpc.ExtDirectREPL.save_session({filename:text}, 
+                            function(f, a) {
+                                if (a.result['status'] == 'SUCCESS') {
+                                    var alert_text = 'Saved session to ' + 
+                                    a.result['filename']
+                                    Ext.Msg.alert('Success!', alert_text);
+                                    var record = new logging_store.recordType(
+                                        {record: alert_text });
+                                    logging_store.add(record, number_log_records++);
+							    } else {
+							        Ext.Msg.alert('Always naysaying!',
+                                        'Failed to save to ' + 
+                                        a.result['filename'] + 
+                                        '<br>Error: ' + 
+                                        a.result['error']);
+                                }
+                            });
+                        }
+                    });
+                }
+            },{
+                xtype: 'tbseparator'
+            },{
+                text: 'Pastebin',
+                layout:'anchor',
+                anchor: '100% 100%',
+                handler: function (b,e) { 
+                    yt_rpc.ExtDirectREPL.paste_session({}, function(f, a) {
+                        if (a.result['status'] == 'SUCCESS') {
+                            var alert_text = 'Pasted session to:<br>' + 
+                            a.result['site']
+                            var alert_text_rec = 'Pasted session to: ' + 
+                            a.result['site']
+                            Ext.Msg.alert('Pastebin', alert_text);
+                            var record = new logging_store.recordType(
+                                {record: alert_text_rec });
+                            logging_store.add(record, number_log_records++);
+                        }
+                    }); 
+                }
+            }]
+        }]
+    });
+
+    var status_panel;
+    var logging_store = new Ext.data.Store({
+        fields: [{name:'record'}],
+        reader: new Ext.data.ArrayReader({}, [{name: 'record'}]),
+    });
+
+    Ext.onReady(function(){
+        Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
+
+    // NOTE: This is an example showing simple state management. During development,
+    // it is generally best to disable state management as dynamically-generated ids
+    // can change across page loads, leading to unpredictable results.  The developer
+    // should ensure that stable state ids are set for stateful components in real apps.
+    // it's a cold day for pontooning.
+        Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
+
+    // Go ahead and create the TreePanel now so that we can use it below
+        viewport = new Ext.Viewport({
+            layout: 'border',
+            items: [
+		    // lazily created panel (xtype:'panel' is default)
+                {
+                    xtype: 'grid',
+                    store: logging_store,
+                    defaults: { width: 800 },
+                    columns: [ {id:'record', 
+                        sortable: false,
+                        width:800} ],
+                    autofill: true,
+                    region: 'south',
+                    id: "status-region",
+                    cls: "status-logger",
+                    split: true,
+                    height: 100,
+                    maxSize: 200,
+                    collapsible: true,
+                    title: 'Status',
+                    margins: '0 0 0 0',
+                }, {
+                    region: 'west',
+                    id: 'west-panel', // see Ext.getCmp() below
+                    title: 'Data',
+                    split: true,
+                    width: 200,
+                    minSize: 175,
+                    maxSize: 400,
+                    collapsible: true,
+                    margins: '0 0 0 5',
+                    layout: {
+                        type: 'anchor',
+                    },
+                    items: [
+                        treePanel,
+                        ButtonGroupPanel
+                    ]
+		  // in this instance the TabPanel is not wrapped by another panel
+		  // since no title is needed, this Panel is added directly
+		  // as a Container
+                },{
+                    xtype: 'tabpanel',
+                    region: 'center', 
+                    id: 'center-panel',
+                    deferredRender: false,
+                    activeTab: 0,     
+                    items: [
+                        {
+                            title: 'YT',
+                            id: 'notebook',
+                            layout: 'vbox',
+                            layoutConfig: {align:'stretch'},
+                            closable: false,
+                            autoScroll: false,
+                            iconCls: 'console',
+                            items: [repl_input, OutputContainer]
+                        }, 
+//                        PlotPanel
+                    ]
+                }
+            ]
+        });
+
+// get a reference to the HTML element with id "hideit" and add a click listener to it 
+    console.log('Mitchell!\nPardon me! Mitchell!')
+    Ext.get("hideit").on('click', function(){
+// get a reference to the Panel that was created with id = 'west-panel' 
+	    var w = Ext.getCmp('west-panel');
+// expand or collapse that Panel based on its collapsed property state
+// need to make room for six sour cream burritos
+        w.collapsed ? w.expand() : w.collapse();
+    });
+    
+    notebook = viewport.get("center-panel").get("notebook");
+    status_panel = viewport.get("status-region").get("status-div");
+    
+    var record = new logging_store.recordType(
+        {record: 'Welcome to yt.'});
+    logging_store.add(record, number_log_records++);
+
+    var record = new logging_store.recordType(
+        {record: 'After entering a line of code in the YT Input field, press shift-enter to evaluate.' });
+    logging_store.add(record, number_log_records++);
+
+    var record = new logging_store.recordType(
+        {record: '4d3d3d3 engaged.' });
+    logging_store.add(record, number_log_records++);
+
+    if (!Ext.state.Manager.get("reason_welcomed", false)) {
+        Ext.MessageBox.alert("Reason v0.5",
+        "Welcome to Reason.  <br>Treat the 'YT Input' field as a YT/python intepreter.<br>Press shift-enter to evaluate.",
+        function(b,e){ repl_input.get("input_line").focus(); });
+        Ext.state.Manager.set("reason_welcomed", true);
+    } else { 
+        repl_input.get("input_line").focus(); }
+    });


http://bitbucket.org/yt_analysis/yt/changeset/ab257d403858/
changeset:   r4033:ab257d403858
branch:      yt
user:        Cameron Hummels
date:        2011-03-30 22:55:11
summary:     Merging.
affected #:  1 file (0 bytes)

http://bitbucket.org/yt_analysis/yt/changeset/773bd9fb18d5/
changeset:   r4034:773bd9fb18d5
branch:      yt
user:        Cameron Hummels
date:        2011-03-31 05:20:44
summary:     Added right-click menu (context menu) to treepanel for creating new plot windows.
affected #:  1 file (760 bytes)

--- a/yt/gui/reason/html/js/reason.js	Wed Mar 30 16:55:11 2011 -0400
+++ b/yt/gui/reason/html/js/reason.js	Wed Mar 30 23:20:44 2011 -0400
@@ -111,6 +111,18 @@
     var examine;
     var notebook;
 
+var rightClickMenu = new Ext.menu.Menu({
+    items: [
+        {
+            text: 'Open slice'
+//            handler: function(b, e) { window.open("session.py", "_top"); }
+        }, {
+            text: 'Open projection'
+//            handler: function(b, e) { window.open("session.py", "_top"); }
+        }
+    ]
+});
+
     var treePanel = new Ext.tree.TreePanel({
         iconCls: 'nav',
         id: 'tree-panel',
@@ -126,7 +138,20 @@
             expanded:true,
             leaf:false,
             text:''
-        })
+        }),
+        listeners: {
+                render: {
+                    fn: function() {
+                        Ext.getBody().on("contextmenu", Ext.emptyFn,
+                            null, {preventDefault: true});
+                    }
+                },
+                contextmenu: {
+                    fn: function(node, event){
+                        rightClickMenu.showAt(event.xy);
+                    }
+                }
+          }
     });
 
     var ButtonGroupPanel = new Ext.Panel({


http://bitbucket.org/yt_analysis/yt/changeset/e9895e90f0db/
changeset:   r4035:e9895e90f0db
branch:      yt
user:        Cameron Hummels
date:        2011-03-31 05:25:22
summary:     Fixed bug with panners.  North now goes north, and South goes south.
affected #:  1 file (0 bytes)

--- a/yt/gui/reason/html/js/widget_plotwindow.js	Wed Mar 30 23:20:44 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Wed Mar 30 23:25:22 2011 -0400
@@ -36,7 +36,7 @@
                     x: 205,
                     y: 10,
                     handler: function(b,e) {
-                        cc = python_varname + '.pan_rel((0.0, 0.5))'
+                        cc = python_varname + '.pan_rel((0.0, -0.5))'
                         yt_rpc.ExtDirectREPL.execute(
                         {code:cc}, handle_payload); 
                     }
@@ -57,7 +57,7 @@
                     y: 410,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
-                            {code:python_varname + '.pan_rel((0.0, -0.5))'},
+                            {code:python_varname + '.pan_rel((0.0, 0.5))'},
                         handle_payload); 
                     }
                 }, {


http://bitbucket.org/yt_analysis/yt/changeset/b0db379e6a21/
changeset:   r4036:b0db379e6a21
branch:      yt
user:        Cameron Hummels
date:        2011-03-31 08:35:29
summary:     Added in query forms for when you create a slice or a projection from right-clicking on a tree node.  Filled the query forms with limited possible options.  Created alert boxes when you try to slice, project or cancel.
affected #:  2 files (3.7 KB)

--- a/yt/gui/reason/html/js/functions.js	Wed Mar 30 23:25:22 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Thu Mar 31 02:35:29 2011 -0400
@@ -91,3 +91,125 @@
     cell_count++;
     return CellPanel;
 }
+
+
+function getSliceHandler(node){
+function sliceHandler(item,pressed){
+    var win = new Ext.Window({
+        layout:'fit',
+        width:240,
+        height:200,
+        modal:true,
+        resizable:false,
+        draggable:false,
+        border:false,
+        title:'Slice Details for ' + node,
+        items: [{
+            xtype: 'form', // FormPanel
+            labelWidth:80,
+            frame:true,
+            items: [{
+                xtype:'textfield',
+                fieldLabel: 'Center X',
+                id: 'x_center',
+                value: '0.5',
+                width: 90,
+                allowBlank:false,
+            },{
+                xtype:'textfield',
+                fieldLabel: 'Center Y',
+                id: 'y_center',
+                value: '0.5',
+                width: 90,
+                allowBlank:false,
+            },{
+                xtype:'textfield',
+                fieldLabel: 'Center Z',
+                id: 'z_center',
+                value: '0.5',
+                width: 90,
+                allowBlank:false,
+            },{
+                xtype:'combo',
+                fieldLabel: 'Axis',
+                id: 'axis',
+                store:['X','Y','Z'],
+                width: 90,
+                allowBlank:false,
+            },{
+                xtype:'combo',
+                fieldLabel: 'Field',
+                id: 'field',
+                store:['Density','Temperature','X Velocity','Y Velocity','Z Velocity'],
+                width: 90,
+                allowBlank:false,
+            }],
+            buttons: [
+                {
+                    text: 'Slice',
+                    handler: function(b, e){Ext.Msg.alert('Slicing','Slicing it up!')}
+                },{
+                    text: 'Cancel',
+                    handler: function(b, e){Ext.Msg.alert('Cancelled','Slice cancelled.')}
+                }
+            ]
+        }]
+    });
+    win.show(this);
+}
+return sliceHandler;
+}
+
+
+function getProjectionHandler(node){
+function projectionHandler(item,pressed){
+    var win = new Ext.Window({
+        layout:'fit',
+        width:240,
+        height:170,
+        modal:true,
+        resizable:false,
+        draggable:false,
+        border:false,
+        title:'Projection Details for ' + node,
+        items: [{
+            xtype: 'form', // FormPanel
+            labelWidth:80,
+            frame:true,
+            items: [{
+                xtype:'combo',
+                fieldLabel: 'Axis',
+                id: 'axis',
+                store:['X','Y','Z'],
+                width: 90,
+                allowBlank:false,
+            },{
+                xtype:'combo',
+                fieldLabel: 'Field',
+                id: 'field',
+                store:['Density','Temperature','X Velocity','Y Velocity','Z Velocity'],
+                width: 120,
+                allowBlank:false,
+            },{
+                xtype:'combo',
+                fieldLabel: 'Weight Field',
+                id: 'weightField',
+                store:['None','Density','Temperature','X Velocity','Y Velocity','Z Velocity'],
+                width: 120,
+                allowBlank:false,
+            }],
+            buttons: [
+                {
+                    text: 'Project',
+                    handler: function(b, e){Ext.Msg.alert('Projection','Projecting!')}
+                },{
+                    text: 'Cancel',
+                    handler: function(b, e){Ext.Msg.alert('Cancelled','Projection cancelled.')}
+                }
+            ]
+        }]
+    });
+    win.show(this);
+}
+return projectionHandler;
+}


--- a/yt/gui/reason/html/js/reason.js	Wed Mar 30 23:25:22 2011 -0400
+++ b/yt/gui/reason/html/js/reason.js	Thu Mar 31 02:35:29 2011 -0400
@@ -111,17 +111,6 @@
     var examine;
     var notebook;
 
-var rightClickMenu = new Ext.menu.Menu({
-    items: [
-        {
-            text: 'Open slice'
-//            handler: function(b, e) { window.open("session.py", "_top"); }
-        }, {
-            text: 'Open projection'
-//            handler: function(b, e) { window.open("session.py", "_top"); }
-        }
-    ]
-});
 
     var treePanel = new Ext.tree.TreePanel({
         iconCls: 'nav',
@@ -148,6 +137,17 @@
                 },
                 contextmenu: {
                     fn: function(node, event){
+                        var rightClickMenu = new Ext.menu.Menu({
+                            items: [
+                                {
+                                    text: 'Open slice',
+                                    handler: getSliceHandler(node),
+                                }, {
+                                    text: 'Open projection',
+                                    handler: getProjectionHandler(node),
+                                }
+                            ]
+                        });
                         rightClickMenu.showAt(event.xy);
                     }
                 }


http://bitbucket.org/yt_analysis/yt/changeset/4ee6b8e35575/
changeset:   r4037:4ee6b8e35575
branch:      yt
user:        MatthewTurk
date:        2011-03-31 05:26:08
summary:     Adding a 'help' button
affected #:  3 files (4.7 KB)

--- a/yt/gui/reason/extdirect_repl.py	Wed Mar 30 16:55:11 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Wed Mar 30 23:26:08 2011 -0400
@@ -70,6 +70,7 @@
         # entire interpreter state) we apply all the pre-routing now, rather
         # than through metaclasses or other fancy decorating.
         preroute_table = dict(index = ("/", "GET"),
+                              _help_html = ("/help.html", "GET"),
                               _myapi = ("/resources/ext-repl-api.js", "GET"),
                               _resources = ("/resources/:path#.+#", "GET"),
                               _js = ("/js/:path#.+#", "GET"),
@@ -89,6 +90,7 @@
         # Now we load up all the yt.mods stuff, but only after we've finished
         # setting up.
         self.execute("from yt.mods import *")
+        self.execute("from yt.data_objects.static_output import _cached_pfs")
         self.locals['load_script'] = ext_load_script
         self.locals['_widgets'] = {}
         self.locals['add_widget'] = self._add_widget
@@ -104,10 +106,14 @@
     def index(self):
         """Return an HTTP-based Read-Eval-Print-Loop terminal."""
         # For now this doesn't work!  We will need to move to a better method
-        # for this.
+        # for this.  It should use the package data command.
         vals = open(os.path.join(local_dir, "html/index.html")).read()
         return vals
 
+    def _help_html(self):
+        vals = open(os.path.join(local_dir, "html/help.html")).read()
+        return vals
+
     def _resources(self, path):
         pp = os.path.join(self.extjs_path, path)
         if not os.path.exists(pp):
@@ -225,7 +231,7 @@
                 except ReferenceError:
                     continue
                 objs.append(dict(name=name, type=obj._type_name))
-            rv.append( dict(name = str(pf), objects = objs) )
+            rv.append( dict(name = str(pf), objects = objs, filename=fn) )
         return rv
 
 def ext_load_script(filename):


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/help.html	Wed Mar 30 23:26:08 2011 -0400
@@ -0,0 +1,141 @@
+<HTML>
+<title>Reason: a GUI for yt</title>
+<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Crimson+Text">
+<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Inconsolata">
+<style type="text/css">
+body {
+    font-family: "Crimson Text", serif;
+}
+pre {
+    font-family: "Inconsolata", sans-serif;
+}
+div.semi_linked {
+    font-family: "Inconsolata", sans-serif;
+    padding: 1em;
+}
+pre.code{
+    background-color: #E0E0E0;
+    padding: 10px;
+}
+div.yt_logo {
+    float: left;
+    margin-left: 25px;
+    width:200px;
+}
+h1 {
+   font-size: 900%;
+   margin-top: 0.1em;
+   margin-bottom: 0.1em;
+}
+span.logo_y {
+   color: #000000;
+}
+span.logo_t {
+   color: #000000;
+}
+div.faq {
+    text-align: left;
+    width: 640px;
+    margin-left: auto;
+    margin-right: auto;
+    /*background-color: #F9F9F9;*/
+    border-left: 2px solid #D0D0D0;
+    border-right: 2px solid #D0D0D0;
+    padding: 25px;
+    position: absolute;
+    left: 300px;
+}
+p b {
+   color: #444444;
+}
+span.yt_name {
+    font-family: "Inconsolata", sans-serif;
+   color: #009955;
+}
+ul.quick_list {
+    list-style-type: none;
+    padding-left: 0px;
+    line-height: 200%;
+    border-top: 2px solid #D0D0D0;
+    padding-top: 15px;
+    font-size: 125%;
+}
+
+a {
+    /*text-decoration: none;*/
+}
+
+a:link {
+    color: #CC0055;
+}
+
+a:visited {
+    
+    color: #660033;
+}
+
+img.yt_image {
+    width: 220px;
+    height: auto;
+    max-height: 220px;
+    float: right;
+    padding: 5px;
+}
+</style>
+<body>
+<div class="yt_logo">
+<h1>yt:</h1>
+<p>because your data isn't going to analyze itself!</p>
+<ul class="quick_list">
+<li><a href="http://yt.enzotools.org/doc/">docs</a></li>
+<li><a href="http://yt.enzotools.org/wiki/Gallery">gallery</a> ( <a href="video_gallery.html">video</a> )</li>
+<li><a href="http://yt.enzotools.org/wiki">wiki</a></li>
+<li><a href="http://yt.enzotools.org/doc/orientation.html">quick start</a></li>
+<li><a href="http://yt.enzotools.org/newticket">report a bug</a></li>
+<li><a href="http://yt.enzotools.org/browser">source</a></li>
+<li><a href="principles.html">principles</a></li>
+<li><a href="http://blog.enzotools.org/">development blog</a></li>
+</ul>
+</div>
+<div class="faq">
+<h2>Reason: A GUI for yt</h2>
+<p>Reason is an interactive form of yt, totally accessible from a
+web browser.  It has full yt capabilities, as if you are acting from the Python
+intepreter, yet it also provides a new way of interacting directly with your
+data objects.  Because it is run through a web browser, you can run it remotely
+on HPC facilities where your data may reside, while manipulating and
+visualizing it in real time at your own local console.</p>
+
+<h2>Using the yt console</h2>
+<p>The Reason layout consists of a <i>yt input</i> box as well as an output
+window.  Whenever you press shift-enter, the contents of your input box is sent
+to the server and the results returned.  While the server is processing, the
+box around the input form will turn red and become read-only.  When the server
+has returned a result, it will return to normal and allow input.</p>
+
+<p>When using the Reason window to create a plot collection object, the saved
+images will be returned in the window.  You can click on these images to view
+them at full-size.</p>
+
+<h2>Using the interactive plot window</h2>
+<p>As you execute cells and load parameter files from disk, these parameter
+files will get added to the tree view on the left, along with any objects that
+have been created from them.</p>
+
+<p>Over time, these objects will expose right-click events to create plot
+windows, as well as drag-and-drop functionality.</p>
+
+<h2>Saving your session</h2>
+<p>There are three methods for saving your work.  You can click "Download" to
+download a copy of your session on your local machine.  By clicking "Save" you
+can save a copy on the server on which Reason is running.  By clicking
+"Pastebin" you can send a copy of it to the <a
+href="http://paste.enzotools.org/">yt pastebin</a>.</p>
+
+<h2>How to Quit</h2>
+<p>To quit, simply press Ctrl-C in the console window that you ran "yt serve"
+within.</p>
+
+</div>
+</body>
+</html>


--- a/yt/gui/reason/html/js/reason.js	Wed Mar 30 16:55:11 2011 -0400
+++ b/yt/gui/reason/html/js/reason.js	Wed Mar 30 23:26:08 2011 -0400
@@ -122,6 +122,11 @@
         minSize: 150,
         autoScroll: true,
         rootVisible: false,
+        listeners: {
+            contextmenu: function(n) {
+                Ext.Msg.alert('Hey jerk!');
+                }
+        },
         root:new Ext.tree.TreeNode({
             expanded:true,
             leaf:false,
@@ -136,11 +141,11 @@
         renderTo: document.body,
         tbar: [{
             xtype: 'buttongroup',
-            columns: 5,
+            columns: 7,
             items: [{
                 text: 'Download',
                 layout:'anchor',
-                anchor: '100% 33%',
+                anchor: '100% 25%',
                 handler: function(b, e) { 
                     window.open("session.py", "_top"); 
                     var record = new logging_store.recordType({
@@ -152,7 +157,7 @@
             },{
                 text: 'Save',
                 layout:'anchor',
-	            anchor: '100% 67%',
+	            anchor: '100% 50%',
 	            handler: function (b,e) { 
                     Ext.Msg.prompt("We have important work to do.", 
                     "Enter filename.", 
@@ -181,9 +186,9 @@
             },{
                 xtype: 'tbseparator'
             },{
-                text: 'Pastebin',
+                text: 'Paste',
                 layout:'anchor',
-                anchor: '100% 100%',
+                anchor: '100% 75%',
                 handler: function (b,e) { 
                     yt_rpc.ExtDirectREPL.paste_session({}, function(f, a) {
                         if (a.result['status'] == 'SUCCESS') {
@@ -198,6 +203,15 @@
                         }
                     }); 
                 }
+            },{
+                xtype: 'tbseparator'
+            },{
+                text: 'Help',
+                layout:'anchor',
+                anchor: '100% 100%',
+                handler: function (b,e) { 
+                        window.open("help.html", "_new");
+                }
             }]
         }]
     });


http://bitbucket.org/yt_analysis/yt/changeset/dd3153e54101/
changeset:   r4038:dd3153e54101
branch:      yt
user:        MatthewTurk
date:        2011-03-31 05:33:08
summary:     Adding a note about how to forward ports in existing SSH connections.
affected #:  1 file (975 bytes)

--- a/yt/gui/reason/bottle_mods.py	Wed Mar 30 23:26:08 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Wed Mar 30 23:33:08 2011 -0400
@@ -107,12 +107,32 @@
             print "WARNING: %s has no _route_prefix attribute.  Not notifying."
             continue
             w._route_prefix = token
-    print "Greetings! Your private token is %s ." % token
+    print
+    print
+    print "============================================================================="
+    print "============================================================================="
+    print "Greetings, and welcome to Reason!"
+    print "Your private token is %s ." % token
+    print "DO NOT SHARE THIS TOKEN."
     print
     print "Please direct your browser to:"
     print
     print "     http://localhost:%s/%s/" % (port, token)
     print
+    print "============================================================================="
+    print
+    print "If you are currently ssh'd into a remote machine, you should be able"
+    print "to create a new SSH tunnel by typing or copy/pasting this text"
+    print "verbatim, while waiting to see the 'ssh>' prompt after the first line."
+    print
+    print "~C"
+    print "-L%s:localhost:%s" % (port, port)
+    print
+    print "and then pointing a web browser on your local machine to the above URL."
+    print
+    print "============================================================================="
+    print "============================================================================="
+    print
     print
     if open_browser:
         # We do some fancy footwork so that we can open the browser while the


http://bitbucket.org/yt_analysis/yt/changeset/54a82cc9be77/
changeset:   r4039:54a82cc9be77
branch:      yt
user:        MatthewTurk
date:        2011-03-31 05:46:25
summary:     Removing a misguided debugging statement that snuck in, and adding recording of
the parameter file's filename (which is also its dictionary key in
_cached_pfs).
affected #:  2 files (161 bytes)

--- a/yt/gui/reason/html/js/functions.js	Wed Mar 30 23:33:08 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Wed Mar 30 23:46:25 2011 -0400
@@ -57,6 +57,7 @@
     Ext.each(my_pfs, function(pf, index) {
         treePanel.root.appendChild(new Ext.tree.TreeNode({
             text: pf.name,
+            pfdata: {fn: pf.filename},
             leaf:false, 
             expanded:true, 
             iconCls: 'pf_icon'}));


--- a/yt/gui/reason/html/js/reason.js	Wed Mar 30 23:33:08 2011 -0400
+++ b/yt/gui/reason/html/js/reason.js	Wed Mar 30 23:46:25 2011 -0400
@@ -122,10 +122,6 @@
         minSize: 150,
         autoScroll: true,
         rootVisible: false,
-        listeners: {
-            contextmenu: function(n) {
-                Ext.Msg.alert('Hey jerk!');
-                }
         },
         root:new Ext.tree.TreeNode({
             expanded:true,


http://bitbucket.org/yt_analysis/yt/changeset/f2fc7d71f27a/
changeset:   r4040:f2fc7d71f27a
branch:      yt
user:        MatthewTurk
date:        2011-03-31 05:52:03
summary:     Bug fix.  For some reason only caught this after a restart of the server.
affected #:  1 file (11 bytes)

--- a/yt/gui/reason/html/js/reason.js	Wed Mar 30 23:46:25 2011 -0400
+++ b/yt/gui/reason/html/js/reason.js	Wed Mar 30 23:52:03 2011 -0400
@@ -122,7 +122,6 @@
         minSize: 150,
         autoScroll: true,
         rootVisible: false,
-        },
         root:new Ext.tree.TreeNode({
             expanded:true,
             leaf:false,


http://bitbucket.org/yt_analysis/yt/changeset/54b19b20974f/
changeset:   r4041:54b19b20974f
branch:      yt
user:        MatthewTurk
date:        2011-03-31 06:04:19
summary:     Adding zoom buttons
affected #:  1 file (1.7 KB)

--- a/yt/gui/reason/html/js/widget_plotwindow.js	Wed Mar 30 23:52:03 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Thu Mar 31 00:04:19 2011 -0400
@@ -71,6 +71,52 @@
                         handle_payload); 
                     }
                 },
+                /* Now the zoom buttons */
+                {
+                    xtype: 'button',
+                    text: 'Zoom In 10x',
+                    x: 410,
+                    y: 10,
+                    width: 100,
+                    handler: function(b,e) {
+                        yt_rpc.ExtDirectREPL.execute(
+                            {code:python_varname + '.zoom(10.0)'},
+                        handle_payload); 
+                    }
+                },{
+                    xtype: 'button',
+                    text: 'Zoom In 2x',
+                    x: 410,
+                    y: 35,
+                    width: 100,
+                    handler: function(b,e) {
+                        yt_rpc.ExtDirectREPL.execute(
+                            {code:python_varname + '.zoom(2.0)'},
+                        handle_payload); 
+                    }
+                },{
+                    xtype: 'button',
+                    text: 'Zoom Out 2x',
+                    x: 410,
+                    y: 60,
+                    width: 100,
+                    handler: function(b,e) {
+                        yt_rpc.ExtDirectREPL.execute(
+                            {code:python_varname + '.zoom(0.5)'},
+                        handle_payload); 
+                    }
+                },{
+                    xtype: 'button',
+                    text: 'Zoom Out 10x',
+                    x: 410,
+                    y: 85,
+                    width: 100,
+                    handler: function(b,e) {
+                        yt_rpc.ExtDirectREPL.execute(
+                            {code:python_varname + '.zoom(0.1)'},
+                        handle_payload); 
+                    }
+                }
             ]
         }
     );


http://bitbucket.org/yt_analysis/yt/changeset/287f8c5635fc/
changeset:   r4042:287f8c5635fc
branch:      yt
user:        MatthewTurk
date:        2011-03-31 06:06:56
summary:     Adding this for later, after the next big merge
affected #:  1 file (157 bytes)

--- a/yt/gui/reason/html/js/functions.js	Thu Mar 31 00:04:19 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Thu Mar 31 00:06:56 2011 -0400
@@ -92,3 +92,9 @@
     cell_count++;
     return CellPanel;
 }
+
+function widget_call(varname, method) {
+    var fcall = varname + "." + method;
+    yt_rpc.ExtDirectREPL.execute(
+        {code: fcall}, handle_payload);
+}


http://bitbucket.org/yt_analysis/yt/changeset/202d35979599/
changeset:   r4043:202d35979599
branch:      yt
user:        MatthewTurk
date:        2011-03-31 07:04:26
summary:     Adding drag-and-drop for items in the tree
affected #:  3 files (1.4 KB)

--- a/yt/gui/reason/extdirect_repl.py	Thu Mar 31 00:06:56 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Thu Mar 31 01:04:26 2011 -0400
@@ -225,13 +225,16 @@
         rv = []
         for fn, pf in sorted(_cached_pfs.items()):
             objs = []
-            for obj in pf.h.objects:
+            pf_varname = "_cached_pfs['%s']" % (fn)
+            for i,obj in enumerate(pf.h.objects):
                 try:
                     name = str(obj)
                 except ReferenceError:
                     continue
-                objs.append(dict(name=name, type=obj._type_name))
-            rv.append( dict(name = str(pf), objects = objs, filename=fn) )
+                objs.append(dict(name=name, type=obj._type_name,
+                                 varname = "%s.h.objects[%s]" % (pf_varname, i)))
+            rv.append( dict(name = str(pf), objects = objs, filename=fn,
+                            varname = pf_varname) )
         return rv
 
 def ext_load_script(filename):


--- a/yt/gui/reason/html/js/functions.js	Thu Mar 31 00:06:56 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Thu Mar 31 01:04:26 2011 -0400
@@ -57,14 +57,18 @@
     Ext.each(my_pfs, function(pf, index) {
         treePanel.root.appendChild(new Ext.tree.TreeNode({
             text: pf.name,
-            pfdata: {fn: pf.filename},
+            objdata: {fn: pf.filename, varname: pf.varname},
             leaf:false, 
             expanded:true, 
             iconCls: 'pf_icon'}));
         this_pf = treePanel.root.lastChild
-        Ext.each(pf.objects, function(object, obj_index) {
-            this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
-            leaf: true, iconCls: 'data_object'}));
+        Ext.each(pf.objects, function(obj, obj_index) {
+            this_pf.appendChild(new Ext.tree.TreeNode(
+                {text: obj.name,
+                 leaf: true,
+                 iconCls: 'data_obj',
+                 objdata: {varname: obj.varname},
+                 }));
         });
     });
 }


--- a/yt/gui/reason/html/js/reason.js	Thu Mar 31 00:06:56 2011 -0400
+++ b/yt/gui/reason/html/js/reason.js	Thu Mar 31 01:04:26 2011 -0400
@@ -57,7 +57,28 @@
                             code:repl_input.get('input_line').getValue()},
                         handle_result);
 	                }
-	            }
+	            },
+                afterrender: function(f, e){
+                    //var input_line_drop_target_el = repl_input.get("input_line").el.dom;
+                    var input_line_drop_target_el = repl_input.body.dom;
+
+                    var input_line_drop_target = new Ext.dd.DropTarget(input_line_drop_target_el, {
+                        ddGroup     : 'pfDDgroup',
+                        notifyEnter : function(ddSource, e, data) {
+                            repl_input.body.stopFx();
+                            repl_input.body.highlight();
+                        },
+                        notifyDrop  : function(ddSource, e, data){
+
+                            var varname = data.node.attributes.objdata.varname;
+                            /* There is possibly a better way to do this, where it's also
+                               inserted correctly. */
+                            var line = repl_input.get("input_line");
+                            line.setValue(line.getValue() + varname);
+                            return(true);
+                        }
+                    });
+                },
             },
         },],
     });
@@ -122,6 +143,8 @@
         minSize: 150,
         autoScroll: true,
         rootVisible: false,
+        ddGroup: 'pfDDgroup',
+        enableDD: true,
         root:new Ext.tree.TreeNode({
             expanded:true,
             leaf:false,


http://bitbucket.org/yt_analysis/yt/changeset/e5c69f2fdf2b/
changeset:   r4044:e5c69f2fdf2b
branch:      yt
user:        MatthewTurk
date:        2011-03-31 07:20:21
summary:     Adding a quick note about load_script(...) to the help file, and changing
add_widget to accept a string that is the name that the widget is bound to in
the interpreter space.
affected #:  2 files (261 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Thu Mar 31 01:04:26 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Thu Mar 31 01:20:21 2011 -0400
@@ -196,14 +196,15 @@
         response.headers["content-disposition"] = "attachment;"
         return cs
 
-    def _add_widget(self, widget):
+    def _add_widget(self, widget_name):
         # This should be sanitized
+        widget = self.locals[widget_name]
         uu = str(uuid.uuid1()).replace("-","_")
         varname = "%s_%s" % (widget._widget_name, uu)
         widget._ext_widget_id = varname
         # THIS BREAKS THE SCRIPT DOWNLOAD!
         # We need to make the variable be bound via an execution mechanism
-        self.locals[varname] = widget
+        self.execute("%s = %s\n" % (varname, widget_name))
         payload = {'type': 'widget',
                    'widget_type': widget._widget_name,
                    'varname': varname}


--- a/yt/gui/reason/html/help.html	Thu Mar 31 01:04:26 2011 -0400
+++ b/yt/gui/reason/html/help.html	Thu Mar 31 01:20:21 2011 -0400
@@ -125,13 +125,17 @@
 <p>Over time, these objects will expose right-click events to create plot
 windows, as well as drag-and-drop functionality.</p>
 
-<h2>Saving your session</h2>
+<h2>Saving and loading sessions</h2><p>There are three methods for saving your work.  You can click "Download" to
 download a copy of your session on your local machine.  By clicking "Save" you
 can save a copy on the server on which Reason is running.  By clicking
 "Pastebin" you can send a copy of it to the <a
 href="http://paste.enzotools.org/">yt pastebin</a>.</p>
 
+<p>If you use the command 'load_script' and supply it a file the server can
+find locally, it will read that file in and populate the contents of your next
+submission cell with it.</p>
+
 <h2>How to Quit</h2><p>To quit, simply press Ctrl-C in the console window that you ran "yt serve"
 within.</p>


http://bitbucket.org/yt_analysis/yt/changeset/f7fb0b4d48e6/
changeset:   r4045:f7fb0b4d48e6
branch:      yt
user:        MatthewTurk
date:        2011-03-31 07:25:48
summary:     Scroll to the bottom with any new logs.
affected #:  1 file (165 bytes)

--- a/yt/gui/reason/html/js/functions.js	Thu Mar 31 01:20:21 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Thu Mar 31 01:25:48 2011 -0400
@@ -1,4 +1,5 @@
 function cell_finished(result, new_cell) {
+    var new_log = false;
     Ext.each(result['payloads'], 
     function(payload, index) {
         if (payload['type'] == 'png_string') {
@@ -20,6 +21,7 @@
 	        var record = new logging_store.recordType(
 		        {record: payload['log_entry'] });
 	        logging_store.add(record, number_log_records++);
+            new_log = true;
         } else if (payload['type'] == 'widget') {
             var widget_type = payload['widget_type'];
             var widget = new widget_types[widget_type](payload['varname']);
@@ -33,6 +35,9 @@
     repl_input.body.removeClass("cell_waiting");
     repl_input.get('input_line').setReadOnly(false);
     repl_input.get("input_line").focus();
+    if (new_log == true){
+        viewport.get("status-region").getView().focusRow(number_log_records-1);
+    }
 }
 
 function cell_sent() {


http://bitbucket.org/yt_analysis/yt/changeset/1e7b6ffca9ea/
changeset:   r4046:1e7b6ffca9ea
branch:      yt
user:        MatthewTurk
date:        2011-03-31 08:37:01
summary:     Debugging payload delivery for nested calls to payload-providing functions, and
added an append_payload function.  All return values should become payloads to
help fix any future problems.

Added a create_slice RPC call.
affected #:  4 files (1.6 KB)

--- a/yt/gui/reason/bottle_mods.py	Thu Mar 31 01:25:48 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Thu Mar 31 02:37:01 2011 -0400
@@ -30,6 +30,7 @@
 import json
 import logging
 from yt.utilities.logger import ytLogger as mylog
+from yt.funcs import *
 
 route_functions = {}
 route_watchers = []
@@ -46,6 +47,7 @@
 
 class PayloadHandler(object):
     _shared_state = {}
+    _hold = False
 
     def __new__(cls, *p, **k):
         self = object.__new__(cls, *p, **k)
@@ -56,6 +58,7 @@
         self.payloads = []
 
     def deliver_payloads(self):
+        if self._hold: return []
         payloads = self.payloads
         self.payloads = []
         return payloads
@@ -63,6 +66,24 @@
     def add_payload(self, to_add):
         self.payloads.append(to_add)
 
+_ph = PayloadHandler()
+
+def append_payloads(func):
+    @wraps(func)
+    def wrapper(self, *args, **kwargs):
+        reset = not _ph._hold
+        _ph._hold = True
+        rv = func(self, *args, **kwargs)
+        # Assume it returns a dict
+        if not reset: return rv
+        # In case it sets it manually
+        _ph._hold = False
+        payloads = rv.get('payloads', [])
+        payloads += _ph.deliver_payloads()
+        rv['payloads'] = payloads
+        return rv
+    return wrapper
+
 class BottleDirectRouter(DirectRouter):
     # This class implements a mechanism for auto-routing an ExtDirect-callable
     # object through Bottle.  It should be used as a base class of an object,


--- a/yt/gui/reason/extdirect_repl.py	Thu Mar 31 01:25:48 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Thu Mar 31 02:37:01 2011 -0400
@@ -29,10 +29,13 @@
 import cStringIO
 import logging
 import uuid
+import numpy as na
+
+from yt.funcs import *
 from yt.utilities.logger import ytLogger, ufstring
 
 from .bottle_mods import preroute, BottleDirectRouter, notify_route, \
-                         PayloadHandler
+                         PayloadHandler, append_payloads
 from .bottle import response, request, route
 from .basic_repl import ProgrammaticREPL
 
@@ -145,13 +148,12 @@
     def _highlighter_css(self):
         return highlighter_css
 
+    @append_payloads
     def execute(self, code):
         self.executed_cell_texts.append(code)
         result = ProgrammaticREPL.execute(self, code)
-        payloads = self.payload_handler.deliver_payloads()
         return_value = {'output': result,
-                        'input': highlighter(code),
-                        'payloads': payloads}
+                        'input': highlighter(code)}
         return return_value
 
     def get_history(self):
@@ -196,6 +198,7 @@
         response.headers["content-disposition"] = "attachment;"
         return cs
 
+    @append_payloads
     def _add_widget(self, widget_name):
         # This should be sanitized
         widget = self.locals[widget_name]
@@ -204,12 +207,37 @@
         widget._ext_widget_id = varname
         # THIS BREAKS THE SCRIPT DOWNLOAD!
         # We need to make the variable be bound via an execution mechanism
-        self.execute("%s = %s\n" % (varname, widget_name))
         payload = {'type': 'widget',
                    'widget_type': widget._widget_name,
                    'varname': varname}
-        print payload
         self.payload_handler.add_payload(payload)
+        rv = self.execute("%s = %s\n" % (varname, widget_name))
+        return rv
+
+    @append_payloads
+    def create_slice(self, pfname, center, axis, field):
+        funccall = """
+        _tpf = %(pfname)s
+        _tcenter = na.array([%(c1)0.20f, %(c2)0.20f, %(c3)0.20f], dtype='float64')
+        _taxis = %(axis)s
+        _tfield = "%(field)s"
+        _tcoord = _tcenter[_taxis]
+        _tsl = _tpf.h.slice(_taxis, _tcoord, center = _tcenter)
+        _txax, _tyax = x_dict[_taxis], y_dict[_taxis]
+        DLE, DRE = _tpf.domain_left_edge, _tpf.domain_right_edge
+        from yt.visualization.plot_window import PWViewerExtJS
+        _tpw = PWViewerExtJS(_tsl, (DLE[_txax], DRE[_txax], DLE[_tyax], DRE[_tyax]))
+        _tpw._current_field = _tfield
+        _tpw.set_log(_tfield, True)
+        add_widget('_tpw')
+        """ % dict(pfname = pfname,
+                   c1 = center[0], c2 = center[1], c3 = center[2],
+                   axis = axis, field=field)
+        # There is a call to do this, but I have forgotten it ...
+        funccall = "\n".join((line.strip() for line in funccall.splitlines()))
+        rv = self.execute(funccall)
+        return rv
+
 
     def _test_widget(self):
         class tt(object):


--- a/yt/gui/reason/html/js/functions.js	Thu Mar 31 01:25:48 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Thu Mar 31 02:37:01 2011 -0400
@@ -32,12 +32,12 @@
         }
     });
     yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
+    if (new_log == true){
+        viewport.get("status-region").getView().focusRow(number_log_records-1);
+    }
     repl_input.body.removeClass("cell_waiting");
     repl_input.get('input_line').setReadOnly(false);
     repl_input.get("input_line").focus();
-    if (new_log == true){
-        viewport.get("status-region").getView().focusRow(number_log_records-1);
-    }
 }
 
 function cell_sent() {


--- a/yt/gui/reason/html/js/reason.js	Thu Mar 31 01:25:48 2011 -0400
+++ b/yt/gui/reason/html/js/reason.js	Thu Mar 31 02:37:01 2011 -0400
@@ -75,6 +75,7 @@
                                inserted correctly. */
                             var line = repl_input.get("input_line");
                             line.setValue(line.getValue() + varname);
+                            line.focus();
                             return(true);
                         }
                     });


http://bitbucket.org/yt_analysis/yt/changeset/fc1a0ac32b0b/
changeset:   r4047:fc1a0ac32b0b
branch:      yt
user:        Cameron Hummels
date:        2011-03-31 08:40:59
summary:     Merge.
affected #:  3 files (3.6 KB)

--- a/yt/gui/reason/bottle_mods.py	Thu Mar 31 02:35:29 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Thu Mar 31 02:40:59 2011 -0400
@@ -30,6 +30,7 @@
 import json
 import logging
 from yt.utilities.logger import ytLogger as mylog
+from yt.funcs import *
 
 route_functions = {}
 route_watchers = []
@@ -46,6 +47,7 @@
 
 class PayloadHandler(object):
     _shared_state = {}
+    _hold = False
 
     def __new__(cls, *p, **k):
         self = object.__new__(cls, *p, **k)
@@ -56,6 +58,7 @@
         self.payloads = []
 
     def deliver_payloads(self):
+        if self._hold: return []
         payloads = self.payloads
         self.payloads = []
         return payloads
@@ -63,6 +66,24 @@
     def add_payload(self, to_add):
         self.payloads.append(to_add)
 
+_ph = PayloadHandler()
+
+def append_payloads(func):
+    @wraps(func)
+    def wrapper(self, *args, **kwargs):
+        reset = not _ph._hold
+        _ph._hold = True
+        rv = func(self, *args, **kwargs)
+        # Assume it returns a dict
+        if not reset: return rv
+        # In case it sets it manually
+        _ph._hold = False
+        payloads = rv.get('payloads', [])
+        payloads += _ph.deliver_payloads()
+        rv['payloads'] = payloads
+        return rv
+    return wrapper
+
 class BottleDirectRouter(DirectRouter):
     # This class implements a mechanism for auto-routing an ExtDirect-callable
     # object through Bottle.  It should be used as a base class of an object,
@@ -107,12 +128,32 @@
             print "WARNING: %s has no _route_prefix attribute.  Not notifying."
             continue
             w._route_prefix = token
-    print "Greetings! Your private token is %s ." % token
+    print
+    print
+    print "============================================================================="
+    print "============================================================================="
+    print "Greetings, and welcome to Reason!"
+    print "Your private token is %s ." % token
+    print "DO NOT SHARE THIS TOKEN."
     print
     print "Please direct your browser to:"
     print
     print "     http://localhost:%s/%s/" % (port, token)
     print
+    print "============================================================================="
+    print
+    print "If you are currently ssh'd into a remote machine, you should be able"
+    print "to create a new SSH tunnel by typing or copy/pasting this text"
+    print "verbatim, while waiting to see the 'ssh>' prompt after the first line."
+    print
+    print "~C"
+    print "-L%s:localhost:%s" % (port, port)
+    print
+    print "and then pointing a web browser on your local machine to the above URL."
+    print
+    print "============================================================================="
+    print "============================================================================="
+    print
     print
     if open_browser:
         # We do some fancy footwork so that we can open the browser while the


--- a/yt/gui/reason/extdirect_repl.py	Thu Mar 31 02:35:29 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Thu Mar 31 02:40:59 2011 -0400
@@ -29,10 +29,13 @@
 import cStringIO
 import logging
 import uuid
+import numpy as na
+
+from yt.funcs import *
 from yt.utilities.logger import ytLogger, ufstring
 
 from .bottle_mods import preroute, BottleDirectRouter, notify_route, \
-                         PayloadHandler
+                         PayloadHandler, append_payloads
 from .bottle import response, request, route
 from .basic_repl import ProgrammaticREPL
 
@@ -70,6 +73,7 @@
         # entire interpreter state) we apply all the pre-routing now, rather
         # than through metaclasses or other fancy decorating.
         preroute_table = dict(index = ("/", "GET"),
+                              _help_html = ("/help.html", "GET"),
                               _myapi = ("/resources/ext-repl-api.js", "GET"),
                               _resources = ("/resources/:path#.+#", "GET"),
                               _js = ("/js/:path#.+#", "GET"),
@@ -89,6 +93,7 @@
         # Now we load up all the yt.mods stuff, but only after we've finished
         # setting up.
         self.execute("from yt.mods import *")
+        self.execute("from yt.data_objects.static_output import _cached_pfs")
         self.locals['load_script'] = ext_load_script
         self.locals['_widgets'] = {}
         self.locals['add_widget'] = self._add_widget
@@ -104,10 +109,14 @@
     def index(self):
         """Return an HTTP-based Read-Eval-Print-Loop terminal."""
         # For now this doesn't work!  We will need to move to a better method
-        # for this.
+        # for this.  It should use the package data command.
         vals = open(os.path.join(local_dir, "html/index.html")).read()
         return vals
 
+    def _help_html(self):
+        vals = open(os.path.join(local_dir, "html/help.html")).read()
+        return vals
+
     def _resources(self, path):
         pp = os.path.join(self.extjs_path, path)
         if not os.path.exists(pp):
@@ -139,13 +148,12 @@
     def _highlighter_css(self):
         return highlighter_css
 
+    @append_payloads
     def execute(self, code):
         self.executed_cell_texts.append(code)
         result = ProgrammaticREPL.execute(self, code)
-        payloads = self.payload_handler.deliver_payloads()
         return_value = {'output': result,
-                        'input': highlighter(code),
-                        'payloads': payloads}
+                        'input': highlighter(code)}
         return return_value
 
     def get_history(self):
@@ -190,19 +198,46 @@
         response.headers["content-disposition"] = "attachment;"
         return cs
 
-    def _add_widget(self, widget):
+    @append_payloads
+    def _add_widget(self, widget_name):
         # This should be sanitized
+        widget = self.locals[widget_name]
         uu = str(uuid.uuid1()).replace("-","_")
         varname = "%s_%s" % (widget._widget_name, uu)
         widget._ext_widget_id = varname
         # THIS BREAKS THE SCRIPT DOWNLOAD!
         # We need to make the variable be bound via an execution mechanism
-        self.locals[varname] = widget
         payload = {'type': 'widget',
                    'widget_type': widget._widget_name,
                    'varname': varname}
-        print payload
         self.payload_handler.add_payload(payload)
+        rv = self.execute("%s = %s\n" % (varname, widget_name))
+        return rv
+
+    @append_payloads
+    def create_slice(self, pfname, center, axis, field):
+        funccall = """
+        _tpf = %(pfname)s
+        _tcenter = na.array([%(c1)0.20f, %(c2)0.20f, %(c3)0.20f], dtype='float64')
+        _taxis = %(axis)s
+        _tfield = "%(field)s"
+        _tcoord = _tcenter[_taxis]
+        _tsl = _tpf.h.slice(_taxis, _tcoord, center = _tcenter)
+        _txax, _tyax = x_dict[_taxis], y_dict[_taxis]
+        DLE, DRE = _tpf.domain_left_edge, _tpf.domain_right_edge
+        from yt.visualization.plot_window import PWViewerExtJS
+        _tpw = PWViewerExtJS(_tsl, (DLE[_txax], DRE[_txax], DLE[_tyax], DRE[_tyax]))
+        _tpw._current_field = _tfield
+        _tpw.set_log(_tfield, True)
+        add_widget('_tpw')
+        """ % dict(pfname = pfname,
+                   c1 = center[0], c2 = center[1], c3 = center[2],
+                   axis = axis, field=field)
+        # There is a call to do this, but I have forgotten it ...
+        funccall = "\n".join((line.strip() for line in funccall.splitlines()))
+        rv = self.execute(funccall)
+        return rv
+
 
     def _test_widget(self):
         class tt(object):
@@ -219,13 +254,16 @@
         rv = []
         for fn, pf in sorted(_cached_pfs.items()):
             objs = []
-            for obj in pf.h.objects:
+            pf_varname = "_cached_pfs['%s']" % (fn)
+            for i,obj in enumerate(pf.h.objects):
                 try:
                     name = str(obj)
                 except ReferenceError:
                     continue
-                objs.append(dict(name=name, type=obj._type_name))
-            rv.append( dict(name = str(pf), objects = objs) )
+                objs.append(dict(name=name, type=obj._type_name,
+                                 varname = "%s.h.objects[%s]" % (pf_varname, i)))
+            rv.append( dict(name = str(pf), objects = objs, filename=fn,
+                            varname = pf_varname) )
         return rv
 
 def ext_load_script(filename):


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/help.html	Thu Mar 31 02:40:59 2011 -0400
@@ -0,0 +1,145 @@
+<HTML>
+<title>Reason: a GUI for yt</title>
+<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Crimson+Text">
+<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Inconsolata">
+<style type="text/css">
+body {
+    font-family: "Crimson Text", serif;
+}
+pre {
+    font-family: "Inconsolata", sans-serif;
+}
+div.semi_linked {
+    font-family: "Inconsolata", sans-serif;
+    padding: 1em;
+}
+pre.code{
+    background-color: #E0E0E0;
+    padding: 10px;
+}
+div.yt_logo {
+    float: left;
+    margin-left: 25px;
+    width:200px;
+}
+h1 {
+   font-size: 900%;
+   margin-top: 0.1em;
+   margin-bottom: 0.1em;
+}
+span.logo_y {
+   color: #000000;
+}
+span.logo_t {
+   color: #000000;
+}
+div.faq {
+    text-align: left;
+    width: 640px;
+    margin-left: auto;
+    margin-right: auto;
+    /*background-color: #F9F9F9;*/
+    border-left: 2px solid #D0D0D0;
+    border-right: 2px solid #D0D0D0;
+    padding: 25px;
+    position: absolute;
+    left: 300px;
+}
+p b {
+   color: #444444;
+}
+span.yt_name {
+    font-family: "Inconsolata", sans-serif;
+   color: #009955;
+}
+ul.quick_list {
+    list-style-type: none;
+    padding-left: 0px;
+    line-height: 200%;
+    border-top: 2px solid #D0D0D0;
+    padding-top: 15px;
+    font-size: 125%;
+}
+
+a {
+    /*text-decoration: none;*/
+}
+
+a:link {
+    color: #CC0055;
+}
+
+a:visited {
+    
+    color: #660033;
+}
+
+img.yt_image {
+    width: 220px;
+    height: auto;
+    max-height: 220px;
+    float: right;
+    padding: 5px;
+}
+</style>
+<body>
+<div class="yt_logo">
+<h1>yt:</h1>
+<p>because your data isn't going to analyze itself!</p>
+<ul class="quick_list">
+<li><a href="http://yt.enzotools.org/doc/">docs</a></li>
+<li><a href="http://yt.enzotools.org/wiki/Gallery">gallery</a> ( <a href="video_gallery.html">video</a> )</li>
+<li><a href="http://yt.enzotools.org/wiki">wiki</a></li>
+<li><a href="http://yt.enzotools.org/doc/orientation.html">quick start</a></li>
+<li><a href="http://yt.enzotools.org/newticket">report a bug</a></li>
+<li><a href="http://yt.enzotools.org/browser">source</a></li>
+<li><a href="principles.html">principles</a></li>
+<li><a href="http://blog.enzotools.org/">development blog</a></li>
+</ul>
+</div>
+<div class="faq">
+<h2>Reason: A GUI for yt</h2>
+<p>Reason is an interactive form of yt, totally accessible from a
+web browser.  It has full yt capabilities, as if you are acting from the Python
+intepreter, yet it also provides a new way of interacting directly with your
+data objects.  Because it is run through a web browser, you can run it remotely
+on HPC facilities where your data may reside, while manipulating and
+visualizing it in real time at your own local console.</p>
+
+<h2>Using the yt console</h2>
+<p>The Reason layout consists of a <i>yt input</i> box as well as an output
+window.  Whenever you press shift-enter, the contents of your input box is sent
+to the server and the results returned.  While the server is processing, the
+box around the input form will turn red and become read-only.  When the server
+has returned a result, it will return to normal and allow input.</p>
+
+<p>When using the Reason window to create a plot collection object, the saved
+images will be returned in the window.  You can click on these images to view
+them at full-size.</p>
+
+<h2>Using the interactive plot window</h2>
+<p>As you execute cells and load parameter files from disk, these parameter
+files will get added to the tree view on the left, along with any objects that
+have been created from them.</p>
+
+<p>Over time, these objects will expose right-click events to create plot
+windows, as well as drag-and-drop functionality.</p>
+
+<h2>Saving and loading sessions</h2>
+<p>There are three methods for saving your work.  You can click "Download" to
+download a copy of your session on your local machine.  By clicking "Save" you
+can save a copy on the server on which Reason is running.  By clicking
+"Pastebin" you can send a copy of it to the <a
+href="http://paste.enzotools.org/">yt pastebin</a>.</p>
+
+<p>If you use the command 'load_script' and supply it a file the server can
+find locally, it will read that file in and populate the contents of your next
+submission cell with it.</p>
+
+<h2>How to Quit</h2>
+<p>To quit, simply press Ctrl-C in the console window that you ran "yt serve"
+within.</p>
+
+</div>
+</body>
+</html>


--- a/yt/gui/reason/html/js/functions.js	Thu Mar 31 02:35:29 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Thu Mar 31 02:40:59 2011 -0400
@@ -1,4 +1,5 @@
 function cell_finished(result, new_cell) {
+    var new_log = false;
     Ext.each(result['payloads'], 
     function(payload, index) {
         if (payload['type'] == 'png_string') {
@@ -20,6 +21,7 @@
 	        var record = new logging_store.recordType(
 		        {record: payload['log_entry'] });
 	        logging_store.add(record, number_log_records++);
+            new_log = true;
         } else if (payload['type'] == 'widget') {
             var widget_type = payload['widget_type'];
             var widget = new widget_types[widget_type](payload['varname']);
@@ -30,6 +32,9 @@
         }
     });
     yt_rpc.ExtDirectParameterFileList.get_list_of_pfs({}, fill_tree);
+    if (new_log == true){
+        viewport.get("status-region").getView().focusRow(number_log_records-1);
+    }
     repl_input.body.removeClass("cell_waiting");
     repl_input.get('input_line').setReadOnly(false);
     repl_input.get("input_line").focus();
@@ -57,13 +62,18 @@
     Ext.each(my_pfs, function(pf, index) {
         treePanel.root.appendChild(new Ext.tree.TreeNode({
             text: pf.name,
+            objdata: {fn: pf.filename, varname: pf.varname},
             leaf:false, 
             expanded:true, 
             iconCls: 'pf_icon'}));
         this_pf = treePanel.root.lastChild
-        Ext.each(pf.objects, function(object, obj_index) {
-            this_pf.appendChild(new Ext.tree.TreeNode({text: object.name,
-            leaf: true, iconCls: 'data_object'}));
+        Ext.each(pf.objects, function(obj, obj_index) {
+            this_pf.appendChild(new Ext.tree.TreeNode(
+                {text: obj.name,
+                 leaf: true,
+                 iconCls: 'data_obj',
+                 objdata: {varname: obj.varname},
+                 }));
         });
     });
 }
@@ -92,7 +102,6 @@
     return CellPanel;
 }
 
-
 function getSliceHandler(node){
 function sliceHandler(item,pressed){
     var win = new Ext.Window({
@@ -160,6 +169,12 @@
 return sliceHandler;
 }
 
+function widget_call(varname, method) {
+    var fcall = varname + "." + method;
+    yt_rpc.ExtDirectREPL.execute(
+        {code: fcall}, handle_payload);
+}
+
 
 function getProjectionHandler(node){
 function projectionHandler(item,pressed){
@@ -213,3 +228,5 @@
 }
 return projectionHandler;
 }
+=======
+>>>>>>> other


--- a/yt/gui/reason/html/js/reason.js	Thu Mar 31 02:35:29 2011 -0400
+++ b/yt/gui/reason/html/js/reason.js	Thu Mar 31 02:40:59 2011 -0400
@@ -57,7 +57,29 @@
                             code:repl_input.get('input_line').getValue()},
                         handle_result);
 	                }
-	            }
+	            },
+                afterrender: function(f, e){
+                    //var input_line_drop_target_el = repl_input.get("input_line").el.dom;
+                    var input_line_drop_target_el = repl_input.body.dom;
+
+                    var input_line_drop_target = new Ext.dd.DropTarget(input_line_drop_target_el, {
+                        ddGroup     : 'pfDDgroup',
+                        notifyEnter : function(ddSource, e, data) {
+                            repl_input.body.stopFx();
+                            repl_input.body.highlight();
+                        },
+                        notifyDrop  : function(ddSource, e, data){
+
+                            var varname = data.node.attributes.objdata.varname;
+                            /* There is possibly a better way to do this, where it's also
+                               inserted correctly. */
+                            var line = repl_input.get("input_line");
+                            line.setValue(line.getValue() + varname);
+                            line.focus();
+                            return(true);
+                        }
+                    });
+                },
             },
         },],
     });
@@ -123,6 +145,8 @@
         minSize: 150,
         autoScroll: true,
         rootVisible: false,
+        ddGroup: 'pfDDgroup',
+        enableDD: true,
         root:new Ext.tree.TreeNode({
             expanded:true,
             leaf:false,
@@ -161,11 +185,11 @@
         renderTo: document.body,
         tbar: [{
             xtype: 'buttongroup',
-            columns: 5,
+            columns: 7,
             items: [{
                 text: 'Download',
                 layout:'anchor',
-                anchor: '100% 33%',
+                anchor: '100% 25%',
                 handler: function(b, e) { 
                     window.open("session.py", "_top"); 
                     var record = new logging_store.recordType({
@@ -177,7 +201,7 @@
             },{
                 text: 'Save',
                 layout:'anchor',
-	            anchor: '100% 67%',
+	            anchor: '100% 50%',
 	            handler: function (b,e) { 
                     Ext.Msg.prompt("We have important work to do.", 
                     "Enter filename.", 
@@ -206,9 +230,9 @@
             },{
                 xtype: 'tbseparator'
             },{
-                text: 'Pastebin',
+                text: 'Paste',
                 layout:'anchor',
-                anchor: '100% 100%',
+                anchor: '100% 75%',
                 handler: function (b,e) { 
                     yt_rpc.ExtDirectREPL.paste_session({}, function(f, a) {
                         if (a.result['status'] == 'SUCCESS') {
@@ -223,6 +247,15 @@
                         }
                     }); 
                 }
+            },{
+                xtype: 'tbseparator'
+            },{
+                text: 'Help',
+                layout:'anchor',
+                anchor: '100% 100%',
+                handler: function (b,e) { 
+                        window.open("help.html", "_new");
+                }
             }]
         }]
     });


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Thu Mar 31 02:35:29 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Thu Mar 31 02:40:59 2011 -0400
@@ -71,6 +71,52 @@
                         handle_payload); 
                     }
                 },
+                /* Now the zoom buttons */
+                {
+                    xtype: 'button',
+                    text: 'Zoom In 10x',
+                    x: 410,
+                    y: 10,
+                    width: 100,
+                    handler: function(b,e) {
+                        yt_rpc.ExtDirectREPL.execute(
+                            {code:python_varname + '.zoom(10.0)'},
+                        handle_payload); 
+                    }
+                },{
+                    xtype: 'button',
+                    text: 'Zoom In 2x',
+                    x: 410,
+                    y: 35,
+                    width: 100,
+                    handler: function(b,e) {
+                        yt_rpc.ExtDirectREPL.execute(
+                            {code:python_varname + '.zoom(2.0)'},
+                        handle_payload); 
+                    }
+                },{
+                    xtype: 'button',
+                    text: 'Zoom Out 2x',
+                    x: 410,
+                    y: 60,
+                    width: 100,
+                    handler: function(b,e) {
+                        yt_rpc.ExtDirectREPL.execute(
+                            {code:python_varname + '.zoom(0.5)'},
+                        handle_payload); 
+                    }
+                },{
+                    xtype: 'button',
+                    text: 'Zoom Out 10x',
+                    x: 410,
+                    y: 85,
+                    width: 100,
+                    handler: function(b,e) {
+                        yt_rpc.ExtDirectREPL.execute(
+                            {code:python_varname + '.zoom(0.1)'},
+                        handle_payload); 
+                    }
+                }
             ]
         }
     );


http://bitbucket.org/yt_analysis/yt/changeset/3996e03eb9f1/
changeset:   r4048:3996e03eb9f1
branch:      yt
user:        Cameron Hummels
date:        2011-03-31 08:41:57
summary:     Cleaning up unfinished merge.
affected #:  1 file (22 bytes)

--- a/yt/gui/reason/html/js/functions.js	Thu Mar 31 02:40:59 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Thu Mar 31 02:41:57 2011 -0400
@@ -228,5 +228,3 @@
 }
 return projectionHandler;
 }
-=======
->>>>>>> other


http://bitbucket.org/yt_analysis/yt/changeset/a1d0b8766259/
changeset:   r4049:a1d0b8766259
branch:      yt
user:        MatthewTurk
date:        2011-03-31 09:04:16
summary:     Adding widgets works.  Also removed UUID from plot window tab name.
affected #:  3 files (774 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Thu Mar 31 02:41:57 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Thu Mar 31 03:04:16 2011 -0400
@@ -33,6 +33,7 @@
 
 from yt.funcs import *
 from yt.utilities.logger import ytLogger, ufstring
+from yt.utilities.definitions import inv_axis_names
 
 from .bottle_mods import preroute, BottleDirectRouter, notify_route, \
                          PayloadHandler, append_payloads
@@ -231,8 +232,11 @@
         _tpw.set_log(_tfield, True)
         add_widget('_tpw')
         """ % dict(pfname = pfname,
-                   c1 = center[0], c2 = center[1], c3 = center[2],
-                   axis = axis, field=field)
+                   c1 = float(center[0]),
+                   c2 = float(center[1]),
+                   c3 = float(center[2]),
+                   axis = inv_axis_names[axis],
+                   field=field)
         # There is a call to do this, but I have forgotten it ...
         funccall = "\n".join((line.strip() for line in funccall.splitlines()))
         rv = self.execute(funccall)


--- a/yt/gui/reason/html/js/functions.js	Thu Mar 31 02:41:57 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Thu Mar 31 03:04:16 2011 -0400
@@ -120,35 +120,35 @@
             items: [{
                 xtype:'textfield',
                 fieldLabel: 'Center X',
-                id: 'x_center',
+                id: 'slice_x_center',
                 value: '0.5',
                 width: 90,
                 allowBlank:false,
             },{
                 xtype:'textfield',
                 fieldLabel: 'Center Y',
-                id: 'y_center',
+                id: 'slice_y_center',
                 value: '0.5',
                 width: 90,
                 allowBlank:false,
             },{
                 xtype:'textfield',
                 fieldLabel: 'Center Z',
-                id: 'z_center',
+                id: 'slice_z_center',
                 value: '0.5',
                 width: 90,
                 allowBlank:false,
             },{
                 xtype:'combo',
                 fieldLabel: 'Axis',
-                id: 'axis',
+                id: 'slice_axis',
                 store:['X','Y','Z'],
                 width: 90,
                 allowBlank:false,
             },{
                 xtype:'combo',
                 fieldLabel: 'Field',
-                id: 'field',
+                id: 'slice_field',
                 store:['Density','Temperature','X Velocity','Y Velocity','Z Velocity'],
                 width: 90,
                 allowBlank:false,
@@ -156,7 +156,17 @@
             buttons: [
                 {
                     text: 'Slice',
-                    handler: function(b, e){Ext.Msg.alert('Slicing','Slicing it up!')}
+                    handler: function(b, e){
+                        var center = [Ext.get("slice_x_center").getValue(),
+                                      Ext.get("slice_y_center").getValue(),
+                                      Ext.get("slice_z_center").getValue()];
+                        var axis = Ext.get("slice_axis").getValue();
+                        var field = Ext.get("slice_field").getValue();
+                        yt_rpc.ExtDirectREPL.create_slice({
+                            pfname:node.attributes.objdata.varname,
+                            center: center, axis:axis, field:field},
+                          handle_result);
+                        }
                 },{
                     text: 'Cancel',
                     handler: function(b, e){Ext.Msg.alert('Cancelled','Slice cancelled.')}


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Thu Mar 31 02:41:57 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Thu Mar 31 03:04:16 2011 -0400
@@ -11,7 +11,7 @@
         {
             xtype: 'panel',
             id: "pw_" + this.id,
-            title: this.id,
+            title: "Plot Window",
             iconCls: 'graph',
             autoScroll: true,
             layout:'absolute',


http://bitbucket.org/yt_analysis/yt/changeset/88db4c7380a3/
changeset:   r4050:88db4c7380a3
branch:      yt
user:        Cameron Hummels
date:        2011-03-31 09:19:49
summary:     Removed alert windows after you cancel for finish filling out the slice/projection query box.  Replaced with win.close() so that the query boxes just go away.  No one wants to see that garbage.
affected #:  1 file (23 bytes)

--- a/yt/gui/reason/html/js/functions.js	Thu Mar 31 03:04:16 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Thu Mar 31 03:19:49 2011 -0400
@@ -166,10 +166,13 @@
                             pfname:node.attributes.objdata.varname,
                             center: center, axis:axis, field:field},
                           handle_result);
-                        }
+                        win.close();
+                    }
                 },{
                     text: 'Cancel',
-                    handler: function(b, e){Ext.Msg.alert('Cancelled','Slice cancelled.')}
+                    handler: function(b, e){
+                        win.close();
+                    }
                 }
             ]
         }]
@@ -226,10 +229,10 @@
             buttons: [
                 {
                     text: 'Project',
-                    handler: function(b, e){Ext.Msg.alert('Projection','Projecting!')}
+                    handler: function(b, e){win.close()}
                 },{
                     text: 'Cancel',
-                    handler: function(b, e){Ext.Msg.alert('Cancelled','Projection cancelled.')}
+                    handler: function(b, e){win.close()}
                 }
             ]
         }]


http://bitbucket.org/yt_analysis/yt/changeset/a0caf6e68ad7/
changeset:   r4051:a0caf6e68ad7
branch:      yt
user:        MatthewTurk
date:        2011-03-31 15:06:08
summary:     Adding licenses
affected #:  3 files (3.5 KB)

--- a/yt/gui/reason/html/js/functions.js	Thu Mar 31 03:04:16 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Thu Mar 31 09:06:08 2011 -0400
@@ -1,3 +1,34 @@
+/**********************************************************************
+Functions for Reason
+
+Author: Cameron Hummels <chummels at gmail.com>
+Affiliation: Columbia
+Author: Jeffrey S. Oishi <jsoishi at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Author: Britton Smith <brittonsmith at gmail.com>
+Affiliation: MSU
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: NSF / Columbia
+Homepage: http://yt.enzotools.org/
+License:
+  Copyright (C) 2011 Matthew Turk.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+***********************************************************************/
+
 function cell_finished(result, new_cell) {
     var new_log = false;
     Ext.each(result['payloads'], 


--- a/yt/gui/reason/html/js/reason.js	Thu Mar 31 03:04:16 2011 -0400
+++ b/yt/gui/reason/html/js/reason.js	Thu Mar 31 09:06:08 2011 -0400
@@ -1,3 +1,35 @@
+/**********************************************************************
+The main GUI facility for Reason
+
+Author: Cameron Hummels <chummels at gmail.com>
+Affiliation: Columbia
+Author: Jeffrey S. Oishi <jsoishi at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Author: Britton Smith <brittonsmith at gmail.com>
+Affiliation: MSU
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: NSF / Columbia
+Homepage: http://yt.enzotools.org/
+License:
+  Copyright (C) 2011 Matthew Turk.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+***********************************************************************/
+
+
 var viewport;
 var widget_types = {}
 var widget_list = {}


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Thu Mar 31 03:04:16 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Thu Mar 31 09:06:08 2011 -0400
@@ -1,3 +1,36 @@
+/**********************************************************************
+The Plot Window Widget
+
+Author: Cameron Hummels <chummels at gmail.com>
+Affiliation: Columbia
+Author: Jeffrey S. Oishi <jsoishi at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Author: Britton Smith <brittonsmith at gmail.com>
+Affiliation: MSU
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: NSF / Columbia
+Homepage: http://yt.enzotools.org/
+License:
+  Copyright (C) 2011 Matthew Turk.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+***********************************************************************/
+
+
+
 var WidgetPlotWindow = function(python_varname) {
     this.id = python_varname;
     this.print_python = function(b, e) {


http://bitbucket.org/yt_analysis/yt/changeset/c09052b5e40b/
changeset:   r4052:c09052b5e40b
branch:      yt
user:        Cameron Hummels
date:        2011-03-31 15:26:42
summary:     Merge.
affected #:  1 file (1.2 KB)

--- a/yt/gui/reason/html/js/functions.js	Thu Mar 31 03:19:49 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Thu Mar 31 09:26:42 2011 -0400
@@ -1,3 +1,34 @@
+/**********************************************************************
+Functions for Reason
+
+Author: Cameron Hummels <chummels at gmail.com>
+Affiliation: Columbia
+Author: Jeffrey S. Oishi <jsoishi at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Author: Britton Smith <brittonsmith at gmail.com>
+Affiliation: MSU
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: NSF / Columbia
+Homepage: http://yt.enzotools.org/
+License:
+  Copyright (C) 2011 Matthew Turk.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+***********************************************************************/
+
 function cell_finished(result, new_cell) {
     var new_log = false;
     Ext.each(result['payloads'], 


--- a/yt/gui/reason/html/js/reason.js	Thu Mar 31 03:19:49 2011 -0400
+++ b/yt/gui/reason/html/js/reason.js	Thu Mar 31 09:26:42 2011 -0400
@@ -1,3 +1,35 @@
+/**********************************************************************
+The main GUI facility for Reason
+
+Author: Cameron Hummels <chummels at gmail.com>
+Affiliation: Columbia
+Author: Jeffrey S. Oishi <jsoishi at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Author: Britton Smith <brittonsmith at gmail.com>
+Affiliation: MSU
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: NSF / Columbia
+Homepage: http://yt.enzotools.org/
+License:
+  Copyright (C) 2011 Matthew Turk.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+***********************************************************************/
+
+
 var viewport;
 var widget_types = {}
 var widget_list = {}


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Thu Mar 31 03:19:49 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Thu Mar 31 09:26:42 2011 -0400
@@ -1,3 +1,36 @@
+/**********************************************************************
+The Plot Window Widget
+
+Author: Cameron Hummels <chummels at gmail.com>
+Affiliation: Columbia
+Author: Jeffrey S. Oishi <jsoishi at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Author: Britton Smith <brittonsmith at gmail.com>
+Affiliation: MSU
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: NSF / Columbia
+Homepage: http://yt.enzotools.org/
+License:
+  Copyright (C) 2011 Matthew Turk.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+***********************************************************************/
+
+
+
 var WidgetPlotWindow = function(python_varname) {
     this.id = python_varname;
     this.print_python = function(b, e) {


http://bitbucket.org/yt_analysis/yt/changeset/eb72aa796cc8/
changeset:   r4053:eb72aa796cc8
branch:      yt
user:        Cameron Hummels
date:        2011-03-31 16:08:16
summary:     Moved zoom and pan icons to left side of image in plot window.
affected #:  1 file (9 bytes)

--- a/yt/gui/reason/html/js/widget_plotwindow.js	Thu Mar 31 09:26:42 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Thu Mar 31 10:08:16 2011 -0400
@@ -59,14 +59,14 @@
                         width: 400,
                         height: 400,
                     },
-                    x: 10,
+                    x: 100,
                     y: 10,
                     width: 400,
                     height: 400,
                 }, {
                     xtype:'button',
                     text: 'North',
-                    x: 205,
+                    x: 30,
                     y: 10,
                     handler: function(b,e) {
                         cc = python_varname + '.pan_rel((0.0, -0.5))'
@@ -76,8 +76,8 @@
                 }, {
                     xtype:'button',
                     text:'East',
-                    x : 410,
-                    y : 205,
+                    x : 50,
+                    y : 30,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.pan_rel((0.5, 0.0))'},
@@ -86,8 +86,8 @@
                 }, {
                     xtype:'button',
                     text: 'South',
-                    x: 205,
-                    y: 410,
+                    x: 30,
+                    y: 50,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.pan_rel((0.0, 0.5))'},
@@ -97,7 +97,7 @@
                     xtype: 'button',
                     text: 'West',
                     x: 10,
-                    y: 205,
+                    y: 30,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.pan_rel((-0.5, 0.0))'},
@@ -108,9 +108,9 @@
                 {
                     xtype: 'button',
                     text: 'Zoom In 10x',
-                    x: 410,
-                    y: 10,
-                    width: 100,
+                    x: 10,
+                    y: 110,
+                    width: 80,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.zoom(10.0)'},
@@ -119,9 +119,9 @@
                 },{
                     xtype: 'button',
                     text: 'Zoom In 2x',
-                    x: 410,
-                    y: 35,
-                    width: 100,
+                    x: 10,
+                    y: 135,
+                    width: 80,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.zoom(2.0)'},
@@ -130,9 +130,9 @@
                 },{
                     xtype: 'button',
                     text: 'Zoom Out 2x',
-                    x: 410,
-                    y: 60,
-                    width: 100,
+                    x: 10,
+                    y: 160,
+                    width: 80,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.zoom(0.5)'},
@@ -141,9 +141,9 @@
                 },{
                     xtype: 'button',
                     text: 'Zoom Out 10x',
-                    x: 410,
-                    y: 85,
-                    width: 100,
+                    x: 10,
+                    y: 185,
+                    width: 80,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.zoom(0.1)'},


http://bitbucket.org/yt_analysis/yt/changeset/4f9563f6271a/
changeset:   r4054:4f9563f6271a
branch:      yt
user:        Cameron Hummels
date:        2011-03-31 17:03:23
summary:     Changed panning buttons to be icon-based.  Also added second compass rose.  One for 10% pan, the other for 50% pan.
affected #:  18 files (32.5 KB)

Binary file yt/gui/reason/html/images/double_down.png has changed


Binary file yt/gui/reason/html/images/double_down_sm.png has changed


Binary file yt/gui/reason/html/images/double_left.png has changed


Binary file yt/gui/reason/html/images/double_left_sm.png has changed


Binary file yt/gui/reason/html/images/double_right.png has changed


Binary file yt/gui/reason/html/images/double_right_sm.png has changed


Binary file yt/gui/reason/html/images/double_up.png has changed


Binary file yt/gui/reason/html/images/double_up_sm.png has changed


Binary file yt/gui/reason/html/images/single_down.png has changed


Binary file yt/gui/reason/html/images/single_down_sm.png has changed


Binary file yt/gui/reason/html/images/single_left.png has changed


Binary file yt/gui/reason/html/images/single_left_sm.png has changed


Binary file yt/gui/reason/html/images/single_right.png has changed


Binary file yt/gui/reason/html/images/single_right_sm.png has changed


Binary file yt/gui/reason/html/images/single_up.png has changed


Binary file yt/gui/reason/html/images/single_up_sm.png has changed


--- a/yt/gui/reason/html/index.html	Thu Mar 31 10:08:16 2011 -0400
+++ b/yt/gui/reason/html/index.html	Thu Mar 31 11:03:23 2011 -0400
@@ -29,6 +29,30 @@
     .console { 
         background-image:url(images/console_tab.png) !important;
     }
+    .doubleleftarrow { 
+        background-image:url(images/double_left_sm.png) !important;
+    }
+    .singleleftarrow { 
+        background-image:url(images/single_left_sm.png) !important;
+    }
+    .doubleuparrow { 
+        background-image:url(images/double_up_sm.png) !important;
+    }
+    .singleuparrow { 
+        background-image:url(images/single_up_sm.png) !important;
+    }
+    .doublerightarrow { 
+        background-image:url(images/double_right_sm.png) !important;
+    }
+    .singlerightarrow { 
+        background-image:url(images/single_right_sm.png) !important;
+    }
+    .doubledownarrow { 
+        background-image:url(images/double_down_sm.png) !important;
+    }
+    .singledownarrow { 
+        background-image:url(images/single_down_sm.png) !important;
+    }
     #input_line {
         font-family: monospace;
     }


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Thu Mar 31 10:08:16 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Thu Mar 31 11:03:23 2011 -0400
@@ -63,11 +63,60 @@
                     y: 10,
                     width: 400,
                     height: 400,
+                }, 
+                /* the single buttons for 10% pan*/
+                {
+                    xtype:'button',
+                    iconCls: 'singleuparrow',
+                    //text: 'North',
+                    x: 40,
+                    y: 10,
+                    handler: function(b,e) {
+                        cc = python_varname + '.pan_rel((0.0, -0.1))'
+                        yt_rpc.ExtDirectREPL.execute(
+                        {code:cc}, handle_payload); 
+                    }
                 }, {
                     xtype:'button',
-                    text: 'North',
-                    x: 30,
-                    y: 10,
+                    iconCls: 'singlerightarrow',
+                    //text:'East',
+                    x : 60,
+                    y : 30,
+                    handler: function(b,e) {
+                        yt_rpc.ExtDirectREPL.execute(
+                            {code:python_varname + '.pan_rel((0.1, 0.0))'},
+                        handle_payload); 
+                    }
+                }, {
+                    xtype:'button',
+                    iconCls: 'singledownarrow',
+                    //text: 'South',
+                    x: 40,
+                    y: 50,
+                    handler: function(b,e) {
+                        yt_rpc.ExtDirectREPL.execute(
+                            {code:python_varname + '.pan_rel((0.0, 0.1))'},
+                        handle_payload); 
+                    }
+                }, {
+                    xtype: 'button',
+                    iconCls: 'singleleftarrow',
+                    //text: 'West',
+                    x: 20,
+                    y: 30,
+                    handler: function(b,e) {
+                        yt_rpc.ExtDirectREPL.execute(
+                            {code:python_varname + '.pan_rel((-0.1, 0.0))'},
+                        handle_payload); 
+                    }
+                }, 
+                /* the double buttons for 50% pan*/
+                {
+                    xtype:'button',
+                    iconCls: 'doubleuparrow',
+                    //text: 'North',
+                    x: 40,
+                    y: 80,
                     handler: function(b,e) {
                         cc = python_varname + '.pan_rel((0.0, -0.5))'
                         yt_rpc.ExtDirectREPL.execute(
@@ -75,9 +124,10 @@
                     }
                 }, {
                     xtype:'button',
-                    text:'East',
-                    x : 50,
-                    y : 30,
+                    iconCls: 'doublerightarrow',
+                    //text:'East',
+                    x : 60,
+                    y : 100,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.pan_rel((0.5, 0.0))'},
@@ -85,9 +135,10 @@
                     }
                 }, {
                     xtype:'button',
-                    text: 'South',
-                    x: 30,
-                    y: 50,
+                    iconCls: 'doubledownarrow',
+                    //text: 'South',
+                    x: 40,
+                    y: 120,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.pan_rel((0.0, 0.5))'},
@@ -95,9 +146,10 @@
                     }
                 }, {
                     xtype: 'button',
-                    text: 'West',
-                    x: 10,
-                    y: 30,
+                    iconCls: 'doubleleftarrow',
+                    //text: 'West',
+                    x: 20,
+                    y: 100,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.pan_rel((-0.5, 0.0))'},
@@ -109,7 +161,7 @@
                     xtype: 'button',
                     text: 'Zoom In 10x',
                     x: 10,
-                    y: 110,
+                    y: 160,
                     width: 80,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
@@ -120,7 +172,7 @@
                     xtype: 'button',
                     text: 'Zoom In 2x',
                     x: 10,
-                    y: 135,
+                    y: 185,
                     width: 80,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
@@ -131,7 +183,7 @@
                     xtype: 'button',
                     text: 'Zoom Out 2x',
                     x: 10,
-                    y: 160,
+                    y: 210,
                     width: 80,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
@@ -142,7 +194,7 @@
                     xtype: 'button',
                     text: 'Zoom Out 10x',
                     x: 10,
-                    y: 185,
+                    y: 235,
                     width: 80,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(


http://bitbucket.org/yt_analysis/yt/changeset/dbd5d952953d/
changeset:   r4055:dbd5d952953d
branch:      yt
user:        MatthewTurk
date:        2011-03-31 17:47:52
summary:     Adding data files to setup.py.  Note that python2.6 will incorrectly generate a
MANIFEST from these, but they will correctly install.
affected #:  2 files (369 bytes)

--- a/setup.py	Thu Mar 31 11:03:23 2011 -0400
+++ b/setup.py	Thu Mar 31 11:47:52 2011 -0400
@@ -1,4 +1,4 @@
-import os, os.path
+import os, os.path, glob
 import sys
 import time
 import subprocess
@@ -8,6 +8,11 @@
 from numpy.distutils.misc_util import appendpath
 from numpy.distutils import log
 
+DATA_FILES_HTML = glob.glob('yt/gui/reason/html/*.html')
+DATA_FILES_JS   = glob.glob('yt/gui/reason/html/js/*.js')
+DATA_FILES_PNG  = glob.glob('yt/gui/reason/html/images/*.png') \
+                + glob.glob('yt/gui/reason/html/images/*.ico')
+
 # Verify that we have Cython installed
 try:
     import Cython
@@ -73,7 +78,6 @@
 
 import setuptools
 
-DATA_FILES = []
 VERSION = "2.1dev"
 
 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
@@ -126,9 +130,10 @@
         url = "http://yt.enzotools.org/",
         license="GPL-3",
         configuration=configuration,
-        data_files=DATA_FILES,
         zip_safe=False,
-        package_data = {'': ['*.so'], }
+        data_files = [('yt/gui/reason/html/', DATA_FILES_HTML),
+                      ('yt/gui/reason/html/js/', DATA_FILES_JS),
+                      ('yt/gui/reason/html/images/', DATA_FILES_PNG)],
         )
     return
 


--- a/yt/gui/reason/setup.py	Thu Mar 31 11:03:23 2011 -0400
+++ b/yt/gui/reason/setup.py	Thu Mar 31 11:47:52 2011 -0400
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 import setuptools
-import os, sys, os.path
+import os, sys, os.path, glob
 
 def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration


http://bitbucket.org/yt_analysis/yt/changeset/aa1e6589aac1/
changeset:   r4056:aa1e6589aac1
branch:      yt
user:        Cameron Hummels
date:        2011-03-31 17:53:59
summary:     Merging at end of primary Reason GUI development.
affected #:  2 files (518 bytes)

--- a/doc/install_script.sh	Thu Mar 31 11:47:52 2011 -0400
+++ b/doc/install_script.sh	Thu Mar 31 11:53:59 2011 -0400
@@ -542,6 +542,20 @@
     touch ext-slate-110328/done
 fi
 
+if [ -e $HOME/.matplotlib/fontList.cache ] && \
+   ( grep -q python2.6 $HOME/.matplotlib/fontList.cache )
+then
+    echo "WARNING WARNING WARNING WARNING WARNING WARNING WARNING"
+    echo "*******************************************************"
+    echo
+    echo "  You likely need to remove your old fontList.cache!"
+    echo "  You can do this with this command:"
+    echo ""
+    echo "  rm $HOME/.matplotlib/fontList.cache"
+    echo
+    echo "*******************************************************"
+fi
+
 function print_afterword
 {
     echo


--- a/yt/data_objects/derived_quantities.py	Thu Mar 31 11:47:52 2011 -0400
+++ b/yt/data_objects/derived_quantities.py	Thu Mar 31 11:53:59 2011 -0400
@@ -35,6 +35,7 @@
 from yt.utilities.data_point_utilities import FindBindingEnergy
 from yt.utilities.parallel_tools.parallel_analysis_interface import \
     ParallelAnalysisInterface
+from yt.utilities.amr_utils import Octree
 
 __CUDA_BLOCK_SIZE = 256
 
@@ -272,15 +273,36 @@
 add_quantity("ParticleSpinParameter", function=_ParticleSpinParameter,
              combine_function=_combBaryonSpinParameter, n_ret=4)
     
-def _IsBound(data, truncate = True, include_thermal_energy = False):
-    """
-    This returns whether or not the object is gravitationally bound
+def _IsBound(data, truncate = True, include_thermal_energy = False,
+    treecode = True, opening_angle = 1.0, periodic_test = False):
+    r"""
+    This returns whether or not the object is gravitationally bound. If this
+    returns a value greater than one, it is bound, and otherwise not.
     
-    :param truncate: Should the calculation stop once the ratio of
-                     gravitational:kinetic is 1.0?
-    :param include_thermal_energy: Should we add the energy from ThermalEnergy
-                                   on to the kinetic energy to calculate 
-                                   binding energy?
+    Parameters
+    ----------
+    truncate : Bool
+        Should the calculation stop once the ratio of
+        gravitational:kinetic is 1.0?
+    include_thermal_energy : Bool
+        Should we add the energy from ThermalEnergy
+        on to the kinetic energy to calculate 
+        binding energy?
+    treecode : Bool
+        Whether or not to use the treecode.
+    opening_angle : Float 
+        The maximal angle a remote node may subtend in order
+        for the treecode method of mass conglomeration may be
+        used to calculate the potential between masses.
+    periodic_test : Bool 
+        Used for testing the periodic adjustment machinery
+        of this derived quantity. 
+
+    Examples
+    --------
+    >>> sp.quantities["IsBound"](truncate=False,
+    ... include_thermal_energy=True, treecode=False, opening_angle=2.0)
+    0.32493
     """
     # Kinetic energy
     bv_x,bv_y,bv_z = data.quantities["BulkVelocity"]()
@@ -294,19 +316,120 @@
     if (include_thermal_energy):
         thermal = (data["ThermalEnergy"] * data["CellMass"]).sum()
         kinetic += thermal
+    if periodic_test:
+        kinetic = na.ones_like(kinetic)
     # Gravitational potential energy
     # We only divide once here because we have velocity in cgs, but radius is
     # in code.
     G = 6.67e-8 / data.convert("cm") # cm^3 g^-1 s^-2
+    # Check for periodicity of the clump.
+    two_root = 2. / na.array(data.pf.domain_dimensions)
+    domain_period = data.pf.domain_right_edge - data.pf.domain_left_edge
+    periodic = na.array([0., 0., 0.])
+    for i,dim in enumerate(["x", "y", "z"]):
+        sorted = data[dim][data[dim].argsort()]
+        # If two adjacent values are different by (more than) two root grid
+        # cells, I think it's reasonable to assume that the clump wraps around.
+        diff = sorted[1:] - sorted[0:-1]
+        if (diff >= two_root[i]).any():
+            mylog.info("Adjusting clump for periodic boundaries in dim %s" % dim)
+            # We will record the distance of the larger of the two values that
+            # define the gap from the right boundary, which we'll use for the
+            # periodic adjustment later.
+            sel = (diff >= two_root[i])
+            index = na.min(na.nonzero(sel))
+            # The last addition term below ensures that the data makes a full
+            # wrap-around.
+            periodic[i] = data.pf.domain_right_edge[i] - sorted[index + 1] + \
+                two_root[i] / 2.
+    # This dict won't make a copy of the data, but it will make a copy to 
+    # change if needed in the periodic section immediately below.
+    local_data = {}
+    for label in ["x", "y", "z", "CellMass"]:
+        local_data[label] = data[label]
+    if periodic.any():
+        # Adjust local_data to re-center the clump to remove the periodicity
+        # by the gap calculated above.
+        for i,dim in enumerate(["x", "y", "z"]):
+            if not periodic[i]: continue
+            local_data[dim] = data[dim].copy()
+            local_data[dim] += periodic[i]
+            local_data[dim] %= domain_period[i]
+    if periodic_test:
+        local_data["CellMass"] = na.ones_like(local_data["CellMass"])
     import time
     t1 = time.time()
-    try:
-        pot = G*_cudaIsBound(data, truncate, kinetic/G)
-    except (ImportError, AssertionError):
-        pot = G*FindBindingEnergy(data["CellMass"],
-                                  data['x'],data['y'],data['z'],
-                                  truncate, kinetic/G)
-        mylog.info("Boundedness check took %0.3e seconds", time.time()-t1)
+    if treecode:
+        # Calculate the binding energy using the treecode method.
+        # Faster but less accurate.
+        # The octree doesn't like uneven root grids, so we will make it cubical.
+        root_dx = 1./na.array(data.pf.domain_dimensions).astype('float64')
+        left = min([na.amin(local_data['x']), na.amin(local_data['y']),
+            na.amin(local_data['z'])])
+        right = max([na.amax(local_data['x']), na.amax(local_data['y']),
+            na.amax(local_data['z'])])
+        cover_min = na.array([left, left, left])
+        cover_max = na.array([right, right, right])
+        # Fix the coverage to match to root grid cell left 
+        # edges for making indexes.
+        cover_min = cover_min - cover_min % root_dx
+        cover_max = cover_max - cover_max % root_dx
+        cover_imin = (cover_min * na.array(data.pf.domain_dimensions)).astype('int64')
+        cover_imax = (cover_max * na.array(data.pf.domain_dimensions) + 1).astype('int64')
+        cover_ActiveDimensions = cover_imax - cover_imin
+        # Create the octree with these dimensions.
+        # One value (mass) with incremental=True.
+        octree = Octree(cover_ActiveDimensions, 1, True)
+        #print 'here', cover_ActiveDimensions
+        # Now discover what levels this data comes from, not assuming
+        # symmetry.
+        dxes = na.unique(data['dx']) # unique returns a sorted array,
+        dyes = na.unique(data['dy']) # so these will all have the same
+        dzes = na.unique(data['dx']) # order.
+        # We only need one dim to figure out levels, we'll use x.
+        dx = 1./data.pf.domain_dimensions[0]
+        levels = na.floor(dx / dxes / data.pf.refine_by).astype('int')
+        lsort = levels.argsort()
+        levels = levels[lsort]
+        dxes = dxes[lsort]
+        dyes = dyes[lsort]
+        dzes = dzes[lsort]
+        # This step adds massless cells for all the levels we need in order
+        # to fully populate all the parent-child cells needed.
+        for L in range(min(data.pf.h.max_level+1, na.amax(levels)+1)):
+            ActiveDimensions = cover_ActiveDimensions * 2**L
+            i, j, k = na.indices(ActiveDimensions)
+            i = i.flatten()
+            j = j.flatten()
+            k = k.flatten()
+            octree.add_array_to_tree(L, i, j, k,
+                na.array([na.zeros_like(i)], order='F', dtype='float64'),
+                na.zeros_like(i).astype('float64'))
+        # Now we add actual data to the octree.
+        for L, dx, dy, dz in zip(levels, dxes, dyes, dzes):
+            mylog.info("Adding data to Octree for level %d" % L)
+            sel = (data["dx"] == dx)
+            thisx = (local_data["x"][sel] / dx).astype('int64') - cover_imin[0] * 2**L
+            thisy = (local_data["y"][sel] / dy).astype('int64') - cover_imin[1] * 2**L
+            thisz = (local_data["z"][sel] / dz).astype('int64') - cover_imin[2] * 2**L
+            vals = na.array([local_data["CellMass"][sel]], order='F')
+            octree.add_array_to_tree(L, thisx, thisy, thisz, vals,
+               na.ones_like(thisx).astype('float64'), treecode = 1)
+        # Now we calculate the binding energy using a treecode.
+        octree.finalize(treecode = 1)
+        mylog.info("Using a treecode to find gravitational energy for %d cells." % local_data['x'].size)
+        pot = G*octree.find_binding_energy(truncate, kinetic/G, root_dx,
+            opening_angle)
+        #octree.print_all_nodes()
+    else:
+        try:
+            pot = G*_cudaIsBound(local_data, truncate, kinetic/G)
+        except (ImportError, AssertionError):
+            pot = G*FindBindingEnergy(local_data["CellMass"],
+                                local_data['x'],local_data['y'],local_data['z'],
+                                truncate, kinetic/G)
+    mylog.info("Boundedness check took %0.3e seconds", time.time()-t1)
+    del local_data
     return [(pot / kinetic)]
 def _combIsBound(data, bound):
     return bound


--- a/yt/frontends/enzo/data_structures.py	Thu Mar 31 11:47:52 2011 -0400
+++ b/yt/frontends/enzo/data_structures.py	Thu Mar 31 11:53:59 2011 -0400
@@ -38,6 +38,7 @@
 from itertools import izip
 
 from yt.funcs import *
+from yt.config import ytcfg
 from yt.data_objects.grid_patch import \
     AMRGridPatch
 from yt.data_objects.hierarchy import \
@@ -137,7 +138,7 @@
         self.hierarchy_filename = os.path.abspath(
             "%s.hierarchy" % (pf.parameter_filename))
         harray_fn = self.hierarchy_filename[:-9] + "harrays"
-        if os.path.exists(harray_fn):
+        if ytcfg.getboolean("yt","serialize") and os.path.exists(harray_fn):
             try:
                 harray_fp = h5py.File(harray_fn)
                 self.num_grids = harray_fp["/Level"].len()
@@ -286,6 +287,7 @@
     _bn = "%s.cpu%%04i"
     def _parse_binary_hierarchy(self):
         mylog.info("Getting the binary hierarchy")
+        if not ytcfg.getboolean("yt","serialize"): return False
         try:
             f = h5py.File(self.hierarchy_filename[:-9] + "harrays")
         except h5py.h5.H5Error:


--- a/yt/utilities/_amr_utils/Octree.pyx	Thu Mar 31 11:47:52 2011 -0400
+++ b/yt/utilities/_amr_utils/Octree.pyx	Thu Mar 31 11:53:59 2011 -0400
@@ -32,24 +32,39 @@
 
 from stdlib cimport malloc, free, abs
 
+import sys, time
+
 cdef extern from "stdlib.h":
     # NOTE that size_t might not be int
     void *alloca(int)
 
+cdef extern from "math.h":
+    double sqrt(double x)
+
+cdef inline np.float64_t f64max(np.float64_t f0, np.float64_t f1):
+    if f0 > f1: return f0
+    return f1
+
 cdef struct OctreeNode:
     np.float64_t *val
     np.float64_t weight_val
     np.int64_t pos[3]
     int level
     int nvals
+    int max_level # The maximum level under this node with mass.
     OctreeNode *children[2][2][2]
+    OctreeNode *parent
+    OctreeNode *next
+    OctreeNode *up_next
 
 cdef void OTN_add_value(OctreeNode *self,
-        np.float64_t *val, np.float64_t weight_val):
+        np.float64_t *val, np.float64_t weight_val, int level, int treecode):
     cdef int i
     for i in range(self.nvals):
         self.val[i] += val[i]
     self.weight_val += weight_val
+    if treecode and val[0] > 0.:
+        self.max_level = imax(self.max_level, level)
 
 cdef void OTN_refine(OctreeNode *self, int incremental = 0):
     cdef int i, j, k, i1, j1
@@ -65,14 +80,14 @@
                 self.children[i][j][k] = OTN_initialize(
                             npos,
                             self.nvals, self.val, self.weight_val,
-                            self.level + 1)
+                            self.level + 1, self)
     if incremental: return
     for i in range(self.nvals): self.val[i] = 0.0
     self.weight_val = 0.0
 
 cdef OctreeNode *OTN_initialize(np.int64_t pos[3], int nvals,
                         np.float64_t *val, np.float64_t weight_val,
-                        int level):
+                        int level, OctreeNode *parent):
     cdef OctreeNode *node
     cdef int i, j, k
     node = <OctreeNode *> malloc(sizeof(OctreeNode))
@@ -80,6 +95,10 @@
     node.pos[1] = pos[1]
     node.pos[2] = pos[2]
     node.nvals = nvals
+    node.parent = parent
+    node.next = NULL
+    node.up_next = NULL
+    node.max_level = 0
     node.val = <np.float64_t *> malloc(
                 nvals * sizeof(np.float64_t))
     for i in range(nvals):
@@ -108,6 +127,12 @@
     cdef OctreeNode ****root_nodes
     cdef np.int64_t top_grid_dims[3]
     cdef int incremental
+    # Below is for the treecode.
+    cdef np.float64_t opening_angle
+    # We'll store dist here so it doesn't have to be calculated twice.
+    cdef np.float64_t dist
+    cdef np.float64_t root_dx[3]
+    cdef OctreeNode *last_node
 
     def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims,
                   int nvals, int incremental = False):
@@ -144,19 +169,19 @@
                 for k in range(top_grid_dims[2]):
                     pos[2] = k
                     self.root_nodes[i][j][k] = OTN_initialize(
-                        pos, nvals, vals, weight_val, 0)
+                        pos, nvals, vals, weight_val, 0, NULL)
 
     cdef void add_to_position(self,
                  int level, np.int64_t pos[3],
                  np.float64_t *val,
-                 np.float64_t weight_val):
+                 np.float64_t weight_val, treecode):
         cdef int i, j, k, L
         cdef OctreeNode *node
         node = self.find_on_root_level(pos, level)
         cdef np.int64_t fac
         for L in range(level):
             if self.incremental:
-                OTN_add_value(node, val, weight_val)
+                OTN_add_value(node, val, weight_val, level, treecode)
             if node.children[0][0][0] == NULL:
                 OTN_refine(node, self.incremental)
             # Maybe we should use bitwise operators?
@@ -165,7 +190,7 @@
             j = (pos[1] >= fac*(2*node.pos[1]+1))
             k = (pos[2] >= fac*(2*node.pos[2]+1))
             node = node.children[i][j][k]
-        OTN_add_value(node, val, weight_val)
+        OTN_add_value(node, val, weight_val, level, treecode)
             
     cdef OctreeNode *find_on_root_level(self, np.int64_t pos[3], int level):
         # We need this because the root level won't just have four children
@@ -184,7 +209,8 @@
             np.ndarray[np.int64_t, ndim=1] pys,
             np.ndarray[np.int64_t, ndim=1] pzs,
             np.ndarray[np.float64_t, ndim=2] pvals,
-            np.ndarray[np.float64_t, ndim=1] pweight_vals):
+            np.ndarray[np.float64_t, ndim=1] pweight_vals,
+            int treecode = 0):
         cdef int np = pxs.shape[0]
         cdef int p
         cdef cnp.float64_t *vals
@@ -195,7 +221,7 @@
             pos[0] = pxs[p]
             pos[1] = pys[p]
             pos[2] = pzs[p]
-            self.add_to_position(level, pos, vals, pweight_vals[p])
+            self.add_to_position(level, pos, vals, pweight_vals[p], treecode)
 
     def add_grid_to_tree(self, int level,
                          np.ndarray[np.int64_t, ndim=1] start_index,
@@ -275,6 +301,306 @@
                             level, curpos + added, pdata, vdata, wdata)
         return added
 
+    @cython.cdivision(True)
+    cdef np.float64_t fbe_node_separation(self, OctreeNode *node1, OctreeNode *node2):
+        # Find the distance between the two nodes. To match FindBindingEnergy
+        # in data_point_utilities.c, we'll do this in code units.
+        cdef np.float64_t dx1, dx2, p1, p2, dist
+        cdef int i
+        dist = 0.0
+        for i in range(3):
+            # Discover the appropriate dx for each node/dim.
+            dx1 = self.root_dx[i] / (<np.float64_t> self.po2[node1.level])
+            dx2 = self.root_dx[i] / (<np.float64_t> self.po2[node2.level])
+            # The added term is to re-cell center the data.
+            p1 = (<np.float64_t> node1.pos[i]) * dx1 + dx1/2.
+            p2 = (<np.float64_t> node2.pos[i]) * dx2 + dx2/2.
+            dist += (p1 - p2) * (p1 - p2)
+        dist = sqrt(dist)
+        return dist
+    
+    @cython.cdivision(True)
+    cdef np.float64_t fbe_opening_angle(self, OctreeNode *node1,
+            OctreeNode *node2):
+        # Calculate the opening angle of node2 upon the center of node1.
+        # In order to keep things simple, we will not assume symmetry in all
+        # three directions of the octree, and we'll use the largest dimension
+        # if the tree is not symmetric. This is not strictly the opening angle
+        # the purest sense, but it's slightly more accurate, so it's OK.
+        # This is done in code units to match the distance calculation.
+        cdef np.float64_t d2, dx2, dist
+        cdef np.int64_t n2
+        cdef int i
+        d2 = 0.0
+        if node1 is node2: return 100000.0 # Just some large number.
+        if self.top_grid_dims[1] == self.top_grid_dims[0] and \
+                self.top_grid_dims[2] == self.top_grid_dims[0]:
+            # Symmetric
+            n2 = self.po2[node2.level] * self.top_grid_dims[0]
+            d2 = 1. / (<np.float64_t> n2)
+        else:
+            # Not symmetric
+            for i in range(3):
+                n2 = self.po2[node2.level] * self.top_grid_dims[i]
+                dx2 = 1. / (<np.float64_t> n2)
+                d2 = f64max(d2, dx2)
+        # Now calculate the opening angle.
+        dist = self.fbe_node_separation(node1, node2)
+        self.dist = dist
+        return d2 / dist
+
+    cdef void set_next(self, OctreeNode *node, int treecode):
+        # This sets up the linked list, pointing node.next to the next node
+        # in the iteration order.
+        cdef int i, j, k
+        if treecode and node.val[0] is not 0.:
+            # In a treecode, we only make a new next link if this node has mass.
+            self.last_node.next = node
+            self.last_node = node
+        elif treecode and node.val[0] is 0.:
+            # No mass means it's children have no mass, no need to dig an
+            # further.
+            return
+        else:
+            # We're not doing the treecode, but we still want a linked list,
+            # we don't care about val[0] necessarily.
+            self.last_node.next = node
+            self.last_node = node
+        if node.children[0][0][0] is NULL: return
+        for i in range(2):
+            for j in range(2):
+                for k in range(2):
+                    self.set_next(node.children[i][j][k], treecode)
+        return
+
+    cdef void set_up_next(self, OctreeNode *node):
+        # This sets up a second linked list, pointing node.up_next to the next
+        # node in the list that is at the same or lower (coarser) level than
+        # this node. This is useful in the treecode for skipping over nodes
+        # that don't need to be inspected.
+        cdef int i, j, k
+        cdef OctreeNode *initial_next
+        cdef OctreeNode *temp_next
+        initial_next = node.next
+        temp_next = node.next
+        if node.next is NULL: return
+        while temp_next.level > node.level:
+            temp_next = temp_next.next
+            if temp_next is NULL: break
+        node.up_next = temp_next
+        self.set_up_next(initial_next)
+
+    def finalize(self, int treecode = 0):
+        # Set up the linked list for the nodes.
+        # Set treecode = 1 if nodes with no mass are to be skipped in the
+        # list.
+        cdef int i, j, k, sum, top_grid_total, ii, jj, kk
+        cdef OctreeNode *this_node
+        self.last_node = self.root_nodes[0][0][0]
+        for i in range(self.top_grid_dims[0]):
+            for j in range(self.top_grid_dims[1]):
+                for k in range(self.top_grid_dims[2]):
+                    self.set_next(self.root_nodes[i][j][k], treecode)
+        # Now we want to link to the next node in the list that is
+        # on a level the same or lower (coarser) than us. This will be used
+        # during a treecode search so we can skip higher-level (finer) nodes.
+        sum = 1
+        top_grid_total = self.top_grid_dims[0] * self.top_grid_dims[1] * \
+            self.top_grid_dims[2]
+        for i in range(self.top_grid_dims[0]):
+            for j in range(self.top_grid_dims[1]):
+                for k in range(self.top_grid_dims[2]):
+                    self.set_up_next(self.root_nodes[i][j][k])
+                    # Point the root_nodes.up_next to the next root_node in the
+                    # list, except for the last one which stays pointing to NULL.
+                    if sum < top_grid_total - 1:
+                        ii = i
+                        jj = j
+                        kk = (k + 1) % self.top_grid_dims[2]
+                        if kk < k:
+                            jj = (j + 1) % self.top_grid_dims[1]
+                            if jj < j:
+                                ii = (i + 1) % self.top_grid_dims[0]
+                        self.root_nodes[i][j][k].up_next = \
+                            self.root_nodes[ii][jj][kk]
+                    sum += 1
+
+    @cython.cdivision(True)
+    cdef np.float64_t fbe_main(self, np.float64_t potential, int truncate,
+            np.float64_t kinetic):
+        # The work is done here. Starting at the top of the linked list of
+        # nodes, 
+        cdef np.float64_t angle, dist
+        cdef OctreeNode *this_node
+        cdef OctreeNode *pair_node
+        cdef int pair_count
+        cdef int to_break
+        to_break = 0
+        this_node = self.root_nodes[0][0][0]
+        while this_node is not NULL:
+            # Iterate down the list to a node that either has no children and
+            # is at the max_level of the tree, or to a node where
+            # all of its children are massless. The second case is when data
+            # from a level that isn't the deepest has been added to the tree.
+            while this_node.max_level is not this_node.level:
+                this_node = this_node.next
+                # In case we reach the end of the list...
+                if this_node is NULL: break
+            if this_node is NULL: break
+            if truncate and potential > kinetic:
+                print 'Truncating...'
+                break
+            pair_node = this_node.next
+            while pair_node is not NULL:
+                # If pair_node is massless, we can jump to up_next, because
+                # nothing pair_node contains will have mass either.
+                # I think that this should primarily happen for root_nodes
+                # created for padding to make the region cubical.
+                if pair_node.val[0] is 0.0:
+                    pair_node = pair_node.up_next
+                    continue
+                # If pair_node is a childless node, or is a coarser node with
+                # no children, we can calculate the pot
+                # right now, and get a new pair_node.
+                if pair_node.max_level is pair_node.level:
+                    dist = self.fbe_node_separation(this_node, pair_node)
+                    potential += this_node.val[0] * pair_node.val[0] / dist
+                    if truncate and potential > kinetic: break
+                    pair_node = pair_node.next
+                    continue
+                # Next, if the opening angle to pair_node is small enough,
+                # calculate the potential and get a new pair_node using
+                # up_next because we don't need to look at pair_node's children.
+                angle = self.fbe_opening_angle(this_node, pair_node)
+                if angle < self.opening_angle:
+                    # self.dist was just set in fbe_opening_angle, so we
+                    # can use it here without re-calculating it for these two
+                    # nodes.
+                    potential += this_node.val[0] * pair_node.val[0] / self.dist
+                    if truncate and potential > kinetic: break
+                    # We can skip all the nodes that are contained within 
+                    # pair_node, saving time walking the linked list.
+                    pair_node = pair_node.up_next
+                # If we've gotten this far, pair_node has children, but it's
+                # too coarse, so we simply dig deeper using .next.
+                else:
+                    pair_node = pair_node.next
+            # We've exhausted the pair_nodes.
+            # Now we find a new this_node in the list, and do more searches
+            # over pair_node.
+            this_node = this_node.next
+        return potential
+
+    @cython.boundscheck(False)
+    @cython.wraparound(False)
+    def find_binding_energy(self, int truncate, np.float64_t kinetic,
+        np.ndarray[np.float64_t, ndim=1] root_dx, float opening_angle = 1.0):
+        r"""Find the binding energy of an ensemble of data points using the
+        treecode method.
+        
+        Note: The first entry of the vals array MUST be Mass. Any other
+        values will be ignored, including the weight array.
+        """
+        # The real work is done in fbe_main(), this just sets things up
+        # and returns the potential.
+        cdef int i, j, k, sum
+        cdef np.float64_t potential
+        potential = 0.0
+        self.opening_angle = opening_angle
+        for i in range(3):
+            self.root_dx[i] = root_dx[i]
+        potential = self.fbe_main(potential, truncate, kinetic)
+        return potential
+
+    cdef int node_ID(self, OctreeNode *node):
+        # Returns an unique ID for this node based on its position and level.
+        cdef int ID, i, offset, root
+        cdef np.int64_t this_grid_dims[3]
+        offset = 0
+        root = 1
+        for i in range(3):
+            root *= self.top_grid_dims[i]
+            this_grid_dims[i] = self.top_grid_dims[i] * 2**node.level
+        for i in range(node.level):
+            offset += root * 2**(3 * i)
+        ID = offset + (node.pos[0] + this_grid_dims[0] * (node.pos[1] + \
+            this_grid_dims[1] * node.pos[2]))
+        return ID
+
+    cdef int node_ID_on_level(self, OctreeNode *node):
+        # Returns the node ID on node.level for this node.
+        cdef int ID, i
+        cdef np.int64_t this_grid_dims[3]
+        for i in range(3):
+            this_grid_dims[i] = self.top_grid_dims[i] * 2**node.level
+        ID = node.pos[0] + this_grid_dims[0] * (node.pos[1] + \
+            this_grid_dims[1] * node.pos[2])
+        return ID
+
+    cdef void print_node_info(self, OctreeNode *node):
+        cdef int i, j, k
+        line = "%d\t" % self.node_ID(node)
+        if node.next is not NULL:
+            line += "%d\t" % self.node_ID(node.next)
+        else: line += "-1\t"
+        if node.up_next is not NULL:
+            line += "%d\t" % self.node_ID(node.up_next)
+        else: line += "-1\t"
+        line += "%d\t%d\t%d\t%d\t" % (node.level,node.pos[0],node.pos[1],node.pos[2])
+        for i in range(node.nvals):
+            line += "%1.5e\t" % node.val[i]
+        line += "%f\t" % node.weight_val
+        line += "%s\t%s\t" % (node.children[0][0][0] is not NULL, node.parent is not NULL)
+        if node.children[0][0][0] is not NULL:
+            nline = ""
+            for i in range(2):
+                for j in range(2):
+                    for k in range(2):
+                        nline += "%d," % self.node_ID(node.children[i][j][k])
+            line += nline
+        print line
+        return
+
+    cdef void iterate_print_nodes(self, OctreeNode *node):
+        cdef int i, j, k
+        self.print_node_info(node)
+        if node.children[0][0][0] is NULL:
+            return
+        for i in range(2):
+            for j in range(2):
+                for k in range(2):
+                    self.iterate_print_nodes(node.children[i][j][k])
+        return
+
+    def print_all_nodes(self):
+        r"""
+        Prints out information about all the nodes in the octree.
+        
+        Parameters
+        ----------
+        None.
+        
+        Examples
+        --------
+        >>> octree.print_all_nodes()
+        (many lines of data)
+        """
+        cdef int i, j, k
+        sys.stdout.flush()
+        sys.stderr.flush()
+        line = "ID\tnext\tup_n\tlevel\tx\ty\tz\t"
+        for i in range(self.nvals):
+            line += "val%d\t\t" % i
+        line += "weight\t\tchild?\tparent?\tchildren"
+        print line
+        for i in range(self.top_grid_dims[0]):
+            for j in range(self.top_grid_dims[1]):
+                for k in range(self.top_grid_dims[2]):
+                    self.iterate_print_nodes(self.root_nodes[i][j][k])
+        sys.stdout.flush()
+        sys.stderr.flush()
+        return
+
     def __dealloc__(self):
         cdef int i, j, k
         for i in range(self.top_grid_dims[0]):


--- a/yt/utilities/command_line.py	Thu Mar 31 11:47:52 2011 -0400
+++ b/yt/utilities/command_line.py	Thu Mar 31 11:53:59 2011 -0400
@@ -324,7 +324,7 @@
             print
             print "This installation CAN be automatically updated."
             if opts.update_source:  
-                _vcs_updater[vc_type](path)
+                _update_hg(path)
             print "Updated successfully."
         elif opts.update_source:
             print


--- a/yt/utilities/data_point_utilities.c	Thu Mar 31 11:47:52 2011 -0400
+++ b/yt/utilities/data_point_utilities.c	Thu Mar 31 11:53:59 2011 -0400
@@ -1604,7 +1604,6 @@
     Py_DECREF(x);
     Py_DECREF(y);
     Py_DECREF(z);
-
     PyObject *status = PyFloat_FromDouble(total_potential);
     return status;

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list