File tree 15 files changed +123
-44
lines changed
15 files changed +123
-44
lines changed Original file line number Diff line number Diff line change 156
156
flex-direction : column;
157
157
justify-content : center;
158
158
touch-action : none;
159
- cursor : pointer;
160
159
color : var (--font-primary );
161
160
font-family : 'AppleSDGothicNeo' ;
162
161
180
179
overflow : hidden;
181
180
border : 2px solid transparent;
182
181
border-radius : 2px ;
182
+ cursor : pointer;
183
183
}
184
184
.vp-block-left-holder {
185
185
display : none;
197
197
position : absolute;
198
198
left : 0px ;
199
199
color : rgba (0 , 0 , 0 , 0.3 );
200
+ cursor : default;
200
201
}
201
202
.vp-block-num-info {
202
203
color : # 828282 ;
Original file line number Diff line number Diff line change 115
115
height : 50px ;
116
116
}
117
117
.vp-popup-button [data-type = "code" ] {
118
- position : absolute ;
119
- left : 15 px ;
120
- top : 9 px ;
118
+ float : left ;
119
+ margin-top : 9 px ;
120
+ margin-left : 10 px ;
121
121
}
122
122
.vp-popup-button [data-type = "data" ] {
123
- position : absolute ;
124
- left : 102 px ;
125
- top : 9 px ;
123
+ float : left ;
124
+ margin-top : 9 px ;
125
+ margin-left : 10 px ;
126
126
}
127
127
.vp-popup-button [data-type = "cancel" ] {
128
- position : absolute ;
128
+ float : right ;
129
129
background-color : # E4E4E4 ;
130
- top : 9px ;
131
- right : 106 px ;
130
+ margin- top: 9px ;
131
+ margin- right: 10 px ;
132
132
}
133
133
.vp-popup-runadd-box {
134
- position : absolute;
135
- top : 9px ;
136
- right : 15px ;
134
+ float : right;
137
135
width : fit-content;
138
136
height : 30px ;
139
137
background : # F38504 ;
140
138
border-radius : 2px ;
139
+ margin-top : 9px ;
140
+ margin-right : 10px ;
141
141
}
142
142
.vp-popup-button [data-type = "run" ] {
143
143
display : inline-block;
157
157
background : white;
158
158
border : 0.25px solid var (--border-gray-color );
159
159
position : absolute;
160
- bottom : 35 px ;
161
- right : 0 px ;
160
+ bottom : 45 px ;
161
+ right : 10 px ;
162
162
width : 120px ;
163
163
text-align : center;
164
164
line-height : 30px ;
172
172
background : var (--light-gray-color );
173
173
}
174
174
.vp-popup-save-button {
175
- position : absolute;
176
- top : 9px ;
177
- right : 15px ;
175
+ float : right;
178
176
height : 30px ;
177
+ width : 100px ;
178
+ margin-top : 9px ;
179
+ margin-right : 10px ;
179
180
}
180
181
/* writable codemirror style*/
181
182
/* Code Option Codemirror */
Original file line number Diff line number Diff line change 384
384
"type" : " function" ,
385
385
"level" : 1 ,
386
386
"name" : " elif" ,
387
- "tag" : " ELSE ,LOGIC" ,
387
+ "tag" : " ELIF ,LOGIC" ,
388
388
"path" : " visualpython - logic - control - elif" ,
389
389
"desc" : " elif" ,
390
390
"file" : " m_logic/Elif" ,
Original file line number Diff line number Diff line change @@ -5119,7 +5119,7 @@ define([
5119
5119
name : 'Plot' ,
5120
5120
library : 'pandas' ,
5121
5121
description : 'create chart' ,
5122
- code : '${o0} = ${i0}.plot(${v}${etc})' ,
5122
+ code : '${o0} = ${i0}.plot(${v}${etc})\nplt.show() ' ,
5123
5123
input : [
5124
5124
{
5125
5125
name : 'i0' ,
Original file line number Diff line number Diff line change 51
51
< button type ="button " class ="vp-button vp-popup-button " data-type ="code "> Code view</ button >
52
52
< button type ="button " class ="vp-button vp-popup-button " data-type ="data "> Data view</ button >
53
53
54
- < button type ="button " class ="vp-button vp-popup-button " data-type ="cancel "> Cancel</ button >
55
54
< div class ="vp-popup-runadd-box ">
56
55
< button type ="button " class ="vp-button activated vp-popup-button " data-type ="run " title ="Save to block & Run cell "> Run</ button >
57
56
< button type ="button " class ="vp-button activated vp-popup-button " data-type ="show-detail "> < img src ="/nbextensions/visualpython/img/arrow_short_up.svg "/> </ button >
60
59
< div class ="vp-popup-detail-button " data-type ="add " title ="Save to block & Add cell "> Code to cell</ div >
61
60
</ div >
62
61
</ div >
63
- < button type ="button " class ="vp-button activated vp-popup-button vp-popup-save-button " data-type ="save " title ="Save to block " style ="display:none; "> Save</ button >
62
+ < button type ="button " class ="vp-button activated vp-popup-button vp-popup-save-button " data-type ="save " title ="Save to block " style ="display:none; "> Save to block</ button >
63
+ < button type ="button " class ="vp-button vp-popup-button " data-type ="cancel "> Cancel</ button >
64
64
</ div >
65
65
</ div >
66
66
</ div >
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ define([
74
74
// run button
75
75
sbBlockMenu . appendLine ( '<div id="vp_block_menu_run" class="vp-block-menu-item">Run</div>' ) ;
76
76
// add button
77
- sbBlockMenu . appendLine ( '<div id="vp_block_menu_add" class="vp-block-menu-item">Add </div>' ) ;
77
+ sbBlockMenu . appendLine ( '<div id="vp_block_menu_add" class="vp-block-menu-item">Code to cell </div>' ) ;
78
78
// duplicate button
79
79
sbBlockMenu . appendLine ( '<div id="vp_block_menu_duplicate" class="vp-block-menu-item">Duplicate</div>' ) ;
80
80
// delete button
Original file line number Diff line number Diff line change @@ -90,7 +90,17 @@ define([], function() {
90
90
' except ValueError:' ,
91
91
' return 0.0'
92
92
]
93
- }
93
+ } ,
94
+ 'vpimport' : [
95
+ { library : 'numpy' , alias :'np' } ,
96
+ { library : 'pandas' , alias :'pd' } ,
97
+ { library : 'matplotlib.pyplot' , alias :'plt' ,
98
+ include : [
99
+ '%matplotlib inline'
100
+ ]
101
+ } ,
102
+ { library : 'seaborn' , alias :'sns' }
103
+ ]
94
104
}
95
105
96
106
this . data = {
@@ -165,7 +175,8 @@ define([], function() {
165
175
Jupyter . notebook . config . loaded . then ( function ( ) {
166
176
var data = Jupyter . notebook . config . data [ configKey ] ;
167
177
if ( data == undefined ) {
168
- data = { } ;
178
+ reject ( 'No data available.' ) ;
179
+ return ;
169
180
}
170
181
if ( dataKey == '' ) {
171
182
resolve ( data ) ;
@@ -184,7 +195,7 @@ define([], function() {
184
195
Jupyter . notebook . config . load ( ) ;
185
196
var data = Jupyter . notebook . config . data [ configKey ] ;
186
197
if ( data == undefined ) {
187
- data = { } ;
198
+ return undefined ;
188
199
}
189
200
if ( dataKey == '' ) {
190
201
return data ;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ define ([
19
19
class Constants { }
20
20
21
21
Constants . TOOLBAR_BTN_INFO = {
22
- HELP : "Visual Python 2.0.0 "
22
+ HELP : "Visual Python 2.0.1 "
23
23
, ICON : "vp-main-icon"
24
24
, ID : "vpBtnToggle"
25
25
, NAME : "toggle-vp"
Original file line number Diff line number Diff line change @@ -433,6 +433,14 @@ define([
433
433
if ( callback ) {
434
434
callback ( varObj ) ;
435
435
}
436
+ } ) . catch ( function ( resultObj ) {
437
+ let { result } = resultObj ;
438
+ // show alert
439
+ com_util . renderAlertModal ( result . ename + ': ' + result . evalue ) ;
440
+ // callback
441
+ if ( callback ) {
442
+ callback ( '' ) ;
443
+ }
436
444
} ) ;
437
445
438
446
Original file line number Diff line number Diff line change @@ -435,10 +435,6 @@ define([
435
435
}
436
436
if ( ! dataview ) {
437
437
$ ( this . wrapSelector ( '.vp-popup-button[data-type="data"]' ) ) . hide ( ) ;
438
- } else {
439
- if ( ! codeview ) {
440
- $ ( this . wrapSelector ( '.vp-popup-button[data-type="data"]' ) ) . css ( { left : '15px' , top : '9px' } ) ;
441
- }
442
438
}
443
439
444
440
// footer
Original file line number Diff line number Diff line change 238
238
if ( cfg . vp_section_display && vpFrame ) {
239
239
vpFrame . openVp ( ) ;
240
240
}
241
+
242
+ // Operations on kernel restart
243
+ events . on ( 'kernel_ready.Kernel' , function ( evt , info ) {
244
+ vpLog . display ( VP_LOG_TYPE . LOG , 'vp operations for kernel ready...' ) ;
245
+ // read vp functions
246
+ _readKernelFunction ( ) ;
247
+ } ) ;
241
248
}
242
249
243
250
return { initVisualpython : initVisualpython , readConfig : readConfig } ;
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ define([
81
81
page . appendLine ( '</tr></thead>' ) ;
82
82
page . appendLine ( '<tbody>' ) ;
83
83
let that = this ;
84
- this . state . importMeta . forEach ( ( lib , idx ) => {
84
+ this . state . importMeta && this . state . importMeta . forEach ( ( lib , idx ) => {
85
85
page . appendLine ( that . templateForLibrary ( idx , lib . library , lib . alias ) ) ;
86
86
} ) ;
87
87
page . appendLine ( '</tbody>' ) ;
Original file line number Diff line number Diff line change @@ -157,6 +157,10 @@ define([
157
157
let component = evt . component ;
158
158
component . close ( ) ;
159
159
} ) ;
160
+ $ ( this . wrapSelector ( '#vp_instanceVariable' ) ) . on ( 'focus_option_page' , function ( evt ) {
161
+ let component = evt . component ;
162
+ component . focus ( ) ;
163
+ } ) ;
160
164
$ ( this . wrapSelector ( '#vp_instanceVariable' ) ) . on ( 'apply_option_page' , function ( evt ) {
161
165
let component = evt . component ;
162
166
// apply its value
@@ -219,6 +223,21 @@ define([
219
223
return sbCode . toString ( ) ;
220
224
}
221
225
226
+ hide ( ) {
227
+ super . hide ( ) ;
228
+ this . state . subsetEditor && this . state . subsetEditor . hide ( ) ;
229
+ }
230
+
231
+ close ( ) {
232
+ super . close ( ) ;
233
+ this . state . subsetEditor && this . state . subsetEditor . close ( ) ;
234
+ }
235
+
236
+ remove ( ) {
237
+ super . remove ( ) ;
238
+ this . state . subsetEditor && this . state . subsetEditor . remove ( ) ;
239
+ }
240
+
222
241
updateValue ( value ) {
223
242
let cmObj = this . getCodemirror ( 'vp_instanceVariable' ) ;
224
243
if ( cmObj && cmObj . cm ) {
Original file line number Diff line number Diff line change @@ -194,6 +194,7 @@ define([
194
194
195
195
com_util . renderSuccessMessage ( 'Default snippets imported' ) ;
196
196
}
197
+ $ ( that . wrapSelector ( '.vp-sn-menu-box' ) ) . hide ( ) ;
197
198
evt . stopPropagation ( ) ;
198
199
} ) ;
199
200
You can’t perform that action at this time.
0 commit comments