Skip to content

Commit c5d08e9

Browse files
authored
Merge pull request #246 from minjk-bl/devops
Devops v2.5.0
2 parents daf5bab + a726faa commit c5d08e9

File tree

6 files changed

+60
-21
lines changed

6 files changed

+60
-21
lines changed

visualpython/js/com/com_Config.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ define([
850850
throw new Error('Error', response);
851851
}
852852
}).then(function (data) {
853-
resolve(data.info.version);
853+
resolve(data.info.version, data.releases);
854854
}).catch(function(err) {
855855
let errMsg = err.message;
856856
if (errMsg.includes('Failed to fetch')) {
@@ -910,11 +910,27 @@ define([
910910
packageName = 'jupyterlab-visualpython';
911911
}
912912
this.getPackageVersion(packageName).then(function(latestVersion) {
913-
if (nowVersion === latestVersion) {
913+
let showUpdater = false;
914+
if (nowVersion !== latestVersion) {
915+
let nowVerParts = nowVersion.split('.').map(x => ~~x);
916+
let latVerParts = latestVersion.split('.').map(x => ~~x);
917+
if (packageName === 'visualpython') {
918+
// show updater only for notebook extension (for v2.5.0)
919+
for (var i = 0; i < nowVerParts.length; i++) {
920+
const a = nowVerParts[i];
921+
const b = latVerParts[i];
922+
if (a < b) {
923+
showUpdater = true;
924+
break;
925+
}
926+
}
927+
}
928+
}
929+
if (showUpdater === false) {
914930
// if it's already up to date
915931
// hide version update icon
916932
$('#vp_versionUpdater').hide();
917-
if (background) {
933+
if (background === true) {
918934
;
919935
} else {
920936
let msg = com_util.formatString('Visual Python is up to date. ({0})', latestVersion);

visualpython/js/com/com_Kernel.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,14 +473,27 @@ define([
473473
getLabNotebookPanel(){
474474
var mainWidgets = this.app.shell.widgets('main');
475475
var widget = mainWidgets.next();
476-
while(widget){
477-
if(widget.sessionContext){
476+
while (widget) {
477+
if (widget.sessionContext) {
478478
var type = widget.sessionContext.type;
479479
if(type == 'notebook' || type == 'console'){ //other wigets might be of type DocumentWidget
480480
if (widget.isVisible){
481481
return widget;
482482
}
483483
}
484+
} else if (widget.value !== undefined && widget.done === false) {
485+
// for upper lab 4
486+
let widgetObj = widget.value;
487+
if (widgetObj.sessionContext) {
488+
var type = widgetObj.sessionContext.type;
489+
if(type == 'notebook' || type == 'console'){ //other wigets might be of type DocumentWidget
490+
if (widgetObj.isVisible){
491+
return widgetObj;
492+
}
493+
}
494+
}
495+
} else if (widget.done === true) {
496+
break;
484497
}
485498
widget = mainWidgets.next();
486499
}
@@ -494,6 +507,14 @@ define([
494507
while (widget) {
495508
if (widget.sessionContext) {
496509
widgetList.push(widget);
510+
} else if (widget.value !== undefined && widget.done === false) {
511+
// for upper lab 4
512+
let widgetObj = widget.value;
513+
if (widgetObj.sessionContext) {
514+
widgetList.push(widgetObj);
515+
}
516+
} else if (widget.done === true) {
517+
break;
497518
}
498519
widget = mainWidgets.next();
499520
}

visualpython/js/com/com_interface.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ define([
145145
var widget = labConsole.widgets[0];
146146
if (type === 'markdown') {
147147
// add # before the lines
148-
command = '#' + command.split('\n').join('#');
148+
command = '#' + command.split('\n').join('\n#');
149149
}
150150

151151
// execute or not

visualpython/js/loadVisualpython.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,10 @@ define([
287287
} else if (vpConfig.extensionType === 'lab' || vpConfig.extensionType === 'lite') {
288288
// LAB: if widget is ready or changed, ready for lab kernel connected, and restart vp
289289
vpLab.shell._currentChanged.connect(function(s1, value) {
290-
var { newValue } = value;
291-
vpLog.display(VP_LOG_TYPE.DEVELOP, 'jupyterlab shell currently changed', s1, value);
290+
// var { newValue } = value;
291+
// LAB 4.x: get currentWidget
292+
var newValue = s1.currentWidget;
293+
vpLog.display(VP_LOG_TYPE.DEVELOP, 'jupyterlab shell currently changed', s1, newValue);
292294
// kernel restart for notebook and console
293295
if (newValue && newValue.sessionContext) {
294296
vpConfig.hideProtector();

visualpython/js/m_apps/Import.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,27 @@ define([
2222

2323
const importTemplates = {
2424
'data-analysis': [
25-
{ i0: 'numpy', i1: 'np', type: 'module'},
26-
{ i0: 'pandas', i1: 'pd', type: 'module'},
25+
{ i0: 'numpy', i1: 'np', type: 'module', checked: 'checked'},
26+
{ i0: 'pandas', i1: 'pd', type: 'module', checked: 'checked'},
2727
{
2828
i0: 'matplotlib.pyplot', i1: 'plt', type: 'module'
2929
, include: [
3030
'%matplotlib inline'
31-
]
31+
], checked: 'checked'
3232
},
33-
{ i0: 'seaborn', i1: 'sns', type: 'module'},
33+
{ i0: 'seaborn', i1: 'sns', type: 'module', checked: 'checked'},
3434
{
3535
i0: 'plotly.express', i1: 'px', type: 'module'
3636
, include: [
3737
'from plotly.offline import init_notebook_mode',
3838
'init_notebook_mode(connected=True)'
39-
], checked: false
39+
], checked: ''
4040
},
41-
{ i0: 'pyarrow', i1: 'pa', type: 'module', checked: false},
41+
{ i0: 'pyarrow', i1: 'pa', type: 'module', checked: ''},
4242
],
4343
'machine-learning': [
44-
{ i0: 'sklearn.model_selection', i1: 'train_test_split', type: 'function' },
45-
{ i0: 'sklearn', i1: 'metrics', type: 'function' }
44+
{ i0: 'sklearn.model_selection', i1: 'train_test_split', type: 'function', checked: 'checked' },
45+
{ i0: 'sklearn', i1: 'metrics', type: 'function', checked: 'checked' }
4646
]
4747
}
4848

@@ -175,9 +175,9 @@ define([
175175
let that = this;
176176
libraries && libraries.forEach((lib, idx) => {
177177
if (lib.type == 'function') {
178-
page.appendLine(that.templateForFunction(idx, lib.i0, lib.i1, lib.checked));
178+
page.appendLine(that.templateForFunction(idx, lib.i0, lib.i1, (lib.checked === 'checked' || lib.checked === true)));
179179
} else {
180-
page.appendLine(that.templateForModule(idx, lib.i0, lib.i1, lib.checked));
180+
page.appendLine(that.templateForModule(idx, lib.i0, lib.i1, (lib.checked === 'checked' || lib.checked === true)));
181181
}
182182
});
183183
page.appendLine('</tbody>');
@@ -246,7 +246,7 @@ define([
246246
if (pacI0 == "") {
247247
continue;
248248
}
249-
if (pacChecked) {
249+
if (pacChecked === true) {
250250
if (sbCode.toString().trim().length > 0) {
251251
sbCode.appendLine();
252252
}
@@ -270,7 +270,7 @@ define([
270270
}
271271
}
272272

273-
importMeta.push({ i0: pacI0, i1: pacI1, type: pacType, checked: pacChecked });
273+
importMeta.push({ i0: pacI0, i1: pacI1, type: pacType, checked: (pacChecked?'checked':'') });
274274
}
275275
this.state.importMeta = importMeta;
276276

visualpython/lib/codemirror/lib/codemirror.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.CodeMirror {
44
/* Set height, width, borders, and global font properties here */
55
font-family: monospace;
6-
height: 300px;
6+
/* height: 300px; */
77
color: black;
88
direction: ltr;
99
}

0 commit comments

Comments
 (0)