[yt-svn] commit/yt: xarthisius: Merged in ngoldbaum/yt (pull request #1719)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Aug 27 09:16:26 PDT 2015


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/89dd8b5534fe/
Changeset:   89dd8b5534fe
Branch:      yt
User:        xarthisius
Date:        2015-08-27 16:16:11+00:00
Summary:     Merged in ngoldbaum/yt (pull request #1719)

Remove reason, make mapserver work with regular source distributions
Affected #:  138 files

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db MANIFEST.in
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,5 +1,8 @@
 include distribute_setup.py README* CREDITS COPYING.txt CITATION requirements.txt optional-requirements.txt
-recursive-include yt/gui/reason/html *.html *.png *.ico *.js *.gif *.css
+include yt/visualization/mapserver/html/map_index.html
+include yt/visualization/mapserver/html/leaflet/*.css
+include yt/visualization/mapserver/html/leaflet/*.js
+include yt/visualization/mapserver/html/leaflet/images/*.png
 recursive-include yt *.py *.pyx *.pxd *.h README* *.txt LICENSE* *.cu
 recursive-include doc *.rst *.txt *.py *.ipynb *.png *.jpg *.css *.inc *.html
 recursive-include doc *.h *.c *.sh *.svgz *.pdf *.svg *.pyx
@@ -10,5 +13,4 @@
 recursive-include yt/analysis_modules/halo_finding/rockstar *.py *.pyx
 prune yt/frontends/_skeleton
 prune tests
-graft yt/gui/reason/html/resources
 exclude clean.sh .hgchurn

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db doc/install_script.sh
--- a/doc/install_script.sh
+++ b/doc/install_script.sh
@@ -644,7 +644,6 @@
 echo '609cc82586fabecb25f25ecb410f2938e01d21cde85dd3f8824fe55c6edde9ecf3b7609195473d3fa05a16b9b121464f5414db1a0187103b78ea6edfa71684a7  Python-3.4.3.tgz' > Python-3.4.3.tgz.sha512
 echo '276bd9c061ec9a27d478b33078a86f93164ee2da72210e12e2c9da71dcffeb64767e4460b93f257302b09328eda8655e93c4b9ae85e74472869afbeae35ca71e  blas.tar.gz' > blas.tar.gz.sha512
 echo '00ace5438cfa0c577e5f578d8a808613187eff5217c35164ffe044fbafdfec9e98f4192c02a7d67e01e5a5ccced630583ad1003c37697219b0f147343a3fdd12  bzip2-1.0.6.tar.gz' > bzip2-1.0.6.tar.gz.sha512
-echo 'a296dfcaef7e853e58eed4e24b37c4fa29cfc6ac688def048480f4bb384b9e37ca447faf96eec7b378fd764ba291713f03ac464581d62275e28eb2ec99110ab6  reason-js-20120623.zip' > reason-js-20120623.zip.sha512
 echo '609a68a3675087e0cc95268574f31e104549daa48efe15a25a33b8e269a93b4bd160f4c3e8178dca9c950ef5ca514b039d6fd1b45db6af57f25342464d0429ce  freetype-2.4.12.tar.gz' > freetype-2.4.12.tar.gz.sha512
 echo '4a83f9ae1855a7fad90133b327d426201c8ccfd2e7fbe9f39b2d61a2eee2f3ebe2ea02cf80f3d4e1ad659f8e790c173df8cc99b87d0b7ce63d34aa88cfdc7939  h5py-2.5.0.tar.gz' > h5py-2.5.0.tar.gz.sha512
 echo '4073fba510ccadaba41db0939f909613c9cb52ba8fb6c1062fc9118edc601394c75e102310be1af4077d07c9b327e6bbb1a6359939a7268dc140382d0c1e0199  hdf5-1.8.14.tar.gz' > hdf5-1.8.14.tar.gz.sha512
@@ -686,7 +685,6 @@
 get_ytproject $IPYTHON.tar.gz
 get_ytproject $H5PY.tar.gz
 get_ytproject $CYTHON.tar.gz
-get_ytproject reason-js-20120623.zip
 get_ytproject $NOSE.tar.gz
 get_ytproject $PYTHON_HGLIB.tar.gz
 get_ytproject $SYMPY.tar.gz

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db scripts/pyro_queue.py
--- a/scripts/pyro_queue.py
+++ /dev/null
@@ -1,31 +0,0 @@
-from yt.config import ytcfg;ytcfg["yt","__withinreason"]="True"
-import os
-import Pyro4
-import uuid
-
-from yt.mods import *
-from yt.utilities.parallel_tools.parallel_analysis_interface import \
-    _get_comm
-from yt.gui.reason.pyro_queue import \
-    PyroQueueRoot, \
-    PyroQueueNonRoot
-
-comm = _get_comm(())
-my_rank = comm.comm.rank
-
-if my_rank == 0:
-    my_q = PyroQueueRoot(comm)
-    Pyro4.config.HMAC_KEY = uuid.uuid4().hex
-    key_file = 'reason.key'
-    fd = os.open(key_file, os.O_CREAT, 0600)
-    os.close(fd)
-    out_file = file(key_file, 'w')
-    out_file.write("HMAC KEY: %s\n" % Pyro4.config.HMAC_KEY)
-    out_file.close()
-    mylog.info('See %s for HMAC key.', key_file)
-    Pyro4.Daemon.serveSimple(
-        {my_q: "yt.executor"},
-        ns=False, verbose=True)
-else:
-    my_q = PyroQueueNonRoot(comm)
-    my_q.run()

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db setup.py
--- a/setup.py
+++ b/setup.py
@@ -22,31 +22,19 @@
 from distutils.core import Command
 from distutils.spawn import find_executable
 
-REASON_FILES = []
-REASON_DIRS = [
+MAPSERVER_FILES = []
+MAPSERVER_DIRS = [
     "",
-    "resources",
-    "resources/ux",
-    "resources/images",
-    "resources/css",
-    "resources/css/images",
-    "app",
-    "app/store",
-    "app/store/widgets",
-    "app/view",
-    "app/view/widgets",
-    "app/model",
-    "app/controller",
-    "app/controller/widgets",
-    "app/templates",
+    "leaflet",
+    "leaflet/images"
 ]
 
-for subdir in REASON_DIRS:
-    dir_name = os.path.join("yt", "gui", "reason", "html", subdir)
+for subdir in MAPSERVER_DIRS:
+    dir_name = os.path.join("yt", "visualization", "mapserver", "html", subdir)
     files = []
     for ext in ["js", "html", "css", "png", "ico", "gif"]:
         files += glob.glob("%s/*.%s" % (dir_name, ext))
-    REASON_FILES.append((dir_name, files))
+    MAPSERVER_FILES.append((dir_name, files))
 
 # Verify that we have Cython installed
 REQ_CYTHON = '0.22'
@@ -218,7 +206,7 @@
         license="BSD",
         configuration=configuration,
         zip_safe=False,
-        data_files=REASON_FILES,
+        data_files=MAPSERVER_FILES,
         cmdclass={'build_py': my_build_py, 'build_src': my_build_src},
     )
     return

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db yt/config.py
--- a/yt/config.py
+++ b/yt/config.py
@@ -30,7 +30,6 @@
     loglevel = '20',
     inline = 'False',
     numthreads = '-1',
-    __withinreason = 'False',
     __withintesting = 'False',
     __parallel = 'False',
     __global_parallel_rank = '0',

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -367,9 +367,6 @@
        "__IPYTHON__" in dir(builtins) or \
        ytcfg.getboolean("yt", "__withintesting"):
         return DummyProgressBar()
-    elif ytcfg.getboolean("yt", "__withinreason"):
-        from yt.gui.reason.extdirect_repl import ExtProgressBar
-        return ExtProgressBar(title, maxval)
     elif ytcfg.getboolean("yt", "__parallel"):
         return ParallelProgressBar(title, maxval)
     widgets = [ title,

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db yt/gui/reason/basic_repl.py
--- a/yt/gui/reason/basic_repl.py
+++ /dev/null
@@ -1,144 +0,0 @@
-"""
-A read-eval-print-loop.  This code was released in the CherryPy project
-initially, but has been heavily modified and again re-released in compliance
-with the terms of its original license.
-
-
-
-"""
-
-#-----------------------------------------------------------------------------
-# Copyright (c) 2013, yt Development Team.
-#
-# Distributed under the terms of the Modified BSD License.
-#
-# The full license is in the file COPYING.txt, distributed with this software.
-#-----------------------------------------------------------------------------
-
-import codeop
-import inspect
-import re
-import json
-import sys
-import traceback
-from yt.extern.six.moves import StringIO
-
-class ProgrammaticREPL(object):
-    stopped = False
-    debug = False
-    def __init__(self, locals=None):
-        self.executed_cell_texts = []
-        self.locals = {}
-        if locals:
-            self.locals.update(locals)
-        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)."""
-        if line == "help":
-            return "Type help(object) for help about object."
-        if line == "help()":
-            return "You cannot call help() without an argument."
-        
-        self.buffer.append(line)
-        source = "\n".join(self.buffer)
-        
-        try:
-            code = codeop.compile_command(source, "<HTTP input>", 'single')
-        except (OverflowError, SyntaxError, ValueError):
-            self.buffer = []
-            return traceback.format_exc()
-        
-        if code is None:
-            # More lines needed.
-            return None
-        
-        self.buffer = []
-        return self.execute(code)
-    
-    def execute(self, code):
-        """Execute the given code in self.locals and return any stdout/sterr."""
-        out = StringIO()
-        oldout = sys.stdout
-        olderr = sys.stderr
-        sys.stdout = sys.stderr = out
-        try:
-            try:
-                exec code in self.locals
-            except:
-                result = traceback.format_exc()
-            else:
-                result = out.getvalue()
-        finally:
-            sys.stdout = oldout
-            sys.stderr = olderr
-        out.close()
-        return result
-    
-    def dir(self, line):
-        """Examine a partial line and provide attr list of final expr."""
-        line = re.split(r"\s", line)[-1].strip()
-        # Support lines like "thing.attr" as "thing.", because the browser
-        # may not finish calculating the partial line until after the user
-        # has clicked on a few more keys.
-        line = ".".join(line.split(".")[:-1])
-        try:
-            result = eval("dir(%s)" % line, {}, self.locals)
-        except:
-            return []
-        return result
-    
-    def doc(self, line):
-        """Examine a partial line and provide sig+doc of final expr."""
-        line = re.split(r"\s", line)[-1].strip()
-        # Support lines like "func(text" as "func(", because the browser
-        # may not finish calculating the partial line until after the user
-        # has clicked on a few more keys.
-        line = "(".join(line.split("(")[:-1])
-        try:
-            result = eval(line, {}, self.locals)
-            try:
-                if isinstance(result, type):
-                    func = result.__init__
-                else:
-                    func = result
-                args, varargs, varkw, defaults = inspect.getargspec(func)
-            except TypeError:
-                if callable(result):
-                    doc = getattr(result, "__doc__", "") or ""
-                    return "%s\n\n%s" % (line, doc)
-                return None
-        except:
-            return None
-        
-        if args and args[0] == 'self':
-            args.pop(0)
-        missing = object()
-        defaults = defaults or []
-        defaults = ([missing] * (len(args) - len(defaults))) + list(defaults)
-        arglist = []
-        for a, d in zip(args, defaults):
-            if d is missing:
-                arglist.append(a)
-            else:
-                arglist.append("%s=%s" % (a, d))
-        if varargs:
-            arglist.append("*%s" % varargs)
-        if varkw:
-            arglist.append("**%s" % varkw)
-        doc = getattr(result, "__doc__", "") or ""
-        return "%s(%s)\n%s" % (line, ", ".join(arglist), doc)

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db yt/gui/reason/bottle_mods.py
--- a/yt/gui/reason/bottle_mods.py
+++ /dev/null
@@ -1,297 +0,0 @@
-"""
-Modifications and extensions to Bottle, to make it slightly more useful for
-yt's purposes
-
-
-
-"""
-from __future__ import print_function
-from __future__ import absolute_import
-
-#-----------------------------------------------------------------------------
-# Copyright (c) 2013, yt Development Team.
-#
-# Distributed under the terms of the Modified BSD License.
-#
-# The full license is in the file COPYING.txt, distributed with this software.
-#-----------------------------------------------------------------------------
-
-import uuid
-import json
-import logging, threading
-import sys
-from yt.extern.six.moves import urllib
-import numpy as np
-
-from yt.extern.bottle import \
-    server_names, debug, route, run, request, ServerAdapter, response
-from .extdirect_router import DirectRouter, DirectProviderDefinition
-from yt.utilities.logger import ytLogger as mylog
-from yt.funcs import *
-
-route_functions = {}
-route_watchers = []
-payloads = []
-
-def preroute(future_route, *args, **kwargs):
-    def router(func):
-        route_functions[future_route] = (args, kwargs, func)
-        return func
-    return router
-
-def notify_route(watcher):
-    route_watchers.append(watcher)
-
-class BinaryDelivery(object):
-    delivered = False
-    payload = ""
-    def __init__(self, payload, name = ""):
-        self.name = name
-        self.payload = payload
-        #sys.__stderr__.write("CREATING A BINARY PAYLOAD %s (%s)\n" % (
-        #    self.name, len(self.payload)))
-
-    def get(self):
-        # We set our 
-        #sys.__stderr__.write("REQUESTED A BINARY PAYLOAD %s (%s)\n" % (
-        #    self.name, len(self.payload)))
-        p = self.payload
-        if p == "":
-            response.status = 404
-            return
-        self.payload = ""
-        return p
-
-class PayloadHandler(object):
-    _shared_state = {}
-    payloads = None
-    binary_payloads = None
-    recorded_payloads = None
-    multicast_ids = None
-    multicast_payloads = None
-    lock = None
-    record = False
-    event = None
-    count = 0
-    debug = False
-    _prefix = ""
-
-    def __new__(cls, *p, **k):
-        self = object.__new__(cls, *p, **k)
-        self.__dict__ = cls._shared_state
-        return self
-
-    def __init__(self):
-        if self.payloads is None: self.payloads = []
-        if self.lock is None: self.lock = threading.Lock()
-        if self.recorded_payloads is None: self.recorded_payloads = []
-        if self.event is None: self.event = threading.Event()
-        if self.multicast_payloads is None: self.multicast_payloads = {}
-        if self.multicast_ids is None: self.multicast_ids = {}
-        if self.binary_payloads is None: self.binary_payloads = []
-
-    def deliver_payloads(self):
-        with self.lock:
-            payloads = self.payloads
-            if self.record:
-                self.recorded_payloads += self.payloads
-            if self.debug:
-                sys.__stderr__.write("**** Delivering %s payloads\n" % (len(payloads)))
-                for p in payloads:
-                    sys.__stderr__.write("****    %s\n" % p['type'])
-            self.payloads = []
-            self.event.clear()
-            try:
-                self.deliver_multicast()
-            except Exception as exc:
-                sys.__stderr__.write("%s" % exc)
-        return payloads
-
-    def add_payload(self, to_add):
-        with self.lock:
-            if "binary" in to_add:
-                self._add_binary_payload(to_add)
-            self.payloads.append(to_add)
-            # Does this next part need to be in the lock?
-            if to_add.get("widget_id", None) in self.multicast_ids:
-                self.multicast_payloads[to_add["widget_id"]] = to_add
-            self.count += 1
-            self.event.set()
-            if self.debug:
-                sys.__stderr__.write("**** Adding payload of type %s\n" % (to_add['type']))
-
-    def _add_binary_payload(self, bp):  
-        # This shouldn't be called by anybody other than add_payload.
-        bkeys = ensure_list(bp['binary'])
-        bp['binary'] = []
-        for bkey in bkeys:
-            bdata = bp.pop(bkey) # Get the binary data
-            if isinstance(bdata, np.ndarray):
-                bdata = bdata.tostring()
-            bpserver = BinaryDelivery(bdata, bkey)
-            self.binary_payloads.append(bpserver)
-            uu = uuid.uuid4().hex
-            bp['binary'].append((bkey, uu))
-            route("%s/%s" % (self._prefix, uu))(bpserver.get)
-            if self.debug:
-                sys.__stderr__.write(
-                    "**** Adding binary payload (%s) to %s\n" % (bkey, uu))
-
-    def replay_payloads(self):
-        return self.recorded_payloads
-
-    def widget_payload(self, widget, data):
-        data['type'] = 'widget_payload'
-        data['widget_id'] = widget._ext_widget_id
-        self.add_payload(data)
-
-    def deliver_multicast(self):
-        for widget_id in self.multicast_payloads:
-            if widget_id not in self.multicast_payloads: continue
-            server_id, session_token = self.multicast_ids[widget_id]
-            # Now we execute a post to the correct location
-            data = urllib.parse.urlencode({
-                'payload_session_id': server_id,
-                'payload_session_token': session_token,
-                'payload_data': self.multicast_payloads[widget_id],
-                'payload_metadata': {}
-            })
-            urllib.request.urlopen("http://localhost:8080/UpdatePayload", data = data)
-
-class YTRocketServer(ServerAdapter):
-    server_info = {} # Hack to get back at instance vars
-    def run(self, handler):
-        from yt.extern.rocket import Rocket
-        server = Rocket((self.host, self.port), 'wsgi', { 'wsgi_app' : handler })
-        self.server_info[id(self)] = server
-        server.start()
-
-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 = self.api_url
-        super(BottleDirectRouter, self).__init__(*args, **kwargs)
-        self.__name__ = str(self.my_name)
-        route_functions[future_route] = ((), {'method':("POST", "GET")}, self)
-        preroute("/resources/ext-%s-api.js" % self.api_url, method="GET")(self._myapi)
-        notify_route(self)
-
-    def _myapi(self):
-        dpd = DirectProviderDefinition(self, self.api_url, ns="yt_rpc")
-        source = "Ext.Direct.addProvider(%s);" % json.dumps(dpd._config())
-        response.headers['Content-Type'] = "text/javascript"
-        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, port=9099,
-                         repl = None, token = None):
-    if pre_routed == None: pre_routed = route_functions
-    debug(mode=True)
-    if token is None: 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)
-        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
-    repl._global_token = token
-    repl.activate()
-    repl.execution_thread.wait()
-    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
-        # server starts up.  I got this from some recipe whose URL escapes me.
-        # Thank you, to whoever wrote it!
-        def local_browse():
-            """Start a browser after waiting for half a second."""
-            import webbrowser, threading
-            def _local_browse():
-                webbrowser.open('http://localhost:%s/%s/' % (port, token))
-            thread = threading.Timer(0.5, _local_browse)
-            thread.start()
-        local_browse()
-    try:
-        import yt.extern.rocket as rocket
-        server_type = YTRocketServer
-        log = logging.getLogger('Rocket')
-        log.setLevel(logging.WARNING)
-        kwargs = {'timeout': 600, 'max_threads': 2}
-        if repl is not None:
-            repl.server = YTRocketServer.server_info
-    except ImportError:
-        server_type = server_names.get("wsgiref")
-        kwargs = {}
-    server = server_type(host='localhost', port=port, **kwargs)
-    mylog.info("Starting up the server.")
-    run(server=server)
-
-class MethodLock(object):
-    _shared_state = {}
-    locks = None
-
-    def __new__(cls, *p, **k):
-        self = object.__new__(cls, *p, **k)
-        self.__dict__ = cls._shared_state
-        return self
-
-    def __init__(self):
-        if self.locks is None: self.locks = {}
-
-    def __call__(self, func):
-        if str(func) not in self.locks:
-            self.locks[str(func)] = threading.Lock()
-        @wraps(func)
-        def locker(*args, **kwargs):
-            print("Acquiring lock on %s" % (str(func)))
-            with self.locks[str(func)]:
-                rv = func(*args, **kwargs)
-            print("Regained lock on %s" % (str(func)))
-            return rv
-        return locker
-
-lockit = MethodLock()
-

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db yt/gui/reason/extdirect_repl.py
--- a/yt/gui/reason/extdirect_repl.py
+++ /dev/null
@@ -1,499 +0,0 @@
-"""
-A read-eval-print-loop that is served up through Bottle and accepts its
-commands through ExtDirect calls
-
-
-
-"""
-from __future__ import print_function
-
-#-----------------------------------------------------------------------------
-# Copyright (c) 2013, yt Development Team.
-#
-# Distributed under the terms of the Modified BSD License.
-#
-# The full license is in the file COPYING.txt, distributed with this software.
-#-----------------------------------------------------------------------------
-
-from yt.extern.six.moves import urllib
-import json
-import os
-import stat
-from cStringIO import StringIO
-import logging
-import uuid
-import numpy as np
-import time
-import pprint
-import traceback
-import tempfile
-import base64
-import imp
-import threading
-import Queue
-import zipfile
-try:
-    import Pyro4
-except ImportError:
-    pass
-
-from yt.funcs import *
-from yt.utilities.logger import ytLogger, ufstring
-from yt.visualization.image_writer import apply_colormap
-from yt.visualization.api import Streamlines
-from .widget_store import WidgetStore
-
-from .bottle_mods import preroute, BottleDirectRouter, notify_route, \
-                         PayloadHandler, lockit
-from yt.extern.bottle import response, request, route, static_file
-from .utils import get_list_of_datasets
-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', 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 = ''
-
-local_dir = os.path.dirname(__file__)
-
-class ExecutionThread(threading.Thread):
-    def __init__(self, repl):
-        self.repl = repl
-        self.payload_handler = PayloadHandler()
-        self.queue = Queue.Queue()
-        threading.Thread.__init__(self)
-        self.daemon = True
-
-    def heartbeat(self):
-        return
-
-    def run(self):
-        while 1:
-            #print "Checking for a queue ..."
-            try:
-                task = self.queue.get(True, 1)
-            except Queue.Empty:
-                if self.repl.stopped: return
-                continue
-            print("Received the task", task)
-            if task['type'] != 'code':
-                raise NotImplementedError
-            print(task)
-            self.execute_one(task['code'], task['hide'], task['result_id'])
-            self.queue.task_done()
-
-    def wait(self):
-        self.queue.join()
-
-    def execute_one(self, code, hide, result_id):
-        self.repl.executed_cell_texts.append(code)
-        result = ProgrammaticREPL.execute(self.repl, code)
-        if self.repl.debug:
-            print("==================== Cell Execution ====================")
-            print(code)
-            print("====================                ====================")
-            print(result)
-            print("========================================================")
-        self.payload_handler.add_payload(
-            {'type': 'cell',
-             'output': result,
-             'input': highlighter(code),
-             'image_data': '',
-             'result_id': result_id,
-             'hide': hide,
-             'raw_input': code},
-            )
-        objs = get_list_of_datasets()
-        self.payload_handler.add_payload(
-            {'type': 'dataobjects',
-             'objs': objs})
-
-class PyroExecutionThread(ExecutionThread):
-    def __init__(self, repl):
-        ExecutionThread.__init__(self, repl)
-        hmac_key = raw_input("HMAC_KEY? ").strip()
-        uri = raw_input("URI? ").strip()
-        Pyro4.config.HMAC_KEY = hmac_key
-        self.executor = Pyro4.Proxy(uri)
-
-    def execute_one(self, code, hide, result_id):
-        self.repl.executed_cell_texts.append(code)
-        print(code)
-        result = self.executor.execute(code)
-        if not hide:
-            self.repl.payload_handler.add_payload(
-                {'type': 'cell',
-                 'output': result,
-                 'input': highlighter(code),
-                 'result_id': result_id,
-                 'raw_input': code},
-                )
-        ph = self.executor.deliver()
-        for p in ph:
-            self.repl.payload_handler.add_payload(p)
-
-    def heartbeat(self):
-        ph = self.executor.deliver()
-        for p in ph:
-            self.repl.payload_handler.add_payload(p)
-
-def reason_pylab():
-    from .utils import deliver_image
-    def _canvas_deliver(canvas):
-        tf = tempfile.TemporaryFile()
-        canvas.print_png(tf)
-        tf.seek(0)
-        img_data = base64.b64encode(tf.read())
-        tf.close()
-        deliver_image(img_data)
-    def reason_draw_if_interactive():
-        if matplotlib.is_interactive():
-            figManager =  Gcf.get_active()
-            if figManager is not None:
-                _canvas_deliver(figManager.canvas)
-    def reason_show(mainloop = True):
-        # We ignore mainloop here
-        for manager in Gcf.get_all_fig_managers():
-            _canvas_deliver(manager.canvas)
-    # Matplotlib has very nice backend overriding.
-    # We should really use that.  This is just a hack.
-    import matplotlib
-    matplotlib.use("agg") # Hotfix for when we import pylab below
-    new_agg = imp.new_module("reason_agg")
-    import matplotlib.backends.backend_agg as bagg
-    new_agg.__dict__.update(bagg.__dict__)
-    new_agg.__dict__.update(
-        {'show': reason_show,
-         'draw_if_interactive': reason_draw_if_interactive})
-    sys.modules["reason_agg"] = new_agg
-    bagg.draw_if_interactive = reason_draw_if_interactive
-    from matplotlib._pylab_helpers import Gcf
-    matplotlib.rcParams["backend"] = "module://reason_agg"
-    import pylab
-    pylab.switch_backend("module://reason_agg")
-
-_startup_template = r"""\
-import pylab
-from yt.mods import *
-from yt.gui.reason.utils import load_script, deliver_image
-from yt.gui.reason.widget_store import WidgetStore
-from yt.data_objects.static_output import _cached_datasets
-
-pylab.ion()
-data_objects = []
-widget_store = WidgetStore()
-"""
-
-class ExtDirectREPL(ProgrammaticREPL, BottleDirectRouter):
-    _skip_expose = ('index')
-    my_name = "ExtDirectREPL"
-    timeout = 660 # a minute longer than the rocket server timeout
-    server = None
-    _heartbeat_timer = None
-
-    def __init__(self, reasonjs_path, locals=None,
-                 use_pyro=False):
-        # First we do the standard initialization
-        self.reasonjs_file = zipfile.ZipFile(reasonjs_path, 'r')
-        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"),
-                              _help_html = ("/help.html", "GET"),
-                              _myapi = ("/ext-repl-api.js", "GET"),
-                              _session_py = ("/session.py", "GET"),
-                              _highlighter_css = ("/highlighter.css", "GET"),
-                              _reasonjs = ("/reason-js/:path#.+#", "GET"),
-                              _app = ("/reason/:path#.+#", "GET"),
-                              )
-        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.payload_handler = PayloadHandler()
-        if use_pyro:
-            self.execution_thread = PyroExecutionThread(self)
-        else:
-            self.execution_thread = ExecutionThread(self)
-        # We pass in a reference to ourself
-        self.execute(_startup_template)
-        self.widget_store = WidgetStore(self)
-        # Now we load up all the yt.mods stuff, but only after we've finished
-        # setting up.
-        reason_pylab()
-
-    def activate(self):
-        self.payload_handler._prefix = self._global_token
-        self._setup_logging_handlers()
-        # Setup our heartbeat
-        self.last_heartbeat = time.time()
-        self._check_heartbeat()
-        self.execute("widget_store._global_token = '%s'" % self._global_token)
-        self.execution_thread.start()
-
-    def exception_handler(self, exc):
-        result = {'type': 'cell',
-                  'input': 'ERROR HANDLING IN REASON',
-                  'result_id': None,
-                  'output': traceback.format_exc()}
-        return result
-
-    def _setup_logging_handlers(self):
-        handler = PayloadLoggingHandler()
-        formatter = logging.Formatter(ufstring)
-        handler.setFormatter(formatter)
-        ytLogger.addHandler(handler)
-
-    def index(self):
-        root = os.path.join(local_dir, "html")
-        return static_file("index.html", root)
-
-    def heartbeat(self):
-        self.last_heartbeat = time.time()
-        if self.debug: print("### Heartbeat ... started: %s" % (time.ctime()))
-        for i in range(30):
-            # Check for stop
-            if self.debug: print("    ###")
-            if self.stopped: return {'type':'shutdown'} # No race condition
-            if self.payload_handler.event.wait(1): # One second timeout
-                if self.debug: print("    ### Delivering payloads")
-                rv = self.payload_handler.deliver_payloads()
-                if self.debug: print("    ### Got back, returning")
-                return rv
-            self.execution_thread.heartbeat()
-        if self.debug: print("### Heartbeat ... finished: %s" % (time.ctime()))
-        return []
-
-    def _check_heartbeat(self):
-        if self.server is not None:
-            if not all((s._monitor.is_alive() for s in self.server.values())):
-                self.shutdown()
-                return
-        if time.time() - self.last_heartbeat > self.timeout:
-            print("Shutting down after a timeout of %s" % (self.timeout))
-            #sys.exit(0)
-            # Still can't shut down yet, because bottle doesn't return the
-            # server instance by default.
-            self.shutdown()
-            return
-        if self._heartbeat_timer is not None: return
-        self._heartbeat_timer = threading.Timer(10, self._check_heartbeat)
-        self._heartbeat_timer.start()
-
-    def shutdown(self):
-        if self.server is None:
-            return
-        self._heartbeat_timer.cancel()
-        self.stopped = True
-        self.payload_handler.event.set()
-        for v in self.server.values():
-            v.stop()
-        for t in threading.enumerate():
-            print("Found a living thread:", t)
-
-    def _help_html(self):
-        root = os.path.join(local_dir, "html")
-        return static_file("help.html", root)
-
-    def _reasonjs(self, path):
-        pp = os.path.join("reason-js", path)
-        try:
-            f = self.reasonjs_file.open(pp)
-        except KeyError:
-            response.status = 404
-            return
-        if path[-4:].lower() in (".png", ".gif", ".jpg"):
-            response.headers['Content-Type'] = "image/%s" % (path[-3:].lower())
-        elif path[-4:].lower() == ".css":
-            response.headers['Content-Type'] = "text/css"
-        elif path[-3:].lower() == ".js":
-            response.headers['Content-Type'] = "text/javascript"
-        return f.read()
-
-    def _app(self, path):
-        root = os.path.join(local_dir, "html")
-        return static_file(path, root)
-
-    def _highlighter_css(self):
-        response.headers['Content-Type'] = "text/css"
-        return highlighter_css
-
-    def execute(self, code, hide = False, result_id = None):
-        task = {'type': 'code',
-                'code': code,
-                'hide': hide,
-                'result_id': result_id,
-                }
-        self.execution_thread.queue.put(task)
-        return dict(status = True)
-
-    def get_history(self):
-        return self.executed_cell_texts[:]
-
-    @lockit
-    def save_session(self, 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!'}
-        try:
-            f = open(filename, 'w')
-            f.write("\n######\n".join(self.executed_cell_texts))
-            f.close()
-        except IOError as xxx_todo_changeme:
-            (errno, strerror) = xxx_todo_changeme.args
-            return {'status': 'FAIL', 'filename': filename,
-                    'error': strerror}
-        except:
-            return {'status': 'FAIL', 'filename': filename,
-                    'error': 'Unexpected error.'}
-        return {'status': 'SUCCESS', 'filename': filename}
-
-    @lockit
-    def paste_session(self):
-        import xmlrpclib
-        p = xmlrpclib.ServerProxy(
-            "http://paste.yt-project.org/xmlrpc/",
-            allow_none=True)
-        cs = StringIO()
-        cs.write("\n######\n".join(self.executed_cell_texts))
-        cs = cs.getvalue()
-        ret = p.pastes.newPaste('python', cs, None, '', '', True)
-        site = "http://paste.yt-project.org/show/%s" % ret
-        return {'status': 'SUCCESS', 'site': site}
-
-    @lockit
-    def paste_text(self, to_paste):
-        import xmlrpclib
-        p = xmlrpclib.ServerProxy(
-            "http://paste.yt-project.org/xmlrpc/",
-            allow_none=True)
-        ret = p.pastes.newPaste('python', to_paste, None, '', '', True)
-        site = "http://paste.yt-project.org/show/%s" % ret
-        return {'status': 'SUCCESS', 'site': site}
-
-    _api_key = 'f62d550859558f28c4c214136bc797c7'
-    def upload_image(self, image_data, caption):
-        if not image_data.startswith("data:"): return {'uploaded':False}
-        prefix = "data:image/png;base64,"
-        image_data = image_data[len(prefix):]
-        parameters = {'key':self._api_key, 'image':image_data, type:'base64',
-                      'caption': caption, 'title': "Uploaded Image from reason"}
-        data = urllib.parse.urlencode(parameters)
-        req = urllib.request.Request('http://api.imgur.com/2/upload.json', data)
-        try:
-            response = urllib.request.urlopen(req).read()
-        except urllib.error.HTTPError as e:
-            print("ERROR", e)
-            return {'uploaded':False}
-        rv = json.loads(response)
-        rv['uploaded'] = True
-        pprint.pprint(rv)
-        return rv
-
-    @lockit
-    def _session_py(self):
-        cs = StringIO()
-        cs.write("\n######\n".join(self.executed_cell_texts))
-        cs.seek(0)
-        response.headers["content-disposition"] = "attachment;"
-        return cs
-
-    @lockit
-    def load(self, base_dir, filename):
-        pp = os.path.join(base_dir, filename)
-        funccall = "datasets.append(load('%s'))" % pp
-        self.execute(funccall)
-        return []
-
-    def file_listing(self, base_dir, sub_dir):
-        if base_dir == "":
-            cur_dir = os.getcwd()
-        elif sub_dir == "":
-            cur_dir = base_dir
-        else:
-            cur_dir = os.path.join(base_dir, sub_dir)
-            cur_dir = os.path.abspath(cur_dir)
-        if not os.path.isdir(cur_dir):
-            return {'change':False}
-        fns = os.listdir(cur_dir)
-        results = [("..", 0, "directory")]
-        for fn in sorted((os.path.join(cur_dir, f) for f in fns)):
-            if not os.access(fn, os.R_OK): continue
-            if os.path.isfile(fn):
-                size = os.path.getsize(fn)
-                t = "file"
-            else:
-                size = 0
-                t = "directory"
-            results.append((os.path.basename(fn), size, t))
-        return dict(objs = results, cur_dir=cur_dir)
-
-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':'logentry',
-             'log_entry':msg})
-
-if os.path.exists(os.path.expanduser("~/.yt/favicon.ico")):
-    ico = os.path.expanduser("~/.yt/")
-else:
-    ico = os.path.join(local_dir, "html", "resources", "images")
- at route("/favicon.ico", method="GET")
-def _favicon_ico():
-    print(ico)
-    return static_file("favicon.ico", ico)
-
-class ExtProgressBar(object):
-    def __init__(self, title, maxval):
-        self.title = title
-        self.maxval = maxval
-        self.last = 0
-        # Now we add a payload for the progress bar
-        self.payload_handler = PayloadHandler()
-        self.payload_handler.add_payload(
-            {'type': 'widget',
-             'widget_type': 'progressbar',
-             'varname': 'pbar_top',
-             'data': {'title':title}
-            })
-
-    def update(self, val):
-        # An update is only meaningful if it's on the order of 1/100 or greater
-
-        if (val - self.last) > (self.maxval / 100.0):
-            self.last = val
-            self.payload_handler.add_payload(
-                {'type': 'widget_payload',
-                 'widget_id': 'pbar_top',
-                 'value': float(val) / self.maxval})
-
-    def finish(self):
-        self.payload_handler.add_payload(
-            {'type': 'widget_payload',
-             'widget_id': 'pbar_top',
-             'value': -1})

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db yt/gui/reason/extdirect_router.py
--- a/yt/gui/reason/extdirect_router.py
+++ /dev/null
@@ -1,196 +0,0 @@
-"""
-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.
-"""
-
-#-----------------------------------------------------------------------------
-# Copyright (c) 2013, yt Development Team.
-#
-# Distributed under the terms of the Modified BSD License.
-#
-# The full license is in the file COPYING.txt, distributed with this software.
-#-----------------------------------------------------------------------------
-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.
-    """
-    exception_handler = None
-    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
-        try:
-            result = _targetfn(**data)
-        except Exception as e:
-            if self.exception_handler is not None:
-                result = self.exception_handler(e)
-            else:
-                raise e
-
-        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()
-
-
-
-

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db yt/gui/reason/html/app.js
--- a/yt/gui/reason/html/app.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/**********************************************************************
-The main GUI facility for Reason
-
-Copyright (c) 2013, yt Development Team.
-
-Distributed under the terms of the Modified BSD License.
-
-The full license is in the file COPYING.txt, distributed with this software.
-***********************************************************************/
-
-Ext.Loader.setConfig({enabled:true});
-
-var reason, rdebug, examine;
-
-Ext.application({
-    requires: ['Ext.container.Viewport',
-               'Reason.view.LoggingGrid',
-               'Reason.view.DataObjectTree',
-               'Reason.controller.widgets.SampleWidget',
-               ],
-    name: 'Reason',
-
-    appFolder: 'reason/app',
-
-    launch: function() {
-        reason = this;
-        this.numberOfRequests = 0;
-        rdebug = this.getController("Debugger");
-        this.server = this.getController("ServerCommunication");
-        Ext.create('Ext.container.Viewport', {
-            layout: 'border',
-            items: [
-                {
-                    xtype: 'logginggrid',
-                    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',
-               }, {
-                    id: 'west-panel',
-                    region: 'west',
-                    split: true,
-                    width: 200,
-                    minSize: 175,
-                    maxSize: 400,
-                    collapsible: true,
-                    layout: {
-                        type: 'vbox',
-                        pack: 'start',
-                        align: 'stretch',
-                    },
-                    items: [
-                        { xtype: 'dataobjecttree', 
-                          flex: 1.0},
-                        { xtype: 'panel',
-                          tpl: 'Pending Requests: {0}',
-                          data: [0],
-                          height: 30,
-                          id: 'pending',
-                        }
-                    ],
-              }, {
-                xtype: 'tabpanel',
-                region: 'center',
-                id: 'center-panel',
-                activeTab: 0,
-                dockedItems: [ {
-                    dock: 'top',
-                    xtype: 'mainmenu',
-                } ],
-                items: [
-                { xtype: 'panel',
-                  title: 'Welcome!',
-                  closeable: true,
-                  autoLoad: 'help.html',
-                },
-                { xtype: 'ytnotebook' },
-                ]
-              }
-            ]
-        });
-        this.pending = Ext.getCmp("pending");
-        this.fireEvent("allowinput");
-    },
-    controllers : [
-        'Logging',
-        'DataObjects',
-        'Notebook',
-        'ServerCommunication',
-        'WidgetDirector',
-        'MenuActions',
-        'Debugger',
-        'FileOpen',
-    ],
-
-});

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db yt/gui/reason/html/app/controller/DataObjects.js
--- a/yt/gui/reason/html/app/controller/DataObjects.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/**********************************************************************
-Data object controller for Reason
-
-#-----------------------------------------------------------------------------
-# Copyright (c) 2013, yt Development Team.
-#
-# Distributed under the terms of the Modified BSD License.
-#
-# The full license is in the file COPYING.txt, distributed with this software.
-#-----------------------------------------------------------------------------
-***********************************************************************/
-
-Ext.define('Reason.controller.DataObjects', {
-    extend: 'Ext.app.Controller',
-    stores: [ 'DataObjects' ],
-    models: ['DataObject'],
-    view: ['DataObjectTree'],
-    refs: [
-        { ref: 'dataObjectTree',
-          selector: 'dataobjecttree#dataobjects',
-          xtype: 'dataobjecttree',
-          itemId: 'dataobjects',
-          autoCreate: true,
-        },
-    ],
-
-    init: function() {
-        this.application.addListener({
-           payloaddataobjects : {fn: this.refreshDataObjects, scope: this},
-        });
-        this.control({
-            "#dataobjects": { itemcontextmenu:
-                function(view, rec, node, index, e) {
-                    e.preventDefault();
-                    this.application.fireEvent("showwidgets", rec, e);
-            }
-        }});
-        this.callParent(arguments);
-    },
-
-    refreshDataObjects: function(payload) {
-        /*console.log("Refreshing data objects");*/
-        var objs = payload['objs'];
-        var root = this.getDataObjectsStore().getRootNode();
-        root.removeAll();
-        var pf;
-        Ext.each(objs, function(o, i, os) {
-            /*console.log("Appending " + o['name']);*/
-            pf = root.appendChild({
-                name: o.name,
-                type: o.type,
-                filename: o.filename,
-                field_list: o.field_list,
-                varname: o.varname,
-                leaf: false,
-                expanded: true,
-                iconCls: 'pf_icon'
-            });
-            Ext.each(o['children'], function(c, ci, cs) {
-                /*console.log("    Appending " + c['name']);*/
-                pf.appendChild({name: c.name,
-                                type: c.type,
-                                filename: o.filename,
-                                field_list: o.field_list,
-                                varname: c.varname,
-                                leaf: true,
-                                iconcls: 'data_obj'});
-
-            });
-        });
-    },
-});
-

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db yt/gui/reason/html/app/controller/Debugger.js
--- a/yt/gui/reason/html/app/controller/Debugger.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/**********************************************************************
-Debug helper for Reason
-
-Copyright (c) 2013, yt Development Team.
-
-Distributed under the terms of the Modified BSD License.
-
-The full license is in the file COPYING.txt, distributed with this software.
-***********************************************************************/
-
-Ext.define('Reason.controller.Debugger', {
-    extend: 'Ext.app.Controller',
-    stores: ['WidgetTypes', 'WidgetInstances', 'Requests'],
-
-    getWidget: function(widgetId) {
-        this.getWidgetInstancesStore().find(
-            {'widgetid': widgetId});
-        var widgetInfo = this.getWidgetInstancesStore().getAt(resultId).data;
-        return widgetInfo.widget;
-    },
-
-    getAllWidgetsByType: function(typeName) {
-        var arr = []
-        this.getWidgetInstancesStore().each(function(r) {
-            if (r.data['widgettype'] == typeName) {
-                arr.push(r.data);
-            }
-        });
-        return arr;
-    },
-
-});
-

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db yt/gui/reason/html/app/controller/FileOpen.js
--- a/yt/gui/reason/html/app/controller/FileOpen.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/**********************************************************************
-File Open Dialog for Reason
-
-Copyright (c) 2013, yt Development Team.
-
-Distributed under the terms of the Modified BSD License.
-
-The full license is in the file COPYING.txt, distributed with this software.
-***********************************************************************/
-
-Ext.define('Reason.controller.FileOpen', {
-    extend: 'Ext.app.Controller',
-    stores: ['FileListing'],
-    requires: ["Reason.view.FileOpen"],
-    
-    init: function() {
-
-    },
-
-    openDialog: function() {
-        this.currentDirectory = '',
-        this.getFileListingStore().removeAll();
-        reason.server.method("file_listing",
-            {base_dir:"", sub_dir:""}, this.fillStore);
-        this.win = Ext.widget("fileopenwindow");
-        this.win.query("#file_listing")[0].bindStore(this.getFileListingStore());
-        /* Set up our handlers */
-        this.control({
-            '#current_file': { specialkey: this.specialKeyPressed, },
-            '#file_listing': { celldblclick: this.doubleClicked, },
-            '#load': { click: this.loadFile, },
-            '#cancel': { click: this.cancelWindow, }
-        });
-        this.win.show();
-    },
-
-    specialKeyPressed: function(f, e) {
-        if (e.getKey() != e.ENTER) { return; }
-        reason.server.method("file_listing",
-            {base_dir:f.getValue(), sub_dir:""}, this.fillStore);
-    },  
-
-    doubleClicked: function(view, td, cellIndex, record) {
-        conf = {'base_dir': this.currentDirectory};
-        if (record.data.type == 'directory') {
-          conf['sub_dir'] = record.data.filename;
-          reason.server.method('file_listing', conf, this.fillStore);
-        } else {
-          conf['filename'] = record.data.filename;
-          reason.server.method('load', conf);
-          this.win.destroy();
-        }
-    },
-
-    loadFile: function(b, e) {
-        var conf = {filename: '', base_dir: this.currentDirectory};
-        var fl = this.win.query("#file_listing")[0];
-        var idx = fl.getSelectionModel().getSelection();
-        if (idx == 1) {
-            conf['filename'] = this.getFileListingStore().getAt(idx).data.filename;
-        }
-        reason.server.method('load', conf);
-    },
-
-    cancelWindow:  function(b, e) {
-        this.win.destroy();
-    },
-
-    fillStore: function(f, a) {
-        var con = reason.getController("FileOpen");
-        if(a.status == false){
-          Ext.Msg.alert("Error", "Something has gone wrong.");
-          con.window.destroy();
-        }
-        if(a.result['change'] == false) {
-          con.win.query("#current_file")[0].setValue(con.currentDirectory);
-          return;
-        }
-        con.getFileListingStore().removeAll();
-        var rec = [];
-        con.getFileListingStore().loadData(a.result['objs']);
-        con.currentDirectory = a.result['cur_dir'];
-        con.win.query("#current_file")[0].setValue(con.currentDirectory);
-    },
-});

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db yt/gui/reason/html/app/controller/Logging.js
--- a/yt/gui/reason/html/app/controller/Logging.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/**********************************************************************
-Logging entry controller for Reason
-
-Copyright (c) 2013, yt Development Team.
-
-Distributed under the terms of the Modified BSD License.
-
-The full license is in the file COPYING.txt, distributed with this software.
-***********************************************************************/
-
-Ext.define('Reason.controller.Logging', {
-    extend: 'Ext.app.Controller',
-    stores: [ 'LogEntries' ],
-    view: ['LoggingGrid'],
-
-    refs: [
-        { ref: 'logEntries',
-          selector: '#logentries'
-        },
-    ],
-
-    init: function() {
-        this.application.addListener({
-            payloadlogentry: {fn: this.addLogPayload, scope: this},
-            logentry: {fn: this.addLogEntry, scope: this},
-        });
-    },
-
-    addLogPayload: function(payload) {
-        this.addLogEntry(payload['log_entry']);
-    },
-
-    addLogEntry: function(text) {
-        this.getLogEntriesStore().add({record: text});
-        var i = this.getLogEntriesStore().getCount();
-        this.getLogEntries().getView().focusRow(i - 1);
-    },
-});

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db yt/gui/reason/html/app/controller/MenuActions.js
--- a/yt/gui/reason/html/app/controller/MenuActions.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/**********************************************************************
-Menu actions in Reason
-
-Copyright (c) 2013, yt Development Team.
-
-Distributed under the terms of the Modified BSD License.
-
-The full license is in the file COPYING.txt, distributed with this software.
-***********************************************************************/
-
-
-Ext.define('Reason.controller.MenuActions', {
-    extend: 'Ext.app.Controller',
-    views: ['MainMenu'],
-
-    init: function() {
-        this.control({
-            '#openfile': { click: this.openFile },
-            '#savescript': { click: this.saveScript},
-            '#downloadscript': { click: this.downloadScript },
-            '#pastebinscript': { click: this.pastebinScript },
-            '#ytchat': {click: this.openIRCChannel },
-            '#quit': {click: this.quitReason },
-            '#enabledebug': {click: this.enableDebug },
-        });
-        this.callParent(arguments);
-    },
-
-    saveScript: function (b,e) { 
-        /* This function gets called on success */
-        var controller = this;
-        function handleResponse(f, a) {
-            if (a.result['status'] == 'SUCCESS') {
-                var alert_text = 'Saved session to ' + a.result['filename'];
-                Ext.Msg.alert('Success!', alert_text);
-                controller.application.fireEvent("logentry", alert_text);
-            } else {
-                Ext.Msg.alert('Always naysaying!',
-                  'Failed to save to ' + a.result['filename'] + '<br>Error: ' +
-                  a.result['error']);
-           }
-        };
-        /* Now we prompt */
-        Ext.Msg.prompt("We have important work to do.", "Enter filename.", 
-            function(btn, text) {
-                if (btn == 'ok') {
-                    reason.server.method('save_session',
-                        {filename:text}, handleResponse);
-                }
-            }
-        );
-    },
-
-    openFile: function(b, e) {
-        this.application.getController("FileOpen").openDialog();
-    },
-
-    downloadScript: function(b, e) {
-        window.open("session.py", "_top"); 
-        this.application.fireEvent("logentry", 'Saved session locally.')
-    },
-
-    pastebinScript: function(b, e) {
-        reason.server.method('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);
-                this.application.fireEvent("logentry", alert_text_rec);
-            }
-        }); 
-    },
-
-    openIRCChannel: function(b, e) {
-        window.open("http://yt-project.org/irc.html", "_new");
-    },
-
-    quitReason: function(b, e) {
-        this.application.fireEvent("stopheartbeat");
-        reason.server.method('shutdown', {}, function(f, a) {
-        Ext.Msg.alert("Goodbye!", "Goodbye from Reason!", function() {
-        window.open("http://www.google.com/", "_top");});});
-    },
-
-    enableDebug: function() {
-        this.application.fireEvent("enabledebug");
-    },
-});
-

diff -r 677e2f175540c89f7761eae0d2a74ae2e62369dd -r 89dd8b5534fee839aa66ece835c93beb36eb74db yt/gui/reason/html/app/controller/Notebook.js
--- a/yt/gui/reason/html/app/controller/Notebook.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/**********************************************************************
-Notebook controller for Reason
-
-Copyright (c) 2013, yt Development Team.
-
-Distributed under the terms of the Modified BSD License.
-
-The full license is in the file COPYING.txt, distributed with this software.
-***********************************************************************/
-
-Ext.define('Reason.controller.Notebook', {
-    extend: 'Ext.app.Controller',
-    stores: [ 'CellValues' , 'Requests'],
-    views: ['Notebook', 'CellView'],
-    refs: [
-        { ref: 'inputLine',
-          selector: '#inputline'
-        },
-        { ref: 'cellDisplay',
-          selector: 'notebookcells#cells',
-          xtype: 'notebookcells',
-          autoCreate: true,
-          itemId: 'cells',
-        },
-    ],
-
-    init: function() {
-        this.application.addListener({
-            payloadcell: {fn: this.addCell, scope: this},
-            payloadscript: {fn: this.loadScript, scope: this},
-            executecell: {fn: this.executeCell, scope: this},
-            wipeinput:   {fn: this.wipeInputLine, scope: this},
-            blockinput:  {fn: this.blockInput, scope: this},
-            allowinput:  {fn: this.allowInput, scope: this},
-            scrolltobottom: {fn: this.scrollToBottom, scope: this},
-        })
-        this.control({
-            '#executecellbutton': {
-                click: function(f, e) {
-                    this.executeCell(this.getInputLine().getValue());
-                }
-            },
-            '#inputline': {
-                specialkey: function(field, e, opts){
-                    if (e.shiftKey && e.getKey() == e.ENTER) {
-                        this.executeCell(field.getValue());
-                    }
-                },
-            },
-        });
-        this.callParent(arguments);
-    },
-
-    addRequest: function(request_id, command) {
-        /*console.log("Adding request " + request_id);*/
-        this.getRequestsStore().add({
-            request_id: request_id, command: command,
-        });
-        reason.pending.update([this.getRequestsStore().count()]);
-    },
-
-    addCell: function(cell) {
-        this.application.fireEvent("wipeinput");
-        this.application.fireEvent("allowinput");
-        if (cell['result_id'] != null) {
-            var ind = this.getRequestsStore().find(
-                'request_id', cell['result_id']);
-            if (ind != -1) {
-                /*console.log("Removing request " + cell['result_id']);*/
-                var rec = this.getRequestsStore().removeAt(ind);
-            }
-            reason.pending.update([this.getRequestsStore().count()]);
-        }
-        if (cell['hide'] == true) { return; }
-        this.getCellValuesStore().add({
-            input: cell['input'],
-            output: cell['output'],
-            raw_input: cell['raw_input'],
-            image_data: cell['image_data'],
-            executiontime: cell['executiontime'],
-            result_id: cell['result_id'],
-        });
-        this.application.fireEvent("scrolltobottom");
-    },
-
-    loadScript: function(payload) {
-        this.getInputLine().setValue(payload['value']);
-        this.getInputLine()._lock = true;
-    },
-
-    executeCell: function(line) {
-        this.application.fireEvent("blockinput");
-        reason.server.execute(line, false);
-    },
-
-    scrollToBottom: function() {
-        var i = this.getCellValuesStore().getCount();
-        this.getCellDisplay().getView().focusRow(i-1);
-    },
-    
-    wipeInputLine: function() {
-        if(this.getInputLine()._lock == true) {
-            this.getInputLine()._lock = false;
-        } else {
-            this.getInputLine().setValue("");
-        }
-    },
-
-    blockInput: function() {
-        this.getInputLine().addClass("cell_waiting");
-        this.getInputLine().setReadOnly(true);
-    },
-
-    allowInput: function() {
-        this.getInputLine().removeCls("cell_waiting");
-        this.getInputLine().setReadOnly(false);
-        var application = this.application;
-    },
-
-});
-

This diff is so big that we needed to truncate the remainder.

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