@@ -24,16 +24,16 @@ define([
24
24
* @param {boolean } exec true(default) / false
25
25
* @param {int } sigNum
26
26
*/
27
- var insertCell = function ( type , command , exec = true , sigNum = - 1 ) {
27
+ var insertCell = function ( type , command , exec = true , sigText = '' ) {
28
28
var selectedIndex = getSelectedCell ( ) ;
29
29
var targetCell = Jupyter . notebook . insert_cell_below ( type , selectedIndex ) ;
30
30
31
31
// Add signature
32
32
if ( type == 'code' ) {
33
- if ( sigNum >= 0 ) {
34
- command = com_util . formatString ( '# VisualPython [ {0}] \n' , sigNum ) + command ;
33
+ if ( sigText !== '' ) {
34
+ command = com_util . formatString ( '# Visual Python: {0}\n' , sigText ) + command ;
35
35
} else {
36
- command = '# VisualPython \n' + command ;
36
+ command = '# Visual Python \n' + command ;
37
37
}
38
38
}
39
39
targetCell . set_text ( command ) ;
@@ -61,14 +61,18 @@ define([
61
61
* @param {boolean } exec
62
62
* @param {int } sigNum
63
63
*/
64
- var insertCells = function ( type , commands , exec = true , sigNum = - 1 ) {
64
+ var insertCells = function ( type , commands , exec = true , sigText = '' ) {
65
65
var selectedIndex = getSelectedCell ( ) ;
66
66
var targetCell = Jupyter . notebook . insert_cell_below ( type , selectedIndex ) ;
67
67
68
68
commands && commands . forEach ( ( command , idx ) => {
69
69
// Add signature
70
- if ( type == 'code' && sigNum >= 0 ) {
71
- command = com_util . formatString ( '# VisualPython [{0}] - {1}\n' , sigNum , idx + 1 ) + command
70
+ if ( type == 'code' ) {
71
+ if ( sigText !== '' ) {
72
+ command = com_util . formatString ( '# Visual Python: {0}\n' , sigText ) + command ;
73
+ } else {
74
+ command = com_util . formatString ( '# Visual Python' ) + command ;
75
+ }
72
76
}
73
77
targetCell . set_text ( command ) ;
74
78
Jupyter . notebook . select_next ( ) ;
0 commit comments