Skip to content

Commit 054d19f

Browse files
authored
Merge pull request #112 from visualpython/release
Release v2.0.1
2 parents 0f20c58 + 997d4f2 commit 054d19f

15 files changed

+123
-44
lines changed

css/boardFrame.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@
156156
flex-direction: column;
157157
justify-content: center;
158158
touch-action: none;
159-
cursor: pointer;
160159
color: var(--font-primary);
161160
font-family: 'AppleSDGothicNeo';
162161

@@ -180,6 +179,7 @@
180179
overflow: hidden;
181180
border: 2px solid transparent;
182181
border-radius: 2px;
182+
cursor: pointer;
183183
}
184184
.vp-block-left-holder {
185185
display: none;
@@ -197,6 +197,7 @@
197197
position: absolute;
198198
left: 0px;
199199
color: rgba(0,0,0,0.3);
200+
cursor: default;
200201
}
201202
.vp-block-num-info {
202203
color: #828282;

css/popupComponent.css

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -115,29 +115,29 @@
115115
height: 50px;
116116
}
117117
.vp-popup-button[data-type="code"] {
118-
position: absolute;
119-
left: 15px;
120-
top: 9px;
118+
float: left;
119+
margin-top: 9px;
120+
margin-left: 10px;
121121
}
122122
.vp-popup-button[data-type="data"] {
123-
position: absolute;
124-
left: 102px;
125-
top: 9px;
123+
float: left;
124+
margin-top: 9px;
125+
margin-left: 10px;
126126
}
127127
.vp-popup-button[data-type="cancel"] {
128-
position: absolute;
128+
float: right;
129129
background-color: #E4E4E4;
130-
top: 9px;
131-
right: 106px;
130+
margin-top: 9px;
131+
margin-right: 10px;
132132
}
133133
.vp-popup-runadd-box {
134-
position: absolute;
135-
top: 9px;
136-
right: 15px;
134+
float: right;
137135
width: fit-content;
138136
height: 30px;
139137
background: #F38504;
140138
border-radius: 2px;
139+
margin-top: 9px;
140+
margin-right: 10px;
141141
}
142142
.vp-popup-button[data-type="run"] {
143143
display: inline-block;
@@ -157,8 +157,8 @@
157157
background: white;
158158
border: 0.25px solid var(--border-gray-color);
159159
position: absolute;
160-
bottom: 35px;
161-
right: 0px;
160+
bottom: 45px;
161+
right: 10px;
162162
width: 120px;
163163
text-align: center;
164164
line-height: 30px;
@@ -172,10 +172,11 @@
172172
background: var(--light-gray-color);
173173
}
174174
.vp-popup-save-button {
175-
position: absolute;
176-
top: 9px;
177-
right: 15px;
175+
float: right;
178176
height: 30px;
177+
width: 100px;
178+
margin-top: 9px;
179+
margin-right: 10px;
179180
}
180181
/* writable codemirror style*/
181182
/* Code Option Codemirror */

data/libraries.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@
384384
"type" : "function",
385385
"level": 1,
386386
"name" : "elif",
387-
"tag" : "ELSE,LOGIC",
387+
"tag" : "ELIF,LOGIC",
388388
"path" : "visualpython - logic - control - elif",
389389
"desc" : "elif",
390390
"file" : "m_logic/Elif",

data/m_library/pandasLibrary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5119,7 +5119,7 @@ define([
51195119
name: 'Plot',
51205120
library: 'pandas',
51215121
description: 'create chart',
5122-
code: '${o0} = ${i0}.plot(${v}${etc})',
5122+
code: '${o0} = ${i0}.plot(${v}${etc})\nplt.show()',
51235123
input: [
51245124
{
51255125
name: 'i0',

html/popupComponent.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
<button type="button" class="vp-button vp-popup-button" data-type="code">Code view</button>
5252
<button type="button" class="vp-button vp-popup-button" data-type="data">Data view</button>
5353

54-
<button type="button" class="vp-button vp-popup-button" data-type="cancel">Cancel</button>
5554
<div class="vp-popup-runadd-box">
5655
<button type="button" class="vp-button activated vp-popup-button" data-type="run" title="Save to block & Run cell">Run</button>
5756
<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,7 +59,8 @@
6059
<div class="vp-popup-detail-button" data-type="add" title="Save to block & Add cell">Code to cell</div>
6160
</div>
6261
</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>
6464
</div>
6565
</div>
6666
</div>

js/board/BlockMenu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ define([
7474
// run button
7575
sbBlockMenu.appendLine('<div id="vp_block_menu_run" class="vp-block-menu-item">Run</div>');
7676
// 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>');
7878
// duplicate button
7979
sbBlockMenu.appendLine('<div id="vp_block_menu_duplicate" class="vp-block-menu-item">Duplicate</div>');
8080
// delete button

js/com/com_Config.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,17 @@ define([], function() {
9090
' except ValueError:',
9191
' return 0.0'
9292
]
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+
]
94104
}
95105

96106
this.data = {
@@ -165,7 +175,8 @@ define([], function() {
165175
Jupyter.notebook.config.loaded.then(function() {
166176
var data = Jupyter.notebook.config.data[configKey];
167177
if (data == undefined) {
168-
data = {};
178+
reject('No data available.');
179+
return;
169180
}
170181
if (dataKey == '') {
171182
resolve(data);
@@ -184,7 +195,7 @@ define([], function() {
184195
Jupyter.notebook.config.load();
185196
var data = Jupyter.notebook.config.data[configKey];
186197
if (data == undefined) {
187-
data = {};
198+
return undefined;
188199
}
189200
if (dataKey == '') {
190201
return data;

js/com/com_Const.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ define ([
1919
class Constants { }
2020

2121
Constants.TOOLBAR_BTN_INFO = {
22-
HELP: "Visual Python 2.0.0"
22+
HELP: "Visual Python 2.0.1"
2323
, ICON: "vp-main-icon"
2424
, ID: "vpBtnToggle"
2525
, NAME: "toggle-vp"

js/com/component/InstanceEditor.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,14 @@ define([
433433
if (callback) {
434434
callback(varObj);
435435
}
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+
}
436444
});
437445

438446

js/com/component/PopupComponent.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,10 +435,6 @@ define([
435435
}
436436
if (!dataview) {
437437
$(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-
}
442438
}
443439

444440
// footer

js/loadVisualpython.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,13 @@
238238
if (cfg.vp_section_display && vpFrame) {
239239
vpFrame.openVp();
240240
}
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+
});
241248
}
242249

243250
return { initVisualpython: initVisualpython, readConfig: readConfig };

js/m_apps/Import.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ define([
8181
page.appendLine('</tr></thead>');
8282
page.appendLine('<tbody>');
8383
let that = this;
84-
this.state.importMeta.forEach((lib, idx) => {
84+
this.state.importMeta && this.state.importMeta.forEach((lib, idx) => {
8585
page.appendLine(that.templateForLibrary(idx, lib.library, lib.alias));
8686
});
8787
page.appendLine('</tbody>');

js/m_apps/Instance.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ define([
157157
let component = evt.component;
158158
component.close();
159159
});
160+
$(this.wrapSelector('#vp_instanceVariable')).on('focus_option_page', function(evt) {
161+
let component = evt.component;
162+
component.focus();
163+
});
160164
$(this.wrapSelector('#vp_instanceVariable')).on('apply_option_page', function(evt) {
161165
let component = evt.component;
162166
// apply its value
@@ -219,6 +223,21 @@ define([
219223
return sbCode.toString();
220224
}
221225

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+
222241
updateValue(value) {
223242
let cmObj = this.getCodemirror('vp_instanceVariable');
224243
if (cmObj && cmObj.cm) {

js/m_apps/Snippets.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ define([
194194

195195
com_util.renderSuccessMessage('Default snippets imported');
196196
}
197+
$(that.wrapSelector('.vp-sn-menu-box')).hide();
197198
evt.stopPropagation();
198199
});
199200

0 commit comments

Comments
 (0)