From 812bc2c40e9601e0b2960c399fd3c9f3f8a05db3 Mon Sep 17 00:00:00 2001 From: minjk-bl Date: Fri, 21 Jan 2022 11:22:27 +0900 Subject: [PATCH 01/38] Default status of vp from open to close --- js/com/com_Config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/com/com_Config.js b/js/com/com_Config.js index af94bf6f..a6b268fb 100644 --- a/js/com/com_Config.js +++ b/js/com/com_Config.js @@ -127,7 +127,7 @@ define([], function() { vp_config_version: '1.0.0', vp_signature: 'VisualPython', vp_position: {}, - vp_section_display: true, + vp_section_display: false, vp_note_display: true, vp_menu_width: Config.MENU_MIN_WIDTH, vp_note_width: Config.BOARD_MIN_WIDTH From 9dc4842b293a2754aeaca93c179dda853da329ad Mon Sep 17 00:00:00 2001 From: minjk-bl Date: Fri, 21 Jan 2022 11:51:34 +0900 Subject: [PATCH 02/38] Add restart vp menu --- html/menuFrame.html | 8 ++++++-- js/com/com_Config.js | 39 ++++++++++++++++++++++++++++++++++++++- js/loadVisualpython.js | 27 ++------------------------- js/menu/MenuFrame.js | 13 +++++++++++++ 4 files changed, 59 insertions(+), 28 deletions(-) diff --git a/html/menuFrame.html b/html/menuFrame.html index b6b357ea..7355f602 100644 --- a/html/menuFrame.html +++ b/html/menuFrame.html @@ -19,13 +19,17 @@
@@ -37,7 +38,8 @@
Required Input & Output
- + +
@@ -45,8 +47,8 @@
Additional Options
- - + +
diff --git a/js/m_apps/File.js b/js/m_apps/File.js index 66aa57fa..9722dfc2 100644 --- a/js/m_apps/File.js +++ b/js/m_apps/File.js @@ -245,8 +245,8 @@ define([ var prefix = '#vp_file' + pageType + ' '; // clear - $(this.wrapSelector(prefix + '#vp_inputOutputBox table')).html(''); - $(this.wrapSelector(prefix + '#vp_optionBox table')).html(''); + $(this.wrapSelector(prefix + '#vp_inputOutputBox table tbody')).html(''); + $(this.wrapSelector(prefix + '#vp_optionBox table tbody')).html(''); var fileTypeObj = this.fileState[pageType]['fileTypeId']; var selectedType = this.fileState[pageType]['selectedType']; @@ -273,7 +273,7 @@ define([ pdGen.vp_showInterfaceOnPage(this.wrapSelector('#vp_file' + pageType), thisPkg); // prepend file type selector - $(this.wrapSelector(prefix + '#vp_inputOutputBox table')).prepend( + $(this.wrapSelector(prefix + '#vp_inputOutputBox table tbody')).prepend( $('').append($(``)) .append($('')) ); @@ -292,7 +292,7 @@ define([ .append($('')) ) } else { - $(this.wrapSelector(prefix + '#vp_inputOutputBox table')).append( + $(this.wrapSelector(prefix + '#vp_inputOutputBox table tbody')).append( $('').append($(``)) .append($('')) ) From c7dc357d3b752e9b7875394ef02fa4bbf5f22665 Mon Sep 17 00:00:00 2001 From: minjk-bl Date: Thu, 3 Feb 2022 14:31:34 +0900 Subject: [PATCH 35/38] Remove some note menu (depth number show, close note) --- html/boardFrame.html | 2 -- js/board/BoardFrame.js | 42 +++++++++++++++++++++--------------------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/html/boardFrame.html b/html/boardFrame.html index 8b537e54..1125f5be 100644 --- a/html/boardFrame.html +++ b/html/boardFrame.html @@ -28,10 +28,8 @@
  • Run All
  • View Code
  • Export Code
  • -
  • Show Depth Number

  • Clear Note
  • -
  • Close Note
  • diff --git a/js/board/BoardFrame.js b/js/board/BoardFrame.js index c9c9ff33..ac9c3420 100644 --- a/js/board/BoardFrame.js +++ b/js/board/BoardFrame.js @@ -110,15 +110,9 @@ define([ case 'code-export': that.exportCode(); break; - case 'view-depth': - that.viewDepthInfo(); - break; case 'clear': that.clearBoard(); break; - case 'close': - that.closeBoard(); - break; } }); // footer +code, +text button @@ -614,18 +608,21 @@ define([ }); fileNavi.open(); } - viewDepthInfo() { - this.state.viewDepthNumber = !this.state.viewDepthNumber; - - if (this.state.viewDepthNumber) { - $(this.wrapSelector('.vp-board-header-button-inner li[data-menu="view-depth"]')).text('Hide Depth Number'); - } else { - $(this.wrapSelector('.vp-board-header-button-inner li[data-menu="view-depth"]')).text('View Depth Number'); - } - - // reloadBlockList - this.reloadBlockList(); - } + /** + * Deprecated on v2.0.2. + */ + // viewDepthInfo() { + // this.state.viewDepthNumber = !this.state.viewDepthNumber; + + // if (this.state.viewDepthNumber) { + // $(this.wrapSelector('.vp-board-header-button-inner li[data-menu="view-depth"]')).text('Hide Depth Number'); + // } else { + // $(this.wrapSelector('.vp-board-header-button-inner li[data-menu="view-depth"]')).text('View Depth Number'); + // } + + // // reloadBlockList + // this.reloadBlockList(); + // } clearBoard() { // TODO: alert before clearing let that = this; @@ -638,9 +635,12 @@ define([ // render block list this.reloadBlockList(); } - closeBoard() { - this.createNewNote(); - } + /** + * Deprecated on v2.0.2. + */ + // closeBoard() { + // this.createNewNote(); + // } //======================================================================== // Block control //======================================================================== From dfecdd2da43b468525c1f52303fd68adaab6e6b9 Mon Sep 17 00:00:00 2001 From: minjk-bl Date: Thu, 3 Feb 2022 14:37:33 +0900 Subject: [PATCH 36/38] Fix version checker --- js/com/com_Config.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/js/com/com_Config.js b/js/com/com_Config.js index a4017342..daff8494 100644 --- a/js/com/com_Config.js +++ b/js/com/com_Config.js @@ -388,11 +388,12 @@ define([ } else { let msg = com_util.formatString('Visualpython updates are available.
    (Latest version: {0} / Your version: {1})', latestVersion, nowVersion); + // show version update icon + $('#vp_versionUpdater').attr('title', msg); + $('#vp_versionUpdater').data('version', latestVersion); + $('#vp_versionUpdater').show(); if (background) { - // show version update icon - $('#vp_versionUpdater').attr('title', msg); - $('#vp_versionUpdater').data('version', latestVersion); - $('#vp_versionUpdater').show(); + ; } else { // render update modal (same as menu/MenuFrame.js:_bindEvent()-Click version updater) com_util.renderModal({ From e950555119e1a434ea7e688d1b35f1cb82b3c7cd Mon Sep 17 00:00:00 2001 From: minjk-bl Date: Thu, 3 Feb 2022 16:30:24 +0900 Subject: [PATCH 37/38] Fix FileNavigation --- js/com/component/FileNavigation.js | 66 ++++++------------------------ 1 file changed, 13 insertions(+), 53 deletions(-) diff --git a/js/com/component/FileNavigation.js b/js/com/component/FileNavigation.js index 719c4361..5c209587 100644 --- a/js/com/component/FileNavigation.js +++ b/js/com/component/FileNavigation.js @@ -313,9 +313,17 @@ define([ // if it's outside of notebookPath, ignore notebookPath var prevLength = notebookPathStrLength; var useSidebar = false; - if (currentRelativePathStrArray.includes('..')) { - prevLength = 0; - useSidebar = true; + if (currentRelativePathStr.includes('..')) { + var upperList = currentRelativePathStr.match(/(\.\.\/)/g); + if (upperList && upperList.length > 0) { + // in case, currentRelativePathStr = ../../somePathHere + prevLength -= upperList.length * 3; // 3 = length of '../' upper path string + useSidebar = true; + } else { + // in case, currentRelativePathStr = .. + prevLength = 0; + useSidebar = true; + } } let slashStr = '/'; currentRelativePathStrArray.forEach((pathToken,index) => { @@ -447,54 +455,7 @@ define([ var fileNavigationState = this.pathState; var baseFolder = fileNavigationState.baseFolder; - var baseDirStr = fileNavigationState.baseDir; - var noteBookPathStr = fileNavigationState.notebookPath; var currentDirStr = fileNavigationState.currentPath; - var noteBookPathStrLength = noteBookPathStr.length; - - var baseDirStrLength = baseDirStr.length; - - /** upDirectoryCount: - * count how many times went up to the parent path, since file navigation opened - */ - var upDirectoryCount = 0; - var _upDirectoryCount = 0; - - var splitedNoteBookPathStrArray = noteBookPathStr.split('/'); - var splitedBaseDirArray = baseDirStr.split('/'); - var splitedCurrentDirArray = currentDirStr.split('/'); - - var relativeBaseDirArray = splitedBaseDirArray.slice(splitedNoteBookPathStrArray.length, splitedBaseDirArray.length); - var relativeCurrentDirArray = splitedCurrentDirArray.slice(splitedNoteBookPathStrArray.length, splitedCurrentDirArray.length); - - /** - * compare base path and notebook path, increase upDirectoryCount - */ - var _baseDirStrLength = baseDirStrLength; - while ( noteBookPathStrLength < _baseDirStrLength ) { - _baseDirStrLength--; - if ( baseDirStr[_baseDirStrLength] === '/') { - upDirectoryCount += 1; - } - } - - /** - * Compare notebook path and current relative path, decrease upDirectoryCount - */ - relativeCurrentDirArray.forEach((forderName,index) => { - if ( forderName === relativeBaseDirArray[index] ) { - upDirectoryCount -= 1; - } - }); - - /** - * Add ../ based on upDirectoryCount - */ - _upDirectoryCount = upDirectoryCount; - var prefixUpDirectory = ``; - while (_upDirectoryCount-- > 0) { - prefixUpDirectory += `../`; - } var slashstr = `/`; if (relativeDirPath === '') { @@ -504,10 +465,9 @@ define([ var pathInput = ''; var fileInput = `${filePathStr}`; // if baseFolder doesn't exist in current path - if (upDirectoryCount > 0 - && currentDirStr.indexOf(baseFolder) === -1) { + if (currentDirStr.indexOf(baseFolder) === -1) { - pathInput = `${prefixUpDirectory}${relativeDirPath}${slashstr}${filePathStr}`; + pathInput = `${relativeDirPath}${slashstr}${filePathStr}`; } else { // if baseFolder exists in current path pathInput = `./${relativeDirPath}${slashstr}${filePathStr}`; From d4d9e26c0b9f6b643539bc9534da7dd17fe826db Mon Sep 17 00:00:00 2001 From: minjk-bl Date: Thu, 3 Feb 2022 18:03:16 +0900 Subject: [PATCH 38/38] Fix FileNavigation --- js/com/component/FileNavigation.js | 45 +----------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/js/com/component/FileNavigation.js b/js/com/component/FileNavigation.js index 5c209587..671ed9d7 100644 --- a/js/com/component/FileNavigation.js +++ b/js/com/component/FileNavigation.js @@ -222,7 +222,7 @@ define([ that.getFileList(dirObj); } else { - let dirPath = that.makeNewCurrRelativePath(); + let dirPath = that.getRelativePath(that.pathState.baseDir, that.pathState.currentPath); let extension = name.substring(name.lastIndexOf('.') + 1); let allowExtensionList = that.state.extensions; // if it is not allowed extension @@ -642,49 +642,6 @@ define([ } } - /** - * Make relative path using current path - * @returns - */ - makeNewCurrRelativePath() { - var pathState = this.pathState; - var dirPath = pathState.relativeDir; - /** - * current path on opening file navigation - * ex) if current path is 'C:/Users/VP/Desktop/Test' - * baseFolder = 'Test' - */ - var baseFolder = pathState.baseFolder; - /** - * base folder for jupyter notebook - * ex) if current path is 'C:/Users/VP/Desktop/Test' - * Jupyter.notebook.notebook_path = 'Desktop/Test/Untitled.ipynb' - * notebookFolder = 'Desktop' - */ - var noteBookFolder = pathState.notebookFolder; - - - /** if baseFolder is included in current relative path */ - if (dirPath.indexOf(baseFolder) !== -1) { - var baseFolderIndex = dirPath.indexOf(baseFolder); - dirPath = dirPath.substring(baseFolderIndex,dirPath.length); - dirPath = dirPath.replace(baseFolder, ''); - } - - /** - * if baseFolder is same with noteBookFolder, - * not replacing notebookFolder inside dirPath - * */ - if (baseFolder !== noteBookFolder) { - dirPath = dirPath.replace(noteBookFolder, ''); - } - - if (dirPath[0] === '/') { - dirPath = dirPath.substring(1, dirPath.length); - } - return dirPath; - } - splitPathStrAndSetStack(dirObj, resultInfoArr){ var currentDirStr = resultInfoArr[0].current.split('//').join('/'); var splitedDirStrArr = currentDirStr.split('/');