##// END OF EJS Templates
Reverse hscrollbar min-height hack on OS X...
Reverse hscrollbar min-height hack on OS X OS X has optional behavior to only draw scrollbars during scroll, which causes problems for CodeMirror's scrollbars. CodeMirror's solution is to set a minimum size for their scrollbars, which is always present. The trade is that the container overlays most of the last line, swallowing click events when there is scrolling to do, even when no scrollbar is visible. This reverses the trade, recovering the click events at the expense of never showing the horizontal scrollbar on OS X when this option is enabled.

File last commit:

r19975:c42828d1
r20298:2907e856
Show More
api_handlers.py
44 lines | 1.3 KiB | text/x-python | PythonLexer
Thomas Kluyver
Initial REST API for terminals
r18483 import json
Min RK
wait for terminal to terminate
r19975 from tornado import web, gen
Thomas Kluyver
Initial REST API for terminals
r18483 from ..base.handlers import IPythonHandler, json_errors
Min RK
create new terminals with POST /api/terminals...
r18616 from ..utils import url_path_join
Thomas Kluyver
Initial REST API for terminals
r18483
class TerminalRootHandler(IPythonHandler):
@web.authenticated
@json_errors
def get(self):
Min RK
create new terminals with POST /api/terminals...
r18616 tm = self.terminal_manager
Thomas Kluyver
Initial REST API for terminals
r18483 terms = [{'name': name} for name in tm.terminals]
self.finish(json.dumps(terms))
Min RK
create new terminals with POST /api/terminals...
r18616 @web.authenticated
@json_errors
def post(self):
"""POST /terminals creates a new terminal and redirects to it"""
name, _ = self.terminal_manager.new_named_terminal()
self.finish(json.dumps({'name': name}))
Thomas Kluyver
Initial REST API for terminals
r18483 class TerminalHandler(IPythonHandler):
SUPPORTED_METHODS = ('GET', 'DELETE')
@web.authenticated
@json_errors
def get(self, name):
Min RK
create new terminals with POST /api/terminals...
r18616 tm = self.terminal_manager
Thomas Kluyver
Initial REST API for terminals
r18483 if name in tm.terminals:
self.finish(json.dumps({'name': name}))
else:
raise web.HTTPError(404, "Terminal not found: %r" % name)
@web.authenticated
@json_errors
Min RK
wait for terminal to terminate
r19975 @gen.coroutine
Thomas Kluyver
Initial REST API for terminals
r18483 def delete(self, name):
Min RK
create new terminals with POST /api/terminals...
r18616 tm = self.terminal_manager
Thomas Kluyver
Initial REST API for terminals
r18483 if name in tm.terminals:
Min RK
wait for terminal to terminate
r19975 yield tm.terminate(name, force=True)
Thomas Kluyver
Initial REST API for terminals
r18483 self.set_status(204)
self.finish()
else:
Min RK
wait for terminal to terminate
r19975 raise web.HTTPError(404, "Terminal not found: %r" % name)