Skip to content

Commit

Permalink
Add new buttons in toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Apr 1, 2016
1 parent 596e3d1 commit 3d5edee
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 12 deletions.
4 changes: 4 additions & 0 deletions server/coffees/_switch.coffee
Expand Up @@ -19,6 +19,7 @@ class Switch extends Log
super
@$trace = $('.trace')
@$switches = $('.switch').click (e) => @switch $(e.currentTarget)
@$command = $('.command').click (e) => @command $(e.currentTarget)
@$source = $('.source')
@$interpreter = $('.interpreter')

Expand Down Expand Up @@ -68,3 +69,6 @@ class Switch extends Log
.addClass('mdl-button--accent')
@$interpreter.addClass('hidden')
@wdb.source.size()

command: ($command)->
@wdb.execute '.' + $command.attr('data-command')
4 changes: 2 additions & 2 deletions server/coffees/wdb.coffee
Expand Up @@ -209,12 +209,12 @@ class Wdb extends Log
Step into
.n or [Alt] + [→] or [F10] : \
Step over (Next)
.u or [Alt] + [←] or [F7] : \
Until (Next over loops)
.r or [Alt] + [↑] or [F9] : \
Step out (Return)
.c or [Alt] + [Enter] or [F8] : \
Continue
.u or [Alt] + [←] or [F7] : \
Until (Next over loops)
.j lineno : \
Jump to lineno (Must be at bottom frame and in the same function)
.b arg : \
Expand Down
7 changes: 6 additions & 1 deletion server/sass/_switch.sass
Expand Up @@ -18,9 +18,14 @@
.mdl-layout__header-row
padding-right: 20px

.switch
.switch, .command
opacity: .75
margin: 8px

&:hover
opacity: 1

.separator
border-right: 1px solid rgba(255, 255, 255, .7)
height: 29px
margin: 0 22px
11 changes: 10 additions & 1 deletion server/wdb_server/static/javascripts/wdb.js
Expand Up @@ -1083,6 +1083,11 @@ Switch = (function(superClass) {
return _this["switch"]($(e.currentTarget));
};
})(this));
this.$command = $('.command').click((function(_this) {
return function(e) {
return _this.command($(e.currentTarget));
};
})(this));
this.$source = $('.source');
this.$interpreter = $('.interpreter');
}
Expand Down Expand Up @@ -1141,6 +1146,10 @@ Switch = (function(superClass) {
return this.wdb.source.size();
};

Switch.prototype.command = function($command) {
return this.wdb.execute('.' + $command.attr('data-command'));
};

return Switch;

})(Log);
Expand Down Expand Up @@ -1440,7 +1449,7 @@ Wdb = (function(superClass) {
Wdb.prototype.print_help = function() {
return this.print({
"for": 'Supported commands',
result: '.s or [Alt] + [↓] or [F11] : Step into\n.n or [Alt] + [→] or [F10] : Step over (Next)\n.r or [Alt] + [↑] or [F9] : Step out (Return)\n.c or [Alt] + [Enter] or [F8] : Continue\n.u or [Alt] + [←] or [F7] : Until (Next over loops)\n.j lineno : Jump to lineno (Must be at bottom frame and in the same function)\n.b arg : Set a session breakpoint see below for what arg can be*\n.t arg : Set a temporary breakpoint, arg follow the same syntax as .b\n.z arg : Delete existing breakpoint\n.l : List active breakpoints\n.a : Echo all typed commands in the current debugging session\n.d expression : Dump the result of expression in a table\n.w expression : Watch expression in curent file (Click on the name to remove)\n.q : Quit\n.h : Get some help\n.e : Toggle file edition mode\n.g : Clear prompt\n.i [mime/type;]expression : Display the result in an embed, mime type defaults to "text/html"\n.x left ? right : Display the difference between the pretty print of \'left\' and \'right\'\n.x left <> right : Display the difference between the repr of \'left\' and \'right\'\n.f key in expression : Search recursively the presence of key in expression object tree\n.f test of expression : Search recursively values that match test in expression inner tree.\n i.e.: .f type(x) == int of sys\n\nAll the upper commands are prefixed with a dot and can be executed with [Alt] + [the command letter], i.e.: [Alt] + [h]\n\niterable!sthg : If cutter is installed, executes cut(iterable).sthg\nexpr >! file : Write the result of expr in file\n!< file : Eval the content of file\n[Enter] : Eval the current selected text in page, useful to eval code in the source\n[Shift] + [Enter] : Insert the current selected text in page in the prompt\n[Ctrl] + [Enter] : Multiline prompt or execute if already in multiline mode.\n\n* arg is using the following syntax:\n [file/module][:lineno][#function][,condition]\nwhich means:\n - [file] : Break if any line of `file` is executed\n - [file]:lineno : Break on `file` at `lineno`\n - [file][:lineno],condition : Break on `file` at `lineno` if `condition` is True (ie: i == 10)\n - [file]#function : Break when inside `function` function\nFile is always current file by default and you can also specify a module like `logging.config`.'
result: '.s or [Alt] + [↓] or [F11] : Step into\n.n or [Alt] + [→] or [F10] : Step over (Next)\n.u or [Alt] + [←] or [F7] : Until (Next over loops)\n.r or [Alt] + [↑] or [F9] : Step out (Return)\n.c or [Alt] + [Enter] or [F8] : Continue\n.j lineno : Jump to lineno (Must be at bottom frame and in the same function)\n.b arg : Set a session breakpoint see below for what arg can be*\n.t arg : Set a temporary breakpoint, arg follow the same syntax as .b\n.z arg : Delete existing breakpoint\n.l : List active breakpoints\n.a : Echo all typed commands in the current debugging session\n.d expression : Dump the result of expression in a table\n.w expression : Watch expression in curent file (Click on the name to remove)\n.q : Quit\n.h : Get some help\n.e : Toggle file edition mode\n.g : Clear prompt\n.i [mime/type;]expression : Display the result in an embed, mime type defaults to "text/html"\n.x left ? right : Display the difference between the pretty print of \'left\' and \'right\'\n.x left <> right : Display the difference between the repr of \'left\' and \'right\'\n.f key in expression : Search recursively the presence of key in expression object tree\n.f test of expression : Search recursively values that match test in expression inner tree.\n i.e.: .f type(x) == int of sys\n\nAll the upper commands are prefixed with a dot and can be executed with [Alt] + [the command letter], i.e.: [Alt] + [h]\n\niterable!sthg : If cutter is installed, executes cut(iterable).sthg\nexpr >! file : Write the result of expr in file\n!< file : Eval the content of file\n[Enter] : Eval the current selected text in page, useful to eval code in the source\n[Shift] + [Enter] : Insert the current selected text in page in the prompt\n[Ctrl] + [Enter] : Multiline prompt or execute if already in multiline mode.\n\n* arg is using the following syntax:\n [file/module][:lineno][#function][,condition]\nwhich means:\n - [file] : Break if any line of `file` is executed\n - [file]:lineno : Break on `file` at `lineno`\n - [file][:lineno],condition : Break on `file` at `lineno` if `condition` is True (ie: i == 10)\n - [file]#function : Break when inside `function` function\nFile is always current file by default and you can also specify a module like `logging.config`.'
});
};

Expand Down
4 changes: 2 additions & 2 deletions server/wdb_server/static/javascripts/wdb/wdb.min.js

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions server/wdb_server/static/stylesheets/wdb.css
Expand Up @@ -233,11 +233,15 @@
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
.mdl-layout__header-row {
padding-right: 20px; }
.mdl-layout__header-row .switch {
.mdl-layout__header-row .switch, .mdl-layout__header-row .command {
opacity: .75;
margin: 8px; }
.mdl-layout__header-row .switch:hover {
.mdl-layout__header-row .switch:hover, .mdl-layout__header-row .command:hover {
opacity: 1; }
.mdl-layout__header-row .separator {
border-right: 1px solid rgba(255, 255, 255, 0.7);
height: 29px;
margin: 0 22px; }

/* This file is part of wdb */
/* */
Expand Down
51 changes: 47 additions & 4 deletions server/wdb_server/templates/wdb.html
Expand Up @@ -25,22 +25,65 @@
</span>
<div class="mdl-layout-spacer"></div>

<button class="mdl-button mdl-js-button mdl-button--icon switch code on">
{% 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>

<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="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>

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

<a class="mdl-button mdl-js-button mdl-button--icon command" href="/" target="_blank" id="home-link">
<i class="material-icons">home</i>
</a>
<div class="mdl-tooltip mdl-tooltip--large" for="home-link">Open wdb home in a new window</div>

<button class="mdl-button mdl-js-button mdl-button--icon switch code on" id="switch-code">
<i class="material-icons">code</i>
</button>
<div class="mdl-tooltip mdl-tooltip--large" for="switch-code">Toggle code view</div>

<button class="mdl-button mdl-js-button mdl-button--icon switch term on">
<button class="mdl-button mdl-js-button mdl-button--icon switch term on" id="switch-term">
<i class="material-icons">dvr</i>
</button>
<div class="mdl-tooltip mdl-tooltip--large" for="switch-term">Toggle prompt view</div>

<button class="mdl-button mdl-js-button mdl-button--icon command" data-command="h" id="command-h">
<i class="material-icons">help</i>
</button>
<div class="mdl-tooltip mdl-tooltip--large" for="command-h">Help</div>

{% if post_mortem %}
<button class="mdl-button mdl-js-button mdl-button--icon switch power on ">
<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>
<div class="mdl-tooltip mdl-tooltip--large" for="switch-power-on">Refresh request with tracing enabled</div>
{% else %}
<button class="mdl-button mdl-js-button mdl-button--icon switch power off">
<button class="mdl-button mdl-js-button mdl-button--icon switch power off" id="switch-power-off">
<i class="material-icons">close</i>
</button>
<div class="mdl-tooltip mdl-tooltip--large" for="switch-power-off">Stop tracing</div>
{% end %}
</div>
</header>
Expand Down

0 comments on commit 3d5edee

Please sign in to comment.