Skip to content

Devops v2.5.0 #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions visualpython/js/com/com_Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ define([
throw new Error('Error', response);
}
}).then(function (data) {
resolve(data.info.version);
resolve(data.info.version, data.releases);
}).catch(function(err) {
let errMsg = err.message;
if (errMsg.includes('Failed to fetch')) {
Expand Down Expand Up @@ -910,11 +910,27 @@ define([
packageName = 'jupyterlab-visualpython';
}
this.getPackageVersion(packageName).then(function(latestVersion) {
if (nowVersion === latestVersion) {
let showUpdater = false;
if (nowVersion !== latestVersion) {
let nowVerParts = nowVersion.split('.').map(x => ~~x);
let latVerParts = latestVersion.split('.').map(x => ~~x);
if (packageName === 'visualpython') {
// show updater only for notebook extension (for v2.5.0)
for (var i = 0; i < nowVerParts.length; i++) {
const a = nowVerParts[i];
const b = latVerParts[i];
if (a < b) {
showUpdater = true;
break;
}
}
}
}
if (showUpdater === false) {
// if it's already up to date
// hide version update icon
$('#vp_versionUpdater').hide();
if (background) {
if (background === true) {
;
} else {
let msg = com_util.formatString('Visual Python is up to date. ({0})', latestVersion);
Expand Down
25 changes: 23 additions & 2 deletions visualpython/js/com/com_Kernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,14 +473,27 @@ define([
getLabNotebookPanel(){
var mainWidgets = this.app.shell.widgets('main');
var widget = mainWidgets.next();
while(widget){
if(widget.sessionContext){
while (widget) {
if (widget.sessionContext) {
var type = widget.sessionContext.type;
if(type == 'notebook' || type == 'console'){ //other wigets might be of type DocumentWidget
if (widget.isVisible){
return widget;
}
}
} else if (widget.value !== undefined && widget.done === false) {
// for upper lab 4
let widgetObj = widget.value;
if (widgetObj.sessionContext) {
var type = widgetObj.sessionContext.type;
if(type == 'notebook' || type == 'console'){ //other wigets might be of type DocumentWidget
if (widgetObj.isVisible){
return widgetObj;
}
}
}
} else if (widget.done === true) {
break;
}
widget = mainWidgets.next();
}
Expand All @@ -494,6 +507,14 @@ define([
while (widget) {
if (widget.sessionContext) {
widgetList.push(widget);
} else if (widget.value !== undefined && widget.done === false) {
// for upper lab 4
let widgetObj = widget.value;
if (widgetObj.sessionContext) {
widgetList.push(widgetObj);
}
} else if (widget.done === true) {
break;
}
widget = mainWidgets.next();
}
Expand Down
2 changes: 1 addition & 1 deletion visualpython/js/com/com_interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ define([
var widget = labConsole.widgets[0];
if (type === 'markdown') {
// add # before the lines
command = '#' + command.split('\n').join('#');
command = '#' + command.split('\n').join('\n#');
}

// execute or not
Expand Down
6 changes: 4 additions & 2 deletions visualpython/js/loadVisualpython.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,10 @@ define([
} else if (vpConfig.extensionType === 'lab' || vpConfig.extensionType === 'lite') {
// LAB: if widget is ready or changed, ready for lab kernel connected, and restart vp
vpLab.shell._currentChanged.connect(function(s1, value) {
var { newValue } = value;
vpLog.display(VP_LOG_TYPE.DEVELOP, 'jupyterlab shell currently changed', s1, value);
// var { newValue } = value;
// LAB 4.x: get currentWidget
var newValue = s1.currentWidget;
vpLog.display(VP_LOG_TYPE.DEVELOP, 'jupyterlab shell currently changed', s1, newValue);
// kernel restart for notebook and console
if (newValue && newValue.sessionContext) {
vpConfig.hideProtector();
Expand Down
24 changes: 12 additions & 12 deletions visualpython/js/m_apps/Import.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ define([

const importTemplates = {
'data-analysis': [
{ i0: 'numpy', i1: 'np', type: 'module'},
{ i0: 'pandas', i1: 'pd', type: 'module'},
{ i0: 'numpy', i1: 'np', type: 'module', checked: 'checked'},
{ i0: 'pandas', i1: 'pd', type: 'module', checked: 'checked'},
{
i0: 'matplotlib.pyplot', i1: 'plt', type: 'module'
, include: [
'%matplotlib inline'
]
], checked: 'checked'
},
{ i0: 'seaborn', i1: 'sns', type: 'module'},
{ i0: 'seaborn', i1: 'sns', type: 'module', checked: 'checked'},
{
i0: 'plotly.express', i1: 'px', type: 'module'
, include: [
'from plotly.offline import init_notebook_mode',
'init_notebook_mode(connected=True)'
], checked: false
], checked: ''
},
{ i0: 'pyarrow', i1: 'pa', type: 'module', checked: false},
{ i0: 'pyarrow', i1: 'pa', type: 'module', checked: ''},
],
'machine-learning': [
{ i0: 'sklearn.model_selection', i1: 'train_test_split', type: 'function' },
{ i0: 'sklearn', i1: 'metrics', type: 'function' }
{ i0: 'sklearn.model_selection', i1: 'train_test_split', type: 'function', checked: 'checked' },
{ i0: 'sklearn', i1: 'metrics', type: 'function', checked: 'checked' }
]
}

Expand Down Expand Up @@ -175,9 +175,9 @@ define([
let that = this;
libraries && libraries.forEach((lib, idx) => {
if (lib.type == 'function') {
page.appendLine(that.templateForFunction(idx, lib.i0, lib.i1, lib.checked));
page.appendLine(that.templateForFunction(idx, lib.i0, lib.i1, (lib.checked === 'checked' || lib.checked === true)));
} else {
page.appendLine(that.templateForModule(idx, lib.i0, lib.i1, lib.checked));
page.appendLine(that.templateForModule(idx, lib.i0, lib.i1, (lib.checked === 'checked' || lib.checked === true)));
}
});
page.appendLine('</tbody>');
Expand Down Expand Up @@ -246,7 +246,7 @@ define([
if (pacI0 == "") {
continue;
}
if (pacChecked) {
if (pacChecked === true) {
if (sbCode.toString().trim().length > 0) {
sbCode.appendLine();
}
Expand All @@ -270,7 +270,7 @@ define([
}
}

importMeta.push({ i0: pacI0, i1: pacI1, type: pacType, checked: pacChecked });
importMeta.push({ i0: pacI0, i1: pacI1, type: pacType, checked: (pacChecked?'checked':'') });
}
this.state.importMeta = importMeta;

Expand Down
2 changes: 1 addition & 1 deletion visualpython/lib/codemirror/lib/codemirror.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
height: 300px;
/* height: 300px; */
color: black;
direction: ltr;
}
Expand Down