Skip to content

Commit

Permalink
Make shell a type with a style
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Apr 4, 2016
1 parent f80e791 commit acef5eb
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 53 deletions.
16 changes: 11 additions & 5 deletions client/wdb/__init__.py
Expand Up @@ -674,12 +674,13 @@ def receive(self):
log.debug('Got %s' % data)
return data.decode('utf-8')

def open_browser(self):
def open_browser(self, type_='debug'):
if not self.connected:
log.debug('Launching browser and wait for connection')
web_url = 'http://%s:%d/debug/session/%s' % (
web_url = 'http://%s:%d/%s/session/%s' % (
WEB_SERVER or 'localhost',
WEB_PORT or 1984,
type_,
self.uuid)

server = WEB_SERVER or '[wdb.server]'
Expand All @@ -688,14 +689,16 @@ def open_browser(self):

if WDB_NO_BROWSER_AUTO_OPEN:
log.warning('You can now launch your browser at '
'http://%s/debug/session/%s' % (
'http://%s/%s/session/%s' % (
server,
type_,
self.uuid))

elif not webbrowser.open(web_url):
log.warning('Unable to open browser, '
'please go to http://%s/debug/session/%s' % (
'please go to http://%s/%s/session/%s' % (
server,
type_,
self.uuid))

self.connected = True
Expand All @@ -717,7 +720,10 @@ def interaction(
self.stepping = not shell

if not iframe_mode:
self.open_browser()
opts = {}
if shell:
opts['type_'] = 'shell'
self.open_browser(**opts)

lvl = len(self.interaction_stack)
if lvl:
Expand Down
3 changes: 3 additions & 0 deletions server/sass/wdb.sass
Expand Up @@ -74,6 +74,9 @@ code
margin: auto
width: fit-content

table
margin-bottom: 1em

aside.note
margin-top: 1em
padding: .5em
Expand Down
14 changes: 3 additions & 11 deletions server/wdb_server/__init__.py
Expand Up @@ -86,17 +86,10 @@ def post(self, fn):


class MainHandler(tornado.web.RequestHandler):
def get(self, uuid):
def get(self, type_, uuid):
self.render(
'wdb.html', uuid=uuid, new_version=server.new_version,
post_mortem=False)


class PostMortemHandler(tornado.web.RequestHandler):
def get(self, uuid):
self.render(
'wdb.html', uuid=uuid, new_version=server.new_version,
post_mortem=True)
type_=type_)


class WebSocketHandler(tornado.websocket.WebSocketHandler):
Expand Down Expand Up @@ -286,8 +279,7 @@ def on_close(self):
[
(r"/", HomeHandler),
(r"/style.css", StyleHandler),
(r"/debug/session/(.+)", MainHandler),
(r"/pm/session/(.+)", PostMortemHandler),
(r"/(\w+)/session/(.+)", MainHandler),
(r"/debug/file/(.*)", DebugHandler),
(r"/websocket/(.+)", WebSocketHandler),
(r"/status", SyncWebSocketHandler)
Expand Down
2 changes: 2 additions & 0 deletions server/wdb_server/static/stylesheets/wdb.css
Expand Up @@ -328,6 +328,8 @@ code {
.modals .mdl-dialog .mdl-dialog__content table, .modals .mdl-dialog .mdl-dialog__content aside {
margin: auto;
width: fit-content; }
.modals .mdl-dialog .mdl-dialog__content table {
margin-bottom: 1em; }

aside.note {
margin-top: 1em;
Expand Down
15 changes: 10 additions & 5 deletions server/wdb_server/templates/_layout.html
Expand Up @@ -7,19 +7,24 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Roboto">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Roboto+Mono">
{% block material_css %}
<link rel="stylesheet" href="https://code.getmdl.io/1.1.2/material.indigo-red.min.css">
{% end %}
{% set material_version = '1.1.3' %}
{% set type = globals().get('type_', 'debug') %}
{% set scheme = {
'pm': 'red-indigo',
'shell': 'teal-orange',
'debug': 'indigo-red'
}[type] %}
<link rel="stylesheet" href="https://code.getmdl.io/{{ material_version }}/material.{{ scheme }}.min.css">

<script defer src="https://code.getmdl.io/1.1.2/material.min.js"></script>
<script defer src="https://code.getmdl.io/{{ material_version }}/material.min.js"></script>
<script src="{{ static_url('javascripts/wdb/deps.min.js') }}"></script>
<link href="{{ static_url('stylesheets/deps.min.css') }}" rel="stylesheet" type="text/css">

{% from wdb_server import StyleHandler %}
{% block css %}
{% end %}
</head>
<body {% if options.debug %}data-debug="true"{% end %}>
<body {% if options.debug %}data-debug="true"{% end %} data-type="{{ type }}">
<section class="wdb" data-page="{{ handler.__class__.__name__}}">
{% block main %}
{% end %}
Expand Down
56 changes: 24 additions & 32 deletions server/wdb_server/templates/wdb.html
Expand Up @@ -4,54 +4,46 @@
<script src="{{ static_url('javascripts/wdb' + ('.js' if options.unminified else '/wdb.min.js')) }}"></script>
{% end %}

{% block material_css %}
{% if post_mortem %}
<link rel="stylesheet" href="https://code.getmdl.io/1.1.2/material.red-indigo.min.css">
{% else %}
<link rel="stylesheet" href="https://code.getmdl.io/1.1.2/material.indigo-red.min.css">
{% end %}
{% end %}

{% block css %}
<link href="{{ static_url('stylesheets/wdb.css') }}" rel="stylesheet" type="text/css">
{% end %}

{% block main %}
<div class="trace mdl-layout mdl-js-layout mdl-layout--fixed-header" data-uuid="{{ uuid }}" {% if post_mortem %}data-post-mortem{% end %}>
<div class="trace mdl-layout mdl-js-layout mdl-layout--fixed-header" data-uuid="{{ uuid }}">
<header class="mdl-layout__header">
<div class="mdl-layout__header-row">
<span class="mdl-layout-title subtitle">
Wdb is tracing your code, this may take some time.
</span>
<div class="mdl-layout-spacer"></div>

{% if not post_mortem %}
<button class="mdl-button mdl-js-button mdl-button--icon command" data-command="s" id="command-s">
<i class="material-icons">subdirectory_arrow_right</i>
</button>
<div class="mdl-tooltip mdl-tooltip--large" for="command-s">Step into</div>
{% if type_ != 'pm' %}
<button class="mdl-button mdl-js-button mdl-button--icon command" data-command="s" id="command-s">
<i class="material-icons">subdirectory_arrow_right</i>
</button>
<div class="mdl-tooltip mdl-tooltip--large" for="command-s">Step into</div>

<button class="mdl-button mdl-js-button mdl-button--icon command" data-command="n" id="command-n">
<i class="material-icons">redo</i>
</button>
<div class="mdl-tooltip mdl-tooltip--large" for="command-n">Next</div>
<button class="mdl-button mdl-js-button mdl-button--icon command" data-command="n" id="command-n">
<i class="material-icons">redo</i>
</button>
<div class="mdl-tooltip mdl-tooltip--large" for="command-n">Next</div>

<button class="mdl-button mdl-js-button mdl-button--icon command" data-command="u" id="command-u">
<i class="material-icons">keyboard_tab</i>
</button>
<div class="mdl-tooltip mdl-tooltip--large" for="command-u">Until</div>
<button class="mdl-button mdl-js-button mdl-button--icon command" data-command="u" id="command-u">
<i class="material-icons">keyboard_tab</i>
</button>
<div class="mdl-tooltip mdl-tooltip--large" for="command-u">Until</div>

<button class="mdl-button mdl-js-button mdl-button--icon command" data-command="r" id="command-r">
<i class="material-icons">call_missed_outgoing</i>
</button>
<div class="mdl-tooltip mdl-tooltip--large" for="command-r">Return</div>
<button class="mdl-button mdl-js-button mdl-button--icon command" data-command="r" id="command-r">
<i class="material-icons">call_missed_outgoing</i>
</button>
<div class="mdl-tooltip mdl-tooltip--large" for="command-r">Return</div>

<button class="mdl-button mdl-js-button mdl-button--icon command" data-command="c" id="command-c">
<i class="material-icons">play_arrow</i>
</button>
<div class="mdl-tooltip mdl-tooltip--large" for="command-c">Continue</div>
<button class="mdl-button mdl-js-button mdl-button--icon command" data-command="c" id="command-c">
<i class="material-icons">play_arrow</i>
</button>
<div class="mdl-tooltip mdl-tooltip--large" for="command-c">Continue</div>

<div class="separator"></div>
<div class="separator"></div>
{% end %}

<a class="mdl-button mdl-js-button mdl-button--icon command" href="/" target="_blank" id="home-link">
Expand All @@ -74,7 +66,7 @@
</button>
<div class="mdl-tooltip mdl-tooltip--large" for="command-h">Help</div>

{% if post_mortem %}
{% if type_ == 'pm' %}
<button class="mdl-button mdl-js-button mdl-button--icon switch power on" id="switch-power-on">
<i class="material-icons">power_settings_new</i>
</button>
Expand Down

0 comments on commit acef5eb

Please sign in to comment.