From a15a9b95a3c547fbe8120251555bb86b455388fe Mon Sep 17 00:00:00 2001 From: mjkim-blacklogic <83636412+minjk-bl@users.noreply.github.com> Date: Mon, 5 Sep 2022 11:26:26 +0900 Subject: [PATCH 1/4] Update README.md for Colab extension Add description for using Google Colab extension --- README.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 80e3e64f..ce4258b6 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Issues: ](https://img.shields.io/github/issues/visualpython/visualpython?color=%23FF6347)](https://github.com/visualpython/visualpython/issues) ## Introduction -Visual Python is a GUI-based Python code generator, developed on the Jupyter Notebook as an extension.
+Visual Python is a GUI-based Python code generator, developed on the **Jupyter Notebook** and **Google Colab** as an extension.
Visual Python is an open source project started for students who struggle with coding during Python classes for data science.
@@ -21,7 +21,7 @@ Try Visual Python if you would like to:

-## Getting Started +## Getting Started with Jupyter Notebook ### 1. Requirements @@ -57,6 +57,22 @@ upgrade - version upgrade version - version check ``` +## Getting Started with Google Colab +### 1. Requirements + +Visual Python is an extension to Google Colab, so you must have Google Colab opened.
+- Google Colab + +### 2. How to Install + +**1) Install package using Chrome Web Store** +- [Link to Visual Python for Colab](https://chrome.google.com/webstore/detail/visual-python-for-colab/ccmkpknjfagaldcgidgcipbpdipfopob) + +**2) Open Google Colab** +- [Link to Google Colab](https://colab.research.google.com/) + +**3) Activate Visual Python on Google Colab** + ## Contributing If you are interested in contributing to the Visual Python, please see [`CONTRIBUTING.md`](CONTRIBUTING.md).
All skills from programmers, non-programmers, designers are welcomed. From 66d0c417906f28e68ea2563ffbb25e7b725e3896 Mon Sep 17 00:00:00 2001 From: Visual Python Date: Tue, 7 Feb 2023 15:11:17 +0900 Subject: [PATCH 2/4] Update README.md Update installation manual and banners --- README.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ce4258b6..923dc643 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -[![PyPI version shields.io](https://img.shields.io/pypi/v/visualpython)](https://pypi.python.org/pypi/visualpython/) +[![PyPI version shields.io](https://img.shields.io/pypi/v/visualpython)](https://pypi.python.org/pypi/jupyterlab-visualpython/) ![Python: 3.x](https://img.shields.io/badge/Python-3.x-yellowgreen) [![License: GPLv3](https://img.shields.io/badge/License-GPLv3-brightgreen)](https://github.com/visualpython/visualpython/blob/main/LICENSE) -[![Code of Conduct: Contributor Covenant](https://img.shields.io/badge/Code%20of%20Conduct-Contributor%20Covenant-pink)](https://github.com/visualpython/visualpython/blob/main/CODE_OF_CONDUCT.md) [![Downloads](https://static.pepy.tech/personalized-badge/visualpython?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads)](https://pepy.tech/project/visualpython) [![Issues: ](https://img.shields.io/github/issues/visualpython/visualpython?color=%23FF6347)](https://github.com/visualpython/visualpython/issues) +[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/visualpython/visualpython-binder/HEAD?labpath=index.ipynb) ## Introduction -Visual Python is a GUI-based Python code generator, developed on the **Jupyter Notebook** and **Google Colab** as an extension.
+Visual Python is a GUI-based Python code generator, developed on the **Jupyter Lab**, **Jupyter Notebook** and **Google Colab** as an extension.
Visual Python is an open source project started for students who struggle with coding during Python classes for data science.
@@ -21,6 +21,25 @@ Try Visual Python if you would like to:

+## Getting Started with Jupyter Lab + +### 1. Requirements + +Visual Python is an extension to Jupyter Lab, so you must have Jupyter Lab installed already.
+- Python version 3.x +- Jupyter lab environment + +### 2. How to Install + +**1) Install package from** +``` +pip install jupyterlab-visualpython +``` + +**2) Activate Visual Python on Jupyter Lab** + +Click orange square button on the right side of the Jupyter Lab. + ## Getting Started with Jupyter Notebook ### 1. Requirements From 0d0558c10ab0f8e7b33343a743011068813b430c Mon Sep 17 00:00:00 2001 From: Visual Python Date: Tue, 7 Feb 2023 15:12:55 +0900 Subject: [PATCH 3/4] Update README.md Edit banners --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 923dc643..0caa9882 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -[![PyPI version shields.io](https://img.shields.io/pypi/v/visualpython)](https://pypi.python.org/pypi/jupyterlab-visualpython/) +[![PyPI version shields.io](https://img.shields.io/pypi/v/jupyterlab-visualpython)](https://pypi.python.org/pypi/jupyterlab-visualpython/) ![Python: 3.x](https://img.shields.io/badge/Python-3.x-yellowgreen) [![License: GPLv3](https://img.shields.io/badge/License-GPLv3-brightgreen)](https://github.com/visualpython/visualpython/blob/main/LICENSE) [![Downloads](https://static.pepy.tech/personalized-badge/visualpython?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads)](https://pepy.tech/project/visualpython) From 0d0df075dd0b2e400892260fd29322049806ba79 Mon Sep 17 00:00:00 2001 From: mjkim-blacklogic <83636412+minjk-bl@users.noreply.github.com> Date: Thu, 2 Mar 2023 12:42:00 +0900 Subject: [PATCH 4/4] Revert "Devops" --- .gitignore | 2 +- visualpython/css/component/dataSelector.css | 6 +- visualpython/css/component/multiSelector.css | 6 - visualpython/css/m_ml/modelInfo.css | 4 - visualpython/html/component/dataSelector.html | 4 +- visualpython/html/m_apps/file.html | 2 +- visualpython/js/MainFrame.js | 4 +- visualpython/js/com/com_Config.js | 47 +------ visualpython/js/com/com_generatorV2.js | 7 +- .../js/com/component/MultiSelector.js | 130 ++++++++---------- .../js/com/component/PopupComponent.js | 4 +- visualpython/js/loadVisualpython.js | 39 +++++- visualpython/js/m_apps/File.js | 14 +- visualpython/js/m_apps/Instance.js | 10 +- visualpython/js/menu/MenuFrame.js | 21 ++- 15 files changed, 121 insertions(+), 179 deletions(-) diff --git a/.gitignore b/.gitignore index e239a27c..378a7a07 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ dist/ jupyterlab/lib/visualpython -test/ +test/ \ No newline at end of file diff --git a/visualpython/css/component/dataSelector.css b/visualpython/css/component/dataSelector.css index 512a31d6..8e865b18 100644 --- a/visualpython/css/component/dataSelector.css +++ b/visualpython/css/component/dataSelector.css @@ -55,14 +55,14 @@ } .vp-ds-data-box { width: 100%; - height: 150px; + height: 160px; align-content: baseline; align-items: center; } .vp-ds-type-box, .vp-ds-variable-box { border: 0.25px solid var(--border-gray-color); - height: 150px; + height: 160px; grid-row-gap: 0px; align-content: baseline; } @@ -90,7 +90,7 @@ margin-top: 10px; } .vp-ds-option-inner-box { - height: calc(100% - 35px); + height: calc(100% - 30px); } .vp-ds-df-option-box { height: 100%; diff --git a/visualpython/css/component/multiSelector.css b/visualpython/css/component/multiSelector.css index eb3693d1..0b001277 100644 --- a/visualpython/css/component/multiSelector.css +++ b/visualpython/css/component/multiSelector.css @@ -79,10 +79,4 @@ left: calc(100% - 25px); bottom: 23px; cursor: pointer; -} -.vp-cs-del-item { - position: relative; - float: right; - top: 4px; - cursor: pointer; } \ No newline at end of file diff --git a/visualpython/css/m_ml/modelInfo.css b/visualpython/css/m_ml/modelInfo.css index 1b63388b..db81a970 100644 --- a/visualpython/css/m_ml/modelInfo.css +++ b/visualpython/css/m_ml/modelInfo.css @@ -1,7 +1,3 @@ -.vp-model-select-box { - grid-column-gap: 5px; - align-items: start; -} .vp-ins-select-title { font-weight: bold; color: var(--font-highlight); diff --git a/visualpython/html/component/dataSelector.html b/visualpython/html/component/dataSelector.html index 2e402219..8090aace 100644 --- a/visualpython/html/component/dataSelector.html +++ b/visualpython/html/component/dataSelector.html @@ -8,7 +8,7 @@
-
+
@@ -22,7 +22,7 @@
-
+
diff --git a/visualpython/html/m_apps/file.html b/visualpython/html/m_apps/file.html index c9d92782..07bd8d82 100644 --- a/visualpython/html/m_apps/file.html +++ b/visualpython/html/m_apps/file.html @@ -74,7 +74,7 @@ - + diff --git a/visualpython/js/MainFrame.js b/visualpython/js/MainFrame.js index 9ce588eb..f013ed66 100644 --- a/visualpython/js/MainFrame.js +++ b/visualpython/js/MainFrame.js @@ -478,10 +478,10 @@ define([ let parentBlock = null; let prevBlock = null; loadStateList.forEach(obj => { - let { file, blockType, menuId, menuState, menuConfig, argIdx, position, afterAction } = obj; + let { blockType, menuId, menuState, menuConfig, argIdx, position, afterAction } = obj; // get OptionComponent Object // LAB: relative path needed - let OptionComponent = require('./' + file); + let OptionComponent = require('./' + menuConfig.file); if (OptionComponent) { let taskState = menuState.taskState; let blockState = menuState.blockState; diff --git a/visualpython/js/com/com_Config.js b/visualpython/js/com/com_Config.js index b5fbf090..98bfe98d 100644 --- a/visualpython/js/com/com_Config.js +++ b/visualpython/js/com/com_Config.js @@ -208,7 +208,8 @@ define([ vp_config_version: '1.0.0', vp_signature: 'VisualPython', vp_position: {}, - vp_section_display: false, + // CHROME: default to display vp + vp_section_display: true, vp_note_display: false, vp_menu_width: Config.MENU_MIN_WIDTH, vp_note_width: Config.BOARD_MIN_WIDTH @@ -484,7 +485,7 @@ define([ that._checkMounted().then(function() { that._readFromColab(configKey).then(function(result) { let data = result; - if (data == undefined || (data instanceof Object && Object.keys(data).length === 0)) { + if (data == undefined || data == {}) { resolve(data); return; } @@ -492,7 +493,7 @@ define([ resolve(data); return; } - if (data instanceof Object && Object.keys(data).length > 0) { + if (Object.keys(data).length > 0) { resolve(data[dataKey]); return; } @@ -508,7 +509,7 @@ define([ // LAB: use local .visualpython files that._readFromLab(configKey).then(function(result) { let data = result; - if (data == undefined || (data instanceof Object && Object.keys(data).length === 0)) { + if (data == undefined || data == {}) { resolve(data); return; } @@ -516,7 +517,7 @@ define([ resolve(data); return; } - if (data instanceof Object && Object.keys(data).length > 0) { + if (Object.keys(data).length > 0) { resolve(data[dataKey]); return; } @@ -778,40 +779,6 @@ define([ return Config.version; } - checkVersionTimestamp = function() { - let that = this; - // check version timestamp - let nowDate = new Date(); - this.getData('version_timestamp', 'vpcfg').then(function(data) { - let doCheckVersion = false; - vpLog.display(VP_LOG_TYPE.DEVELOP, 'Checking its version timestamp... : ' + data); - if (data == undefined || (data instanceof Object && Object.keys(data).length === 0)) { - // no timestamp, check version - doCheckVersion = true; - } else if (data != '') { - let lastCheck = new Date(parseInt(data)); - let diffCheck_now = new Date(nowDate.getFullYear(), nowDate.getMonth() + 1, nowDate.getDate()); - let diffCheck_last = new Date(lastCheck.getFullYear(), lastCheck.getMonth() + 1, lastCheck.getDate()); - - let diff = Math.abs(diffCheck_now.getTime() - diffCheck_last.getTime()); - diff = Math.ceil(diff / (1000 * 3600 * 24)); - - if (diff >= 1) { - // if More than 1 day passed, check version - doCheckVersion = true; - } - } - - // check version and update version_timestamp - if (doCheckVersion == true) { - that.checkVpVersion(true); - } - - }).catch(function(err) { - vpLog.display(VP_LOG_TYPE.ERROR, err); - }) - } - checkVpVersion(background=false) { let that = this; let nowVersion = this.getVpInstalledVersion(); @@ -851,8 +818,6 @@ define([ switch (clickedBtnIdx) { case 0: // cancel - // update version_timestamp - that.setData({ 'version_timestamp': new Date().getTime() }, 'vpcfg'); break; case 1: // update diff --git a/visualpython/js/com/com_generatorV2.js b/visualpython/js/com/com_generatorV2.js index 4278b66d..6113af7b 100644 --- a/visualpython/js/com/com_generatorV2.js +++ b/visualpython/js/com/com_generatorV2.js @@ -134,7 +134,7 @@ define([ package.options && package.options.forEach(function(o, i) { var obj = JSON.parse(JSON.stringify(o)); let newTag = vp_createTag(pageThis, obj, state); - if (obj.required === true || obj.output === true) { + if (obj.required) { tblInput.append(newTag); } else { tblOption.append(newTag); @@ -142,9 +142,6 @@ define([ }); // TODO: userOption - if (package.code.includes('${etc}')) { - - } bindAutoComponentEvent(pageThis); } @@ -166,7 +163,7 @@ define([ let value = state[name]; var requiredFontStyle = required == true? 'vp-orange-text' : ''; - var lblTag = $(``).attr({ + var lblTag = $(``).attr({ 'for': name, 'class': requiredFontStyle, 'title': '(' + name + ')' diff --git a/visualpython/js/com/component/MultiSelector.js b/visualpython/js/com/component/MultiSelector.js index 06cf0707..774bb870 100644 --- a/visualpython/js/com/component/MultiSelector.js +++ b/visualpython/js/com/component/MultiSelector.js @@ -305,7 +305,7 @@ define([ // select - right tag.appendFormatLine('
', APP_SELECT_RIGHT); var selectedList = this.dataList.filter(data => that.selectedList.includes(data.code)); - tag.appendLine(this.renderSelectedBox(this.selectedList)); + tag.appendLine(this.renderSelectedBox(selectedList)); if (this.allowAdd) { // add item tag.appendLine(''); @@ -380,6 +380,62 @@ define([ that.bindDraggable(); }); + // item indexing + $(this.wrapSelector('.' + APP_SELECT_ITEM)).on('click', function(event) { + var dataIdx = $(this).attr('data-idx'); + var idx = $(this).index(); + var added = $(this).hasClass('added'); // right side added item? + var selector = ''; + + // remove selection for select box on the other side + if (added) { + // remove selection for left side + $(that.wrapSelector('.' + APP_SELECT_ITEM + ':not(.added)')).removeClass('selected'); + // set selector + selector = '.added'; + } else { + // remove selection for right(added) side + $(that.wrapSelector('.' + APP_SELECT_ITEM + '.added')).removeClass('selected'); + // set selector + selector = ':not(.added)'; + } + + if (vpEvent.keyManager.keyCheck.ctrlKey) { + // multi-select + that.pointer = { start: idx, end: -1 }; + $(this).toggleClass('selected'); + } else if (vpEvent.keyManager.keyCheck.shiftKey) { + // slicing + var startIdx = that.pointer.start; + + if (startIdx == -1) { + // no selection + that.pointer = { start: idx, end: -1 }; + } else if (startIdx > idx) { + // add selection from idx to startIdx + var tags = $(that.wrapSelector('.' + APP_SELECT_ITEM + selector)); + for (var i = idx; i <= startIdx; i++) { + $(tags[i]).addClass('selected'); + } + that.pointer = { start: startIdx, end: idx }; + } else if (startIdx <= idx) { + // add selection from startIdx to idx + var tags = $(that.wrapSelector('.' + APP_SELECT_ITEM + selector)); + for (var i = startIdx; i <= idx; i++) { + $(tags[i]).addClass('selected'); + } + that.pointer = { start: startIdx, end: idx }; + } + } else { + // single-select + that.pointer = { start: idx, end: -1 }; + // un-select others + $(that.wrapSelector('.' + APP_SELECT_ITEM + selector)).removeClass('selected'); + // select this + $(this).addClass('selected'); + } + }); + // item indexing - add all $(this.wrapSelector('.' + APP_SELECT_ADD_ALL_BTN)).on('click', function(event) { $(that.wrapSelector('.' + APP_SELECT_BOX + '.left .' + APP_SELECT_ITEM)).appendTo( @@ -454,75 +510,6 @@ define([ that._addNewItem(newItemName); } }); - - this._bindItemClickEvent(); - } - - _bindItemClickEvent() { - let that = this; - // item indexing - $(this.wrapSelector('.' + APP_SELECT_ITEM)).off('click'); - $(this.wrapSelector('.' + APP_SELECT_ITEM)).on('click', function(event) { - var dataIdx = $(this).attr('data-idx'); - var idx = $(this).index(); - var added = $(this).hasClass('added'); // right side added item? - var selector = ''; - - // remove selection for select box on the other side - if (added) { - // remove selection for left side - $(that.wrapSelector('.' + APP_SELECT_ITEM + ':not(.added)')).removeClass('selected'); - // set selector - selector = '.added'; - } else { - // remove selection for right(added) side - $(that.wrapSelector('.' + APP_SELECT_ITEM + '.added')).removeClass('selected'); - // set selector - selector = ':not(.added)'; - } - - if (vpEvent.keyManager.keyCheck.ctrlKey) { - // multi-select - that.pointer = { start: idx, end: -1 }; - $(this).toggleClass('selected'); - } else if (vpEvent.keyManager.keyCheck.shiftKey) { - // slicing - var startIdx = that.pointer.start; - - if (startIdx == -1) { - // no selection - that.pointer = { start: idx, end: -1 }; - } else if (startIdx > idx) { - // add selection from idx to startIdx - var tags = $(that.wrapSelector('.' + APP_SELECT_ITEM + selector)); - for (var i = idx; i <= startIdx; i++) { - $(tags[i]).addClass('selected'); - } - that.pointer = { start: startIdx, end: idx }; - } else if (startIdx <= idx) { - // add selection from startIdx to idx - var tags = $(that.wrapSelector('.' + APP_SELECT_ITEM + selector)); - for (var i = startIdx; i <= idx; i++) { - $(tags[i]).addClass('selected'); - } - that.pointer = { start: startIdx, end: idx }; - } - } else { - // single-select - that.pointer = { start: idx, end: -1 }; - // un-select others - $(that.wrapSelector('.' + APP_SELECT_ITEM + selector)).removeClass('selected'); - // select this - $(this).addClass('selected'); - } - }); - - // item deleting (manually added item only) - $(this.wrapSelector('.vp-cs-del-item')).off('click'); - $(this.wrapSelector('.vp-cs-del-item')).on('click', function(event) { - $(this).closest('.' + APP_SELECT_ITEM).remove(); - that.pointer = { start: -1, end: -1 }; - }); } _addNewItem(newItemName) { @@ -564,7 +551,6 @@ define([ let newItemIndex = this.dataList.length; var targetTag = $(`
${newItemName} -
`); $(targetTag).appendTo( $(this.wrapSelector('.' + APP_SELECT_BOX + '.right')) @@ -574,8 +560,6 @@ define([ $(this.wrapSelector('.' + APP_SELECT_ITEM)).removeClass('selected'); // clear item input $(this.wrapSelector('.vp-cs-add-item-name')).val(''); - // bind click event - this._bindItemClickEvent(); // bind draggable this.bindDraggable(); } diff --git a/visualpython/js/com/component/PopupComponent.js b/visualpython/js/com/component/PopupComponent.js index 44d52d6f..8e6cf32c 100644 --- a/visualpython/js/com/component/PopupComponent.js +++ b/visualpython/js/com/component/PopupComponent.js @@ -92,7 +92,6 @@ define([ this.id = this.state.config.id; this.name = this.state.config.name; this.path = this.state.config.path; - this.category = this.state.config.category; this.config = { @@ -531,8 +530,7 @@ define([ template() { this.$pageDom = $(popupComponentHtml.replaceAll('${vp_base}', com_Const.BASE_PATH)); // set title - // this.$pageDom.find('.vp-popup-title').text(this.category + ' > ' + this.name); - this.$pageDom.find('.vp-popup-title').html(`${this.category} > ${this.name}`); + this.$pageDom.find('.vp-popup-title').text(this.name); // set body let bodyTemplate = this.templateForBody(); // CHROME: check url keyword and replace it diff --git a/visualpython/js/loadVisualpython.js b/visualpython/js/loadVisualpython.js index 2e8ecc69..5d401bb7 100644 --- a/visualpython/js/loadVisualpython.js +++ b/visualpython/js/loadVisualpython.js @@ -206,6 +206,38 @@ define([ } } + var _checkVersion = function() { + // check version timestamp + let nowDate = new Date(); + vpConfig.getData('version_timestamp', 'vpcfg').then(function(data) { + let doCheckVersion = false; + if (data == undefined) { + // no timestamp, check version + doCheckVersion = true; + } else if (data != '') { + let lastCheck = new Date(parseInt(data)); + let diffCheck_now = new Date(nowDate.getFullYear(), nowDate.getMonth() + 1, nowDate.getDate()); + let diffCheck_last = new Date(lastCheck.getFullYear(), lastCheck.getMonth() + 1, lastCheck.getDate()); + + let diff = Math.abs(diffCheck_now.getTime() - diffCheck_last.getTime()); + diff = Math.ceil(diff / (1000 * 3600 * 24)); + + if (diff >= 1) { + // if More than 1 day passed, check version + doCheckVersion = true; + } + } + + // check version and update version_timestamp + if (doCheckVersion == true) { + vpConfig.checkVpVersion(true); + } + + }).catch(function(err) { + vpLog.display(VP_LOG_TYPE.ERROR, err); + }) + } + //======================================================================== // External call function //======================================================================== @@ -258,10 +290,9 @@ define([ _addToolBarVpButton(); } _loadVpResource(cfg); - vpConfig.checkVersionTimestamp(); + _checkVersion(); - if ((cfg.vp_section_display && vpFrame) - || vpConfig.extensionType === 'colab') { // CHROME: default to display vp + if (cfg.vp_section_display && vpFrame) { vpFrame.openVp(); } @@ -288,13 +319,11 @@ define([ if (newValue.sessionContext.isReady) { vpLog.display(VP_LOG_TYPE.LOG, 'vp operations for kernel ready...'); vpConfig.readKernelFunction(); - vpConfig.checkVersionTimestamp(); } newValue.sessionContext._connectionStatusChanged.connect(function(s2, status) { if (status === 'connected') { vpLog.display(VP_LOG_TYPE.LOG, 'vp operations for kernel ready...'); vpConfig.readKernelFunction(); - vpConfig.checkVersionTimestamp(); } }); } else { diff --git a/visualpython/js/m_apps/File.js b/visualpython/js/m_apps/File.js index 95cd0e39..be00f7ad 100644 --- a/visualpython/js/m_apps/File.js +++ b/visualpython/js/m_apps/File.js @@ -22,10 +22,9 @@ define([ 'vp_base/js/com/com_generatorV2', 'vp_base/data/m_library/pandasLibrary', 'vp_base/js/com/component/FileNavigation', - 'vp_base/js/com/component/SuggestInput', - 'vp_base/js/com/component/DataSelector' + 'vp_base/js/com/component/SuggestInput' ], function(fileHtml, fileCss, com_String, com_util, com_Const, PopupComponent - , pdGen, pandasLibrary, FileNavigation, SuggestInput, DataSelector) { + , pdGen, pandasLibrary, FileNavigation, SuggestInput) { /** * File @@ -287,14 +286,7 @@ define([ templateForBody() { /** Implement generating template */ - let page = $(fileHtml); - - let allocateSelector = new DataSelector({ - pageThis: this, id: 'vp_sampleReturn', placeholder: 'Variable name' - }); - $(page).find('#vp_sampleReturn').replaceWith(allocateSelector.toTagString()); - - return page; + return fileHtml; } renderPage(pageType) { diff --git a/visualpython/js/m_apps/Instance.js b/visualpython/js/m_apps/Instance.js index 512c6f76..a4f0e6c5 100644 --- a/visualpython/js/m_apps/Instance.js +++ b/visualpython/js/m_apps/Instance.js @@ -18,9 +18,8 @@ define([ 'vp_base/js/com/com_String', 'vp_base/js/com/component/PopupComponent', 'vp_base/js/com/component/InstanceEditor', - 'vp_base/js/com/component/DataSelector', 'vp_base/js/m_apps/Subset' -], function(insHtml, insCss, com_String, PopupComponent, InstanceEditor, DataSelector, Subset) { +], function(insHtml, insCss, com_String, PopupComponent, InstanceEditor, Subset) { const MAX_STACK_SIZE = 20; @@ -179,13 +178,6 @@ define([ templateForBody() { let page = $(insHtml); $(page).find('#vp_instanceVariable').val(this.state.vp_instanceVariable); - - let allocateSelector = new DataSelector({ - pageThis: this, id: 'vp_instanceAllocate', placeholder: 'Variable name' - }); - $(page).find('#vp_instanceAllocate').replaceWith(allocateSelector.toTagString()); - - return page; } diff --git a/visualpython/js/menu/MenuFrame.js b/visualpython/js/menu/MenuFrame.js index 998e6146..76aab784 100644 --- a/visualpython/js/menu/MenuFrame.js +++ b/visualpython/js/menu/MenuFrame.js @@ -199,19 +199,19 @@ define([ return {}; } - getMenuLibrary(menuId, libraries=this.menuLibrariesFlatten) { + getMenuLibrary(menuId, libraries=this.menuLibraries) { for (var i=0; i < libraries.length; i++) { var item = libraries[i]; if (item) { if (item.id === menuId) { return item; } - // if (item.type === 'package') { - // var result = this.getMenuLibrary(menuId, item.item); - // if (result) { - // return result; - // } - // } + if (item.type === 'package') { + var result = this.getMenuLibrary(menuId, item.item); + if (result) { + return result; + } + } } } return null; @@ -243,12 +243,7 @@ define([ var that = this; var body = group.getBody(); var item = group.getItem(); - var state = group.getState(); item && item.forEach(child => { - // remember parent to navigate its parent menu - var category = state.category?(state.category + ' > ' + state.name):state.name; - child['category'] = category; - if (child.type == 'package') { // packages : MenuGroup var menuGroup = new MenuGroup($(body), child); @@ -294,7 +289,7 @@ define([ }); let functionList = this.menuLibrariesFlatten.map(menu => { - return { label: menu.name, value: menu.name, dtype: menu.category, ...menu } + return { label: menu.name, value: menu.name, ...menu } }); // render searchbox let searchBox = new SuggestInput();