From 890b7e6372b0b7379f90844c938853f568b96ecc Mon Sep 17 00:00:00 2001 From: DavidKutu Date: Wed, 29 Jul 2020 12:47:17 -0700 Subject: [PATCH 01/10] add status bar --- .../datascience/gather/gatherListener.ts | 41 ++++++++++++------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/client/datascience/gather/gatherListener.ts b/src/client/datascience/gather/gatherListener.ts index 95de52b5d94b..63b0c2193e61 100644 --- a/src/client/datascience/gather/gatherListener.ts +++ b/src/client/datascience/gather/gatherListener.ts @@ -1,7 +1,7 @@ import { inject, injectable } from 'inversify'; import { IDisposable } from 'monaco-editor'; import * as uuid from 'uuid/v4'; -import { Event, EventEmitter, Position, Uri, ViewColumn } from 'vscode'; +import { Event, EventEmitter, Position, StatusBarItem, Uri, ViewColumn } from 'vscode'; import { createMarkdownCell } from '../../../datascience-ui/common/cellFactory'; import { IApplicationShell, IDocumentManager } from '../../common/application/types'; import { PYTHON_LANGUAGE } from '../../common/constants'; @@ -9,7 +9,7 @@ import { traceError } from '../../common/logger'; import { IConfigurationService, Resource } from '../../common/types'; import * as localize from '../../common/utils/localize'; -import { noop } from '../../common/utils/misc'; +// import { noop } from '../../common/utils/misc'; import { StopWatch } from '../../common/utils/stopWatch'; import { sendTelemetryEvent } from '../../telemetry'; import { generateCellsFromString } from '../cellFactory'; @@ -45,6 +45,7 @@ export class GatherListener implements IInteractiveWindowListener { private gatherTimer: StopWatch | undefined; private linesSubmitted: number = 0; private cellsSubmitted: number = 0; + private statusBar: StatusBarItem; constructor( @inject(IApplicationShell) private applicationShell: IApplicationShell, @@ -54,10 +55,14 @@ export class GatherListener implements IInteractiveWindowListener { @inject(IConfigurationService) private configService: IConfigurationService, @inject(IDocumentManager) private documentManager: IDocumentManager, @inject(IDataScienceFileSystem) private fs: IDataScienceFileSystem - ) {} + ) { + this.statusBar = this.applicationShell.createStatusBarItem(); + this.statusBar.text = '$(sync~spin) Gathering Code'; + } public dispose() { - noop(); + // noop(); + this.statusBar.dispose(); } // tslint:disable-next-line: no-any @@ -73,10 +78,12 @@ export class GatherListener implements IInteractiveWindowListener { break; case InteractiveWindowMessages.GatherCode: + this.statusBar.show(); this.handleMessage(message, payload, this.doGather); break; case InteractiveWindowMessages.GatherCodeToScript: + this.statusBar.show(); this.handleMessage(message, payload, this.doGatherToScript); break; @@ -141,18 +148,24 @@ export class GatherListener implements IInteractiveWindowListener { } } - private doGather(payload: ICell): void { - this.gatherCodeInternal(payload).catch((err) => { - traceError(`Gather to Notebook error: ${err}`); - this.applicationShell.showErrorMessage(err); - }); + private doGather(payload: ICell): Promise { + return this.gatherCodeInternal(payload) + .catch((err) => { + traceError(`Gather to Notebook error: ${err}`); + this.applicationShell.showErrorMessage(err); + }) + .finally(() => { + this.statusBar.hide(); + }); } - private doGatherToScript(payload: ICell): void { - this.gatherCodeInternal(payload, true).catch((err) => { - traceError(`Gather to Script error: ${err}`); - this.applicationShell.showErrorMessage(err); - }); + private doGatherToScript(payload: ICell): Promise { + return this.gatherCodeInternal(payload, true) + .catch((err) => { + traceError(`Gather to Script error: ${err}`); + this.applicationShell.showErrorMessage(err); + }) + .finally(() => this.statusBar.hide()); } private gatherCodeInternal = async (cell: ICell, toScript: boolean = false) => { From 25ae4e3be63e27c8b80fc9eaba4fb76f70e45bc7 Mon Sep 17 00:00:00 2001 From: DavidKutu Date: Fri, 31 Jul 2020 15:02:02 -0700 Subject: [PATCH 02/10] add localization --- package.nls.json | 13 +++++++------ src/client/common/utils/localize.ts | 1 + src/client/datascience/gather/gatherListener.ts | 8 ++------ 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/package.nls.json b/package.nls.json index d238d0acf98c..3c5e014e3413 100644 --- a/package.nls.json +++ b/package.nls.json @@ -486,6 +486,7 @@ "DataScience.findJupyterCommandProgressCheckInterpreter": "Checking {0}.", "DataScience.findJupyterCommandProgressSearchCurrentPath": "Searching current path.", "DataScience.gatherError": "Gather internal error", + "DataScience.gatherStatusBar": "$(sync~spin) Gathering Code", "DataScience.gatheredScriptDescription": "# This file was generated by the Gather Extension.\n# It requires version 2020.7.94776 (or newer) of the Python Extension.\n#\n# The intent is that it contains only the code required to produce\n# the same results as the cell originally selected for gathering.\n# Please note that the Python analysis is quite conservative, so if\n# it is unsure whether a line of code is necessary for execution, it\n# will err on the side of including it.\n#\n# Please let us know if you are satisfied with what was gathered here:\n# https://aka.ms/gathersurvey\n\n", "DataScience.gatheredNotebookDescriptionInMarkdown": "## Gathered Notebook\nGathered from ```{0}```\n\n| | |\n|---|---|\n|   |This notebook was generated by the Gather Extension. It requires version 2020.7.94776 (or newer) of the Python Extension, please update [here](https://command:python.datascience.latestExtension). The intent is that it contains only the code and cells required to produce the same results as the cell originally selected for gathering. Please note that the Python analysis is quite conservative, so if it is unsure whether a line of code is necessary for execution, it will err on the side of including it.|\n\n**Are you satisfied with the code that was gathered?**\n\n[Yes](https://command:python.datascience.gatherquality?yes) [No](https://command:python.datascience.gatherquality?no)", "DataScience.savePngTitle": "Save Image", @@ -570,10 +571,10 @@ "DataScienceRendererExtension.downloadCompletedOutputMessage": "Notebook Renderers extension download complete.", "DataScience.uriProviderDescriptionFormat": "{0} (From {1} extension)", "DataScience.unknownPackage": "unknown", - "DataScience.interactiveWindowTitle" : "Python Interactive", - "DataScience.interactiveWindowTitleFormat" : "Python Interactive - {0}", - "DataScience.interactiveWindowModeBannerTitle" : "Do you want to open a new Python Interactive window for this file? [More Information](command:workbench.action.openSettings?%5B%22python.dataScience.interactiveWindowMode%22%5D).", - "DataScience.interactiveWindowModeBannerSwitchYes" : "Yes", - "DataScience.interactiveWindowModeBannerSwitchAlways" : "Always", - "DataScience.interactiveWindowModeBannerSwitchNo" : "No" + "DataScience.interactiveWindowTitle": "Python Interactive", + "DataScience.interactiveWindowTitleFormat": "Python Interactive - {0}", + "DataScience.interactiveWindowModeBannerTitle": "Do you want to open a new Python Interactive window for this file? [More Information](command:workbench.action.openSettings?%5B%22python.dataScience.interactiveWindowMode%22%5D).", + "DataScience.interactiveWindowModeBannerSwitchYes": "Yes", + "DataScience.interactiveWindowModeBannerSwitchAlways": "Always", + "DataScience.interactiveWindowModeBannerSwitchNo": "No" } diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index 2c66b1c48241..4cc509d0674b 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -923,6 +923,7 @@ export namespace DataScience { 'Searching current path.' ); export const gatherError = localize('DataScience.gatherError', 'Gather internal error'); + export const gatherStatusBar = localize('DataScience.gatherStatusBar', '$(sync~spin) Gathering Code'); export const gatheredScriptDescription = localize( 'DataScience.gatheredScriptDescription', '# This file was generated by the Gather Extension.\n# It requires version 2020.7.94776 (or newer) of the Python Extension.\n#\n# The intent is that it contains only the code required to produce\n# the same results as the cell originally selected for gathering.\n# Please note that the Python analysis is quite conservative, so if\n# it is unsure whether a line of code is necessary for execution, it\n# will err on the side of including it.\n#\n# Please let us know if you are satisfied with what was gathered here:\n# https://aka.ms/gathersurvey\n\n' diff --git a/src/client/datascience/gather/gatherListener.ts b/src/client/datascience/gather/gatherListener.ts index d91028c4a806..b3504504569b 100644 --- a/src/client/datascience/gather/gatherListener.ts +++ b/src/client/datascience/gather/gatherListener.ts @@ -10,7 +10,6 @@ import { traceError } from '../../common/logger'; import type { nbformat } from '@jupyterlab/coreutils'; import { IConfigurationService, Resource } from '../../common/types'; import * as localize from '../../common/utils/localize'; -// import { noop } from '../../common/utils/misc'; import { StopWatch } from '../../common/utils/stopWatch'; import { sendTelemetryEvent } from '../../telemetry'; import { generateCellsFromString } from '../cellFactory'; @@ -58,11 +57,10 @@ export class GatherListener implements IInteractiveWindowListener { @inject(IDataScienceFileSystem) private fs: IDataScienceFileSystem ) { this.statusBar = this.applicationShell.createStatusBarItem(); - this.statusBar.text = '$(sync~spin) Gathering Code'; + this.statusBar.text = localize.DataScience.gatherStatusBar(); } public dispose() { - // noop(); this.statusBar.dispose(); } @@ -155,9 +153,7 @@ export class GatherListener implements IInteractiveWindowListener { traceError(`Gather to Notebook error: ${err}`); this.applicationShell.showErrorMessage(err); }) - .finally(() => { - this.statusBar.hide(); - }); + .finally(() => this.statusBar.hide()); } private doGatherToScript(payload: ICell): Promise { From 6c5acf1902b2f3a9b04fd1bdc093f756cbcaebb0 Mon Sep 17 00:00:00 2001 From: DavidKutu Date: Fri, 31 Jul 2020 15:04:17 -0700 Subject: [PATCH 03/10] Added news file --- news/1 Enhancements/13177.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/1 Enhancements/13177.md diff --git a/news/1 Enhancements/13177.md b/news/1 Enhancements/13177.md new file mode 100644 index 000000000000..c5e057a8f15e --- /dev/null +++ b/news/1 Enhancements/13177.md @@ -0,0 +1 @@ +The status bar will show 'Gathering code' while gather is executing. From bbc682cabc46efb4c0de27d32fa583160cd00b92 Mon Sep 17 00:00:00 2001 From: DavidKutu Date: Fri, 31 Jul 2020 15:09:37 -0700 Subject: [PATCH 04/10] add a 2 second timeout --- src/client/datascience/gather/gatherListener.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client/datascience/gather/gatherListener.ts b/src/client/datascience/gather/gatherListener.ts index b3504504569b..76a62d8f912d 100644 --- a/src/client/datascience/gather/gatherListener.ts +++ b/src/client/datascience/gather/gatherListener.ts @@ -77,12 +77,16 @@ export class GatherListener implements IInteractiveWindowListener { break; case InteractiveWindowMessages.GatherCode: - this.statusBar.show(); + setTimeout(() => { + this.statusBar.show(); + }, 2000); this.handleMessage(message, payload, this.doGather); break; case InteractiveWindowMessages.GatherCodeToScript: - this.statusBar.show(); + setTimeout(() => { + this.statusBar.show(); + }, 2000); this.handleMessage(message, payload, this.doGatherToScript); break; From 03821b01a3db4f500b80233993cf1f4a62f6c572 Mon Sep 17 00:00:00 2001 From: DavidKutu Date: Fri, 31 Jul 2020 16:16:50 -0700 Subject: [PATCH 05/10] updated the gather survey link --- package.nls.json | 2 +- src/client/common/utils/localize.ts | 2 +- src/client/datascience/commands/commandRegistry.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.nls.json b/package.nls.json index 3c5e014e3413..63da8c1ad4dd 100644 --- a/package.nls.json +++ b/package.nls.json @@ -487,7 +487,7 @@ "DataScience.findJupyterCommandProgressSearchCurrentPath": "Searching current path.", "DataScience.gatherError": "Gather internal error", "DataScience.gatherStatusBar": "$(sync~spin) Gathering Code", - "DataScience.gatheredScriptDescription": "# This file was generated by the Gather Extension.\n# It requires version 2020.7.94776 (or newer) of the Python Extension.\n#\n# The intent is that it contains only the code required to produce\n# the same results as the cell originally selected for gathering.\n# Please note that the Python analysis is quite conservative, so if\n# it is unsure whether a line of code is necessary for execution, it\n# will err on the side of including it.\n#\n# Please let us know if you are satisfied with what was gathered here:\n# https://aka.ms/gathersurvey\n\n", + "DataScience.gatheredScriptDescription": "# This file was generated by the Gather Extension.\n# It requires version 2020.7.94776 (or newer) of the Python Extension.\n#\n# The intent is that it contains only the code required to produce\n# the same results as the cell originally selected for gathering.\n# Please note that the Python analysis is quite conservative, so if\n# it is unsure whether a line of code is necessary for execution, it\n# will err on the side of including it.\n#\n# Please let us know if you are satisfied with what was gathered here:\n# https://aka.ms/gatherfeedback\n\n", "DataScience.gatheredNotebookDescriptionInMarkdown": "## Gathered Notebook\nGathered from ```{0}```\n\n| | |\n|---|---|\n|   |This notebook was generated by the Gather Extension. It requires version 2020.7.94776 (or newer) of the Python Extension, please update [here](https://command:python.datascience.latestExtension). The intent is that it contains only the code and cells required to produce the same results as the cell originally selected for gathering. Please note that the Python analysis is quite conservative, so if it is unsure whether a line of code is necessary for execution, it will err on the side of including it.|\n\n**Are you satisfied with the code that was gathered?**\n\n[Yes](https://command:python.datascience.gatherquality?yes) [No](https://command:python.datascience.gatherquality?no)", "DataScience.savePngTitle": "Save Image", "DataScience.jupyterSelectURIQuickPickTitle": "Pick how to connect to Jupyter", diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index 4cc509d0674b..c86d96f0f7f1 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -926,7 +926,7 @@ export namespace DataScience { export const gatherStatusBar = localize('DataScience.gatherStatusBar', '$(sync~spin) Gathering Code'); export const gatheredScriptDescription = localize( 'DataScience.gatheredScriptDescription', - '# This file was generated by the Gather Extension.\n# It requires version 2020.7.94776 (or newer) of the Python Extension.\n#\n# The intent is that it contains only the code required to produce\n# the same results as the cell originally selected for gathering.\n# Please note that the Python analysis is quite conservative, so if\n# it is unsure whether a line of code is necessary for execution, it\n# will err on the side of including it.\n#\n# Please let us know if you are satisfied with what was gathered here:\n# https://aka.ms/gathersurvey\n\n' + '# This file was generated by the Gather Extension.\n# It requires version 2020.7.94776 (or newer) of the Python Extension.\n#\n# The intent is that it contains only the code required to produce\n# the same results as the cell originally selected for gathering.\n# Please note that the Python analysis is quite conservative, so if\n# it is unsure whether a line of code is necessary for execution, it\n# will err on the side of including it.\n#\n# Please let us know if you are satisfied with what was gathered here:\n# https://aka.ms/gatherfeedback\n\n' ); export const gatheredNotebookDescriptionInMarkdown = localize( 'DataScience.gatheredNotebookDescriptionInMarkdown', diff --git a/src/client/datascience/commands/commandRegistry.ts b/src/client/datascience/commands/commandRegistry.ts index 351010af74ff..75886683c6ac 100644 --- a/src/client/datascience/commands/commandRegistry.ts +++ b/src/client/datascience/commands/commandRegistry.ts @@ -397,7 +397,7 @@ export class CommandRegistry implements IDisposable { private reportGatherQuality(val: string) { sendTelemetryEvent(Telemetry.GatherQualityReport, undefined, { result: val[0] === 'no' ? 'no' : 'yes' }); - env.openExternal(Uri.parse(`https://aka.ms/gathersurvey?succeed=${val[0]}`)); + env.openExternal(Uri.parse(`https://aka.ms/gatherfeedback?succeed=${val[0]}`)); } private openPythonExtensionPage() { From 4a88ac3133b1e11dfbc07442772ce164ccb91937 Mon Sep 17 00:00:00 2001 From: DavidKutu Date: Wed, 5 Aug 2020 11:56:19 -0700 Subject: [PATCH 06/10] Change the gather icon while gathering --- .../datascience/gather/gatherListener.ts | 24 +++++++++++-- .../interactiveWindowTypes.ts | 3 ++ .../interactive-common/synchronization.ts | 1 + .../history-react/interactiveCell.tsx | 7 +++- .../history-react/interactivePanel.less | 24 +++++++++---- .../history-react/redux/reducers/execution.ts | 24 +++++++++++-- .../history-react/redux/reducers/index.ts | 3 +- .../interactive-common/mainState.ts | 7 ++-- .../redux/reducers/types.ts | 5 +++ .../native-editor/nativeCell.tsx | 4 +-- .../native-editor/nativeEditor.less | 35 +++++++++++++------ .../native-editor/redux/reducers/creation.ts | 6 ++-- .../native-editor/redux/reducers/execution.ts | 21 +++++++++++ .../native-editor/redux/reducers/index.ts | 1 + src/datascience-ui/react-common/image.tsx | 7 +++- .../react-common/images/Sync/sync-inverse.svg | 3 ++ .../react-common/images/Sync/sync.svg | 3 ++ .../interactivePanel.functional.test.tsx | 3 +- src/test/datascience/mainState.unit.test.ts | 3 +- 19 files changed, 152 insertions(+), 32 deletions(-) create mode 100644 src/datascience-ui/react-common/images/Sync/sync-inverse.svg create mode 100644 src/datascience-ui/react-common/images/Sync/sync.svg diff --git a/src/client/datascience/gather/gatherListener.ts b/src/client/datascience/gather/gatherListener.ts index 76a62d8f912d..3d65877390be 100644 --- a/src/client/datascience/gather/gatherListener.ts +++ b/src/client/datascience/gather/gatherListener.ts @@ -77,6 +77,10 @@ export class GatherListener implements IInteractiveWindowListener { break; case InteractiveWindowMessages.GatherCode: + this.postEmitter.fire({ + message: InteractiveWindowMessages.Gathering, + payload: { cellId: payload.id, gathering: true } + }); setTimeout(() => { this.statusBar.show(); }, 2000); @@ -84,6 +88,10 @@ export class GatherListener implements IInteractiveWindowListener { break; case InteractiveWindowMessages.GatherCodeToScript: + this.postEmitter.fire({ + message: InteractiveWindowMessages.Gathering, + payload: { cellId: payload.id, gathering: true } + }); setTimeout(() => { this.statusBar.show(); }, 2000); @@ -157,7 +165,13 @@ export class GatherListener implements IInteractiveWindowListener { traceError(`Gather to Notebook error: ${err}`); this.applicationShell.showErrorMessage(err); }) - .finally(() => this.statusBar.hide()); + .finally(() => { + this.postEmitter.fire({ + message: InteractiveWindowMessages.Gathering, + payload: { cellId: payload.id, gathering: false } + }); + this.statusBar.hide(); + }); } private doGatherToScript(payload: ICell): Promise { @@ -166,7 +180,13 @@ export class GatherListener implements IInteractiveWindowListener { traceError(`Gather to Script error: ${err}`); this.applicationShell.showErrorMessage(err); }) - .finally(() => this.statusBar.hide()); + .finally(() => { + this.postEmitter.fire({ + message: InteractiveWindowMessages.Gathering, + payload: { cellId: payload.id, gathering: false } + }); + this.statusBar.hide(); + }); } private gatherCodeInternal = async (cell: ICell, toScript: boolean = false) => { diff --git a/src/client/datascience/interactive-common/interactiveWindowTypes.ts b/src/client/datascience/interactive-common/interactiveWindowTypes.ts index 834332286ed7..c3b9d48af90b 100644 --- a/src/client/datascience/interactive-common/interactiveWindowTypes.ts +++ b/src/client/datascience/interactive-common/interactiveWindowTypes.ts @@ -10,6 +10,7 @@ import { DebugProtocol } from 'vscode-debugprotocol'; import { CommonActionType, IAddCellAction, + IChangeGatherStatus, ILoadIPyWidgetClassFailureAction, IVariableExplorerHeight, LoadIPyWidgetClassLoadAction, @@ -98,6 +99,7 @@ export enum InteractiveWindowMessages { StopDebugging = 'stop_debugging', GatherCode = 'gather_code', GatherCodeToScript = 'gather_code_to_script', + Gathering = 'gathering', LaunchNotebookTrustPrompt = 'launch_notebook_trust_prompt', TrustNotebookComplete = 'trust_notebook_complete', LoadAllCells = 'load_all_cells', @@ -630,6 +632,7 @@ export class IInteractiveWindowMapping { public [InteractiveWindowMessages.StopDebugging]: never | undefined; public [InteractiveWindowMessages.GatherCode]: ICell; public [InteractiveWindowMessages.GatherCodeToScript]: ICell; + public [InteractiveWindowMessages.Gathering]: IChangeGatherStatus; public [InteractiveWindowMessages.LaunchNotebookTrustPrompt]: never | undefined; public [InteractiveWindowMessages.TrustNotebookComplete]: never | undefined; public [InteractiveWindowMessages.LoadAllCells]: ILoadAllCells; diff --git a/src/client/datascience/interactive-common/synchronization.ts b/src/client/datascience/interactive-common/synchronization.ts index face994ec0cf..7a0fd4394ae2 100644 --- a/src/client/datascience/interactive-common/synchronization.ts +++ b/src/client/datascience/interactive-common/synchronization.ts @@ -129,6 +129,7 @@ const messageWithMessageTypes: MessageMapping & Messa [InteractiveWindowMessages.FocusedCellEditor]: MessageType.syncWithLiveShare, [InteractiveWindowMessages.GatherCode]: MessageType.other, [InteractiveWindowMessages.GatherCodeToScript]: MessageType.other, + [InteractiveWindowMessages.Gathering]: MessageType.other, [InteractiveWindowMessages.GetAllCells]: MessageType.other, [InteractiveWindowMessages.ForceVariableRefresh]: MessageType.other, [InteractiveWindowMessages.GetVariablesRequest]: MessageType.other, diff --git a/src/datascience-ui/history-react/interactiveCell.tsx b/src/datascience-ui/history-react/interactiveCell.tsx index c5e844c08ff2..d60869630421 100644 --- a/src/datascience-ui/history-react/interactiveCell.tsx +++ b/src/datascience-ui/history-react/interactiveCell.tsx @@ -195,8 +195,13 @@ export class InteractiveCell extends React.Component { !this.props.settings.gatherIsInstalled } tooltip={getLocString('DataScience.gatherCodeTooltip', 'Gather code')} + disabled={this.props.cellVM.gathering} > - + div { +.cell-output > div { background: var(--override-widget-background, var(--vscode-notifications-background)); } xmp { margin: 0px; -} +} .cell-input { margin: 0; @@ -72,4 +71,17 @@ xmp { white-space: pre-wrap; word-break: break-all; overflow-x: hidden; -} \ No newline at end of file +} + +.rotate { + animation: rotation 2s infinite linear; +} + +@keyframes rotation { + from { + transform: rotate(0deg); + } + to { + transform: rotate(359deg); + } +} diff --git a/src/datascience-ui/history-react/redux/reducers/execution.ts b/src/datascience-ui/history-react/redux/reducers/execution.ts index 1605cc79f8c5..516becb59a99 100644 --- a/src/datascience-ui/history-react/redux/reducers/execution.ts +++ b/src/datascience-ui/history-react/redux/reducers/execution.ts @@ -10,10 +10,10 @@ import { InteractiveWindowMessages } from '../../../../client/datascience/intera import { CellState } from '../../../../client/datascience/types'; import { generateMarkdownFromCodeLines } from '../../../common'; import { createCellFrom } from '../../../common/cellFactory'; -import { createCellVM, IMainState } from '../../../interactive-common/mainState'; +import { createCellVM, ICellViewModel, IMainState } from '../../../interactive-common/mainState'; import { postActionToExtension } from '../../../interactive-common/redux/helpers'; import { Helpers } from '../../../interactive-common/redux/reducers/helpers'; -import { ICodeAction } from '../../../interactive-common/redux/reducers/types'; +import { IChangeGatherStatus, ICodeAction } from '../../../interactive-common/redux/reducers/types'; import { InteractiveReducerArg } from '../mapping'; import { Creation } from './creation'; @@ -127,4 +127,24 @@ export namespace Execution { } return arg.prevState; } + + export function gathering(arg: InteractiveReducerArg): IMainState { + const index = arg.prevState.cellVMs.findIndex((c) => c.cell.id === arg.payload.data.cellId); + if (index >= 0) { + const cellVMs = [...arg.prevState.cellVMs]; + const current = arg.prevState.cellVMs[index]; + const newCell: ICellViewModel = { + ...current, + gathering: arg.payload.data.gathering + }; + cellVMs[index] = newCell; + + return { + ...arg.prevState, + cellVMs + }; + } + + return arg.prevState; + } } diff --git a/src/datascience-ui/history-react/redux/reducers/index.ts b/src/datascience-ui/history-react/redux/reducers/index.ts index 023bf4fc8703..95e8f684ec78 100644 --- a/src/datascience-ui/history-react/redux/reducers/index.ts +++ b/src/datascience-ui/history-react/redux/reducers/index.ts @@ -71,5 +71,6 @@ export const reducerMap: Partial = { [InteractiveWindowMessages.UpdateKernel]: Kernel.updateStatus, [SharedMessages.LocInit]: CommonEffects.handleLocInit, [InteractiveWindowMessages.UpdateDisplayData]: CommonEffects.handleUpdateDisplayData, - [InteractiveWindowMessages.HasCell]: Transfer.hasCell + [InteractiveWindowMessages.HasCell]: Transfer.hasCell, + [InteractiveWindowMessages.Gathering]: Execution.gathering }; diff --git a/src/datascience-ui/interactive-common/mainState.ts b/src/datascience-ui/interactive-common/mainState.ts index f5327ea54760..a134981f92e2 100644 --- a/src/datascience-ui/interactive-common/mainState.ts +++ b/src/datascience-ui/interactive-common/mainState.ts @@ -56,6 +56,7 @@ export interface ICellViewModel { uiSideError?: string; runningByLine: DebugState; currentStack?: DebugProtocol.StackFrame[]; + gathering: boolean; } export type IMainState = { @@ -227,7 +228,8 @@ export function createEditableCellVM(executionCount: number): ICellViewModel { cursorPos: CursorPos.Current, hasBeenRun: false, scrollCount: 0, - runningByLine: DebugState.Design + runningByLine: DebugState.Design, + gathering: false }; } @@ -281,7 +283,8 @@ export function createCellVM( hasBeenRun: false, scrollCount: 0, runDuringDebug, - runningByLine: DebugState.Design + runningByLine: DebugState.Design, + gathering: false }; // Update the input text diff --git a/src/datascience-ui/interactive-common/redux/reducers/types.ts b/src/datascience-ui/interactive-common/redux/reducers/types.ts index 9a6b47fc28cc..40b9b9c140da 100644 --- a/src/datascience-ui/interactive-common/redux/reducers/types.ts +++ b/src/datascience-ui/interactive-common/redux/reducers/types.ts @@ -257,4 +257,9 @@ export type NotifyIPyWidgeWidgetVersionNotSupportedAction = { moduleVersion: string; }; +export interface IChangeGatherStatus { + cellId: string; + gathering: boolean; +} + export type CommonAction = ActionWithPayload; diff --git a/src/datascience-ui/native-editor/nativeCell.tsx b/src/datascience-ui/native-editor/nativeCell.tsx index 625a53c98990..c3b0d2a31c48 100644 --- a/src/datascience-ui/native-editor/nativeCell.tsx +++ b/src/datascience-ui/native-editor/nativeCell.tsx @@ -708,12 +708,12 @@ export class NativeCell extends React.Component { 'Gather the code required to generate this cell into a new notebook' )} hidden={gatherDisabled} - disabled={!this.props.isNotebookTrusted} + disabled={!this.props.isNotebookTrusted || this.props.cellVM.gathering} > ): IMainState { + const index = arg.prevState.cellVMs.findIndex((c) => c.cell.id === arg.payload.data.cellId); + if (index >= 0) { + const cellVMs = [...arg.prevState.cellVMs]; + const current = arg.prevState.cellVMs[index]; + const newCell: ICellViewModel = { + ...current, + gathering: arg.payload.data.gathering + }; + cellVMs[index] = newCell; + + return { + ...arg.prevState, + cellVMs + }; + } + + return arg.prevState; + } + export function undo(arg: NativeEditorReducerArg): IMainState { if (arg.prevState.undoStack.length > 0) { // Pop one off of our undo stack and update our redo diff --git a/src/datascience-ui/native-editor/redux/reducers/index.ts b/src/datascience-ui/native-editor/redux/reducers/index.ts index 86bb80258c7a..4a346c11065c 100644 --- a/src/datascience-ui/native-editor/redux/reducers/index.ts +++ b/src/datascience-ui/native-editor/redux/reducers/index.ts @@ -57,6 +57,7 @@ export const reducerMap: Partial = { [CommonActionType.LINK_CLICK]: Transfer.linkClick, [CommonActionType.GATHER_CELL]: Transfer.gather, [CommonActionType.GATHER_CELL_TO_SCRIPT]: Transfer.gatherToScript, + [InteractiveWindowMessages.Gathering]: Execution.gathering, [CommonActionType.EDITOR_LOADED]: Transfer.started, [CommonActionType.LOADED_ALL_CELLS]: Transfer.loadedAllCells, [CommonActionType.LAUNCH_NOTEBOOK_TRUST_PROMPT]: Transfer.launchNotebookTrustPrompt, diff --git a/src/datascience-ui/react-common/image.tsx b/src/datascience-ui/react-common/image.tsx index 6248f8f789d0..740e6aa5d66d 100644 --- a/src/datascience-ui/react-common/image.tsx +++ b/src/datascience-ui/react-common/image.tsx @@ -51,7 +51,8 @@ export enum ImageName { Python, PythonColor, OpenFolder, - RunByLine + RunByLine, + Sync } // All of the images must be 'require' so that webpack doesn't rewrite the import as requiring a .default. @@ -226,6 +227,10 @@ const images: { [key: string]: { light: string; dark: string } } = { RunByLine: { light: require('./images/RunByLine/runbyline_light.svg'), dark: require('./images/RunByLine/runbyline_dark.svg') + }, + Sync: { + light: require('./images/Sync/sync.svg'), + dark: require('./images/Sync/sync-inverse.svg') } }; diff --git a/src/datascience-ui/react-common/images/Sync/sync-inverse.svg b/src/datascience-ui/react-common/images/Sync/sync-inverse.svg new file mode 100644 index 000000000000..7406dc99d8e9 --- /dev/null +++ b/src/datascience-ui/react-common/images/Sync/sync-inverse.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/datascience-ui/react-common/images/Sync/sync.svg b/src/datascience-ui/react-common/images/Sync/sync.svg new file mode 100644 index 000000000000..74a4f483e00c --- /dev/null +++ b/src/datascience-ui/react-common/images/Sync/sync.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/test/datascience/interactivePanel.functional.test.tsx b/src/test/datascience/interactivePanel.functional.test.tsx index d93d4846980a..c146648bdee9 100644 --- a/src/test/datascience/interactivePanel.functional.test.tsx +++ b/src/test/datascience/interactivePanel.functional.test.tsx @@ -57,7 +57,8 @@ suite('DataScience Interactive Panel', () => { inputBlockText: '', scrollCount: 0, selected: false, - runningByLine: DebugState.Design + runningByLine: DebugState.Design, + gathering: false }, editorLoaded: noopAny, editorUnmounted: noopAny, diff --git a/src/test/datascience/mainState.unit.test.ts b/src/test/datascience/mainState.unit.test.ts index 9587eb752dc9..d6dd7ff3738f 100644 --- a/src/test/datascience/mainState.unit.test.ts +++ b/src/test/datascience/mainState.unit.test.ts @@ -48,7 +48,8 @@ suite('DataScience MainState', () => { scrollCount: 0, cursorPos: CursorPos.Current, hasBeenRun: false, - runningByLine: DebugState.Design + runningByLine: DebugState.Design, + gathering: false }; assert.equal(extractInputText(cloneVM(cvm, '# %%\na=1'), settings), 'a=1', 'Cell marker not removed'); assert.equal( From debd937bdb54c9784f363e75f601bcc8412ee038 Mon Sep 17 00:00:00 2001 From: DavidKutu Date: Wed, 5 Aug 2020 13:49:24 -0700 Subject: [PATCH 07/10] moved the gathering redux function to interactive common added a constant --- .../datascience/gather/gatherListener.ts | 5 ++-- .../history-react/redux/reducers/execution.ts | 24 ++----------------- .../history-react/redux/reducers/index.ts | 2 +- .../redux/reducers/transfer.ts | 23 +++++++++++++++++- .../native-editor/redux/reducers/execution.ts | 21 ---------------- .../native-editor/redux/reducers/index.ts | 2 +- 6 files changed, 29 insertions(+), 48 deletions(-) diff --git a/src/client/datascience/gather/gatherListener.ts b/src/client/datascience/gather/gatherListener.ts index 3d65877390be..6e8ba7141a50 100644 --- a/src/client/datascience/gather/gatherListener.ts +++ b/src/client/datascience/gather/gatherListener.ts @@ -46,6 +46,7 @@ export class GatherListener implements IInteractiveWindowListener { private linesSubmitted: number = 0; private cellsSubmitted: number = 0; private statusBar: StatusBarItem; + private readonly twoSeconds = 2000; constructor( @inject(IApplicationShell) private applicationShell: IApplicationShell, @@ -83,7 +84,7 @@ export class GatherListener implements IInteractiveWindowListener { }); setTimeout(() => { this.statusBar.show(); - }, 2000); + }, this.twoSeconds); this.handleMessage(message, payload, this.doGather); break; @@ -94,7 +95,7 @@ export class GatherListener implements IInteractiveWindowListener { }); setTimeout(() => { this.statusBar.show(); - }, 2000); + }, this.twoSeconds); this.handleMessage(message, payload, this.doGatherToScript); break; diff --git a/src/datascience-ui/history-react/redux/reducers/execution.ts b/src/datascience-ui/history-react/redux/reducers/execution.ts index 516becb59a99..1605cc79f8c5 100644 --- a/src/datascience-ui/history-react/redux/reducers/execution.ts +++ b/src/datascience-ui/history-react/redux/reducers/execution.ts @@ -10,10 +10,10 @@ import { InteractiveWindowMessages } from '../../../../client/datascience/intera import { CellState } from '../../../../client/datascience/types'; import { generateMarkdownFromCodeLines } from '../../../common'; import { createCellFrom } from '../../../common/cellFactory'; -import { createCellVM, ICellViewModel, IMainState } from '../../../interactive-common/mainState'; +import { createCellVM, IMainState } from '../../../interactive-common/mainState'; import { postActionToExtension } from '../../../interactive-common/redux/helpers'; import { Helpers } from '../../../interactive-common/redux/reducers/helpers'; -import { IChangeGatherStatus, ICodeAction } from '../../../interactive-common/redux/reducers/types'; +import { ICodeAction } from '../../../interactive-common/redux/reducers/types'; import { InteractiveReducerArg } from '../mapping'; import { Creation } from './creation'; @@ -127,24 +127,4 @@ export namespace Execution { } return arg.prevState; } - - export function gathering(arg: InteractiveReducerArg): IMainState { - const index = arg.prevState.cellVMs.findIndex((c) => c.cell.id === arg.payload.data.cellId); - if (index >= 0) { - const cellVMs = [...arg.prevState.cellVMs]; - const current = arg.prevState.cellVMs[index]; - const newCell: ICellViewModel = { - ...current, - gathering: arg.payload.data.gathering - }; - cellVMs[index] = newCell; - - return { - ...arg.prevState, - cellVMs - }; - } - - return arg.prevState; - } } diff --git a/src/datascience-ui/history-react/redux/reducers/index.ts b/src/datascience-ui/history-react/redux/reducers/index.ts index 95e8f684ec78..4cf821b85bd0 100644 --- a/src/datascience-ui/history-react/redux/reducers/index.ts +++ b/src/datascience-ui/history-react/redux/reducers/index.ts @@ -72,5 +72,5 @@ export const reducerMap: Partial = { [SharedMessages.LocInit]: CommonEffects.handleLocInit, [InteractiveWindowMessages.UpdateDisplayData]: CommonEffects.handleUpdateDisplayData, [InteractiveWindowMessages.HasCell]: Transfer.hasCell, - [InteractiveWindowMessages.Gathering]: Execution.gathering + [InteractiveWindowMessages.Gathering]: Transfer.gathering }; diff --git a/src/datascience-ui/interactive-common/redux/reducers/transfer.ts b/src/datascience-ui/interactive-common/redux/reducers/transfer.ts index 490977928976..31835412722b 100644 --- a/src/datascience-ui/interactive-common/redux/reducers/transfer.ts +++ b/src/datascience-ui/interactive-common/redux/reducers/transfer.ts @@ -9,13 +9,14 @@ import { } from '../../../../client/datascience/interactive-common/interactiveWindowTypes'; import { CssMessages } from '../../../../client/datascience/messages'; import { ICell } from '../../../../client/datascience/types'; -import { extractInputText, getSelectedAndFocusedInfo, IMainState } from '../../mainState'; +import { extractInputText, getSelectedAndFocusedInfo, ICellViewModel, IMainState } from '../../mainState'; import { isSyncingMessage, postActionToExtension } from '../helpers'; import { Helpers } from './helpers'; import { CommonActionType, CommonReducerArg, ICellAction, + IChangeGatherStatus, IEditCellAction, ILinkClickAction, ISendCommandAction, @@ -327,4 +328,24 @@ export namespace Transfer { } return arg.prevState; } + + export function gathering(arg: CommonReducerArg): IMainState { + const index = arg.prevState.cellVMs.findIndex((c) => c.cell.id === arg.payload.data.cellId); + if (index >= 0) { + const cellVMs = [...arg.prevState.cellVMs]; + const current = arg.prevState.cellVMs[index]; + const newCell: ICellViewModel = { + ...current, + gathering: arg.payload.data.gathering + }; + cellVMs[index] = newCell; + + return { + ...arg.prevState, + cellVMs + }; + } + + return arg.prevState; + } } diff --git a/src/datascience-ui/native-editor/redux/reducers/execution.ts b/src/datascience-ui/native-editor/redux/reducers/execution.ts index e75771d403c4..6666e4a36869 100644 --- a/src/datascience-ui/native-editor/redux/reducers/execution.ts +++ b/src/datascience-ui/native-editor/redux/reducers/execution.ts @@ -23,7 +23,6 @@ import { CommonActionType, ICellAction, IChangeCellTypeAction, - IChangeGatherStatus, IExecuteAction } from '../../../interactive-common/redux/reducers/types'; import { NativeEditorReducerArg } from '../mapping'; @@ -218,26 +217,6 @@ export namespace Execution { return arg.prevState; } - export function gathering(arg: NativeEditorReducerArg): IMainState { - const index = arg.prevState.cellVMs.findIndex((c) => c.cell.id === arg.payload.data.cellId); - if (index >= 0) { - const cellVMs = [...arg.prevState.cellVMs]; - const current = arg.prevState.cellVMs[index]; - const newCell: ICellViewModel = { - ...current, - gathering: arg.payload.data.gathering - }; - cellVMs[index] = newCell; - - return { - ...arg.prevState, - cellVMs - }; - } - - return arg.prevState; - } - export function undo(arg: NativeEditorReducerArg): IMainState { if (arg.prevState.undoStack.length > 0) { // Pop one off of our undo stack and update our redo diff --git a/src/datascience-ui/native-editor/redux/reducers/index.ts b/src/datascience-ui/native-editor/redux/reducers/index.ts index 4a346c11065c..0fe8955906f7 100644 --- a/src/datascience-ui/native-editor/redux/reducers/index.ts +++ b/src/datascience-ui/native-editor/redux/reducers/index.ts @@ -57,7 +57,7 @@ export const reducerMap: Partial = { [CommonActionType.LINK_CLICK]: Transfer.linkClick, [CommonActionType.GATHER_CELL]: Transfer.gather, [CommonActionType.GATHER_CELL_TO_SCRIPT]: Transfer.gatherToScript, - [InteractiveWindowMessages.Gathering]: Execution.gathering, + [InteractiveWindowMessages.Gathering]: Transfer.gathering, [CommonActionType.EDITOR_LOADED]: Transfer.started, [CommonActionType.LOADED_ALL_CELLS]: Transfer.loadedAllCells, [CommonActionType.LAUNCH_NOTEBOOK_TRUST_PROMPT]: Transfer.launchNotebookTrustPrompt, From e53bb62f261fe697f1dfe44b73bf50511528f1c4 Mon Sep 17 00:00:00 2001 From: DavidKutu Date: Wed, 5 Aug 2020 14:38:01 -0700 Subject: [PATCH 08/10] move css to common.css --- .../history-react/interactiveCell.tsx | 2 +- .../history-react/interactivePanel.less | 13 --- .../interactive-common/common.css | 109 ++++++++++-------- .../native-editor/nativeEditor.less | 13 --- 4 files changed, 63 insertions(+), 74 deletions(-) diff --git a/src/datascience-ui/history-react/interactiveCell.tsx b/src/datascience-ui/history-react/interactiveCell.tsx index d60869630421..63a5e7bdf10f 100644 --- a/src/datascience-ui/history-react/interactiveCell.tsx +++ b/src/datascience-ui/history-react/interactiveCell.tsx @@ -199,7 +199,7 @@ export class InteractiveCell extends React.Component { > diff --git a/src/datascience-ui/history-react/interactivePanel.less b/src/datascience-ui/history-react/interactivePanel.less index e6616fa9aebd..419fd1b5cfe9 100644 --- a/src/datascience-ui/history-react/interactivePanel.less +++ b/src/datascience-ui/history-react/interactivePanel.less @@ -72,16 +72,3 @@ xmp { word-break: break-all; overflow-x: hidden; } - -.rotate { - animation: rotation 2s infinite linear; -} - -@keyframes rotation { - from { - transform: rotate(0deg); - } - to { - transform: rotate(359deg); - } -} diff --git a/src/datascience-ui/interactive-common/common.css b/src/datascience-ui/interactive-common/common.css index e6387bebac1b..32522d88b894 100644 --- a/src/datascience-ui/interactive-common/common.css +++ b/src/datascience-ui/interactive-common/common.css @@ -1,4 +1,5 @@ -body, html { +body, +html { height: 100%; margin: 0; } @@ -15,10 +16,10 @@ body, html { grid-template-rows: auto auto 1fr auto; grid-template-columns: 1fr; grid-template-areas: - "toolbar" - "variable" - "content" - "footer"; + 'toolbar' + 'variable' + 'content' + 'footer'; height: 100%; width: 100%; position: absolute; @@ -58,7 +59,7 @@ body, html { } .edit-panel { - min-height:50px; + min-height: 50px; padding: 10px 0px 10px 0px; width: 100%; border-top-color: var(--override-badge-background, var(--vscode-badge-background)); @@ -67,7 +68,7 @@ body, html { } .edit-panel-colorized { - min-height:50px; + min-height: 50px; padding: 10px 0px 10px 0px; width: 100%; border-top-color: var(--override-badge-background, var(--vscode-badge-background)); @@ -85,7 +86,7 @@ body, html { .cell-wrapper:focus { outline-width: 0px; - outline-color:var(--override-selection-background, var(--vscode-editor-selectionBackground)); + outline-color: var(--override-selection-background, var(--vscode-editor-selectionBackground)); } .cell-wrapper-preview { @@ -99,7 +100,7 @@ body, html { } .cell-wrapper:after { - content: ""; + content: ''; clear: both; display: block; } @@ -112,18 +113,18 @@ body, html { } .cell-outer { - display:grid; + display: grid; grid-template-columns: auto 1fr; grid-column-gap: 3px; width: 100%; } .cell-outer-editable { - display:grid; + display: grid; grid-template-columns: auto 1fr; grid-column-gap: 3px; width: 100%; - margin-top:16px; + margin-top: 16px; } .content-div { @@ -147,7 +148,7 @@ body, html { margin: 0; } -.cell-input pre{ +.cell-input pre { margin: 0px; padding: 0px; } @@ -181,13 +182,13 @@ body, html { } .cell-output-plot-background { - background:white; + background: white; display: inline-block; margin: 3px; } .cell-output-ipywidget-background { - background:white !important; + background: white !important; } .cell-output-plot-background * { @@ -213,25 +214,28 @@ body, html { .cell-output tr, .cell-output th, .cell-output td { - text-align: right; - vertical-align: middle; - padding: 0.5em 0.5em; - line-height: normal; - white-space: normal; - max-width: none; - border: none; + text-align: right; + vertical-align: middle; + padding: 0.5em 0.5em; + line-height: normal; + white-space: normal; + max-width: none; + border: none; } .cell-output th { - font-weight: bold; + font-weight: bold; } .cell-output tbody tr:nth-child(even) { - background: var(--override-background, var(--vscode-editor-background)); /* Force to white because the default color for output is gray */ + background: var( + --override-background, + var(--vscode-editor-background) + ); /* Force to white because the default color for output is gray */ } .cell-output tbody tr:hover { - background: var(--override-selection-background, var(--vscode-editor-selectionBackground)); + background: var(--override-selection-background, var(--vscode-editor-selectionBackground)); } .cell-output * + table { - margin-top: 1em; + margin-top: 1em; } .center-img { @@ -257,8 +261,8 @@ body, html { /* Code */ .code-area { position: relative; - width:100%; - margin-bottom:16px; + width: 100%; + margin-bottom: 16px; top: -2px; /* Account for spacing removed from the monaco editor */ } @@ -300,9 +304,9 @@ body, html { } .remove-style { - background-color:transparent; - border:transparent; - font:inherit; + background-color: transparent; + border: transparent; + font: inherit; } .inputLabel { @@ -320,12 +324,16 @@ body, html { .flash { animation-name: flash-animation; - animation-duration: 1.0s; + animation-duration: 1s; } @keyframes flash-animation { - from { background: var(--override-peek-background, var(--vscode-peekViewEditor-background));; } - to { background: default; } + from { + background: var(--override-peek-background, var(--vscode-peekViewEditor-background)); + } + to { + background: default; + } } .messages-wrapper { @@ -398,7 +406,7 @@ body, html { justify-content: end; } .variable-explorer-label { - margin-right:auto; + margin-right: auto; } .variable-explorer-close-button { justify-self: end; @@ -407,27 +415,31 @@ body, html { .execution-count { grid-column: 1; font-weight: bold; - display:flex; + display: flex; color: var(--vscode-descriptionForeground); font-family: var(--code-font-family); - } +} - .execution-count-busy-outer { +.execution-count-busy-outer { grid-column: 1; font-weight: bold; color: var(--code-comment-color); - display:block; + display: block; width: 8px; height: 8px; white-space: nowrap; } @keyframes execution-spin { - from { transform: rotate(0); } - to { transform: rotate(360deg); } + from { + transform: rotate(0); + } + to { + transform: rotate(360deg); + } } - .execution-count-busy-svg { +.execution-count-busy-svg { animation: execution-spin 4s linear infinite; } @@ -437,12 +449,12 @@ body, html { stroke-width: 1; } - @keyframes spin { +@keyframes spin { from { - transform:rotate(0deg); + transform: rotate(0deg); } to { - transform:rotate(360deg); + transform: rotate(360deg); } } @@ -484,7 +496,6 @@ body, html { background-color: var(--override-badge-background, var(--vscode-badge-background)); } - .kernel-status { display: flex; margin-left: auto; @@ -499,7 +510,7 @@ body, html { .kernel-status-section-hoverable:hover { background-color: var(--override-badge-background, var(--vscode-badge-background)); - cursor:pointer; + cursor: pointer; } .kernel-status-divider { @@ -561,3 +572,7 @@ body, html { .image-button:focus { outline: none; } + +.rotate { + animation: spin 2s infinite linear; +} diff --git a/src/datascience-ui/native-editor/nativeEditor.less b/src/datascience-ui/native-editor/nativeEditor.less index d916d01415d2..ac52ff444f02 100644 --- a/src/datascience-ui/native-editor/nativeEditor.less +++ b/src/datascience-ui/native-editor/nativeEditor.less @@ -492,16 +492,3 @@ collapse-bar controls-div [cell-input, cell-output, markdown-cell- margin-bottom: 4px; margin-left: 3px; } - -.rotate { - animation: rotation 2s infinite linear; -} - -@keyframes rotation { - from { - transform: rotate(0deg); - } - to { - transform: rotate(359deg); - } -} From d648240a5fc76425a8a2dd63717a4e2ddad1bfe8 Mon Sep 17 00:00:00 2001 From: DavidKutu Date: Wed, 5 Aug 2020 15:02:56 -0700 Subject: [PATCH 09/10] removed the status bar message --- news/1 Enhancements/13177.md | 2 +- package.nls.json | 1 - src/client/common/utils/localize.ts | 1 - .../datascience/gather/gatherListener.ts | 32 ++++++------------- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/news/1 Enhancements/13177.md b/news/1 Enhancements/13177.md index c5e057a8f15e..a450ccc17713 100644 --- a/news/1 Enhancements/13177.md +++ b/news/1 Enhancements/13177.md @@ -1 +1 @@ -The status bar will show 'Gathering code' while gather is executing. +The gather icon will change and get disabled while gather is executing. diff --git a/package.nls.json b/package.nls.json index 63da8c1ad4dd..e4af16d6e3e2 100644 --- a/package.nls.json +++ b/package.nls.json @@ -486,7 +486,6 @@ "DataScience.findJupyterCommandProgressCheckInterpreter": "Checking {0}.", "DataScience.findJupyterCommandProgressSearchCurrentPath": "Searching current path.", "DataScience.gatherError": "Gather internal error", - "DataScience.gatherStatusBar": "$(sync~spin) Gathering Code", "DataScience.gatheredScriptDescription": "# This file was generated by the Gather Extension.\n# It requires version 2020.7.94776 (or newer) of the Python Extension.\n#\n# The intent is that it contains only the code required to produce\n# the same results as the cell originally selected for gathering.\n# Please note that the Python analysis is quite conservative, so if\n# it is unsure whether a line of code is necessary for execution, it\n# will err on the side of including it.\n#\n# Please let us know if you are satisfied with what was gathered here:\n# https://aka.ms/gatherfeedback\n\n", "DataScience.gatheredNotebookDescriptionInMarkdown": "## Gathered Notebook\nGathered from ```{0}```\n\n| | |\n|---|---|\n|   |This notebook was generated by the Gather Extension. It requires version 2020.7.94776 (or newer) of the Python Extension, please update [here](https://command:python.datascience.latestExtension). The intent is that it contains only the code and cells required to produce the same results as the cell originally selected for gathering. Please note that the Python analysis is quite conservative, so if it is unsure whether a line of code is necessary for execution, it will err on the side of including it.|\n\n**Are you satisfied with the code that was gathered?**\n\n[Yes](https://command:python.datascience.gatherquality?yes) [No](https://command:python.datascience.gatherquality?no)", "DataScience.savePngTitle": "Save Image", diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index c86d96f0f7f1..93fa307f28ba 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -923,7 +923,6 @@ export namespace DataScience { 'Searching current path.' ); export const gatherError = localize('DataScience.gatherError', 'Gather internal error'); - export const gatherStatusBar = localize('DataScience.gatherStatusBar', '$(sync~spin) Gathering Code'); export const gatheredScriptDescription = localize( 'DataScience.gatheredScriptDescription', '# This file was generated by the Gather Extension.\n# It requires version 2020.7.94776 (or newer) of the Python Extension.\n#\n# The intent is that it contains only the code required to produce\n# the same results as the cell originally selected for gathering.\n# Please note that the Python analysis is quite conservative, so if\n# it is unsure whether a line of code is necessary for execution, it\n# will err on the side of including it.\n#\n# Please let us know if you are satisfied with what was gathered here:\n# https://aka.ms/gatherfeedback\n\n' diff --git a/src/client/datascience/gather/gatherListener.ts b/src/client/datascience/gather/gatherListener.ts index 6e8ba7141a50..0cf86ea513a1 100644 --- a/src/client/datascience/gather/gatherListener.ts +++ b/src/client/datascience/gather/gatherListener.ts @@ -1,13 +1,14 @@ import { inject, injectable } from 'inversify'; import { IDisposable } from 'monaco-editor'; import * as uuid from 'uuid/v4'; -import { Event, EventEmitter, Position, StatusBarItem, Uri, ViewColumn } from 'vscode'; +import { Event, EventEmitter, Position, Uri, ViewColumn } from 'vscode'; import { createMarkdownCell } from '../../../datascience-ui/common/cellFactory'; import { IApplicationShell, IDocumentManager } from '../../common/application/types'; import { PYTHON_LANGUAGE } from '../../common/constants'; import { traceError } from '../../common/logger'; import type { nbformat } from '@jupyterlab/coreutils'; +import { noop } from 'lodash'; import { IConfigurationService, Resource } from '../../common/types'; import * as localize from '../../common/utils/localize'; import { StopWatch } from '../../common/utils/stopWatch'; @@ -45,8 +46,6 @@ export class GatherListener implements IInteractiveWindowListener { private gatherTimer: StopWatch | undefined; private linesSubmitted: number = 0; private cellsSubmitted: number = 0; - private statusBar: StatusBarItem; - private readonly twoSeconds = 2000; constructor( @inject(IApplicationShell) private applicationShell: IApplicationShell, @@ -56,13 +55,10 @@ export class GatherListener implements IInteractiveWindowListener { @inject(IConfigurationService) private configService: IConfigurationService, @inject(IDocumentManager) private documentManager: IDocumentManager, @inject(IDataScienceFileSystem) private fs: IDataScienceFileSystem - ) { - this.statusBar = this.applicationShell.createStatusBarItem(); - this.statusBar.text = localize.DataScience.gatherStatusBar(); - } + ) {} public dispose() { - this.statusBar.dispose(); + noop(); } // tslint:disable-next-line: no-any @@ -82,9 +78,6 @@ export class GatherListener implements IInteractiveWindowListener { message: InteractiveWindowMessages.Gathering, payload: { cellId: payload.id, gathering: true } }); - setTimeout(() => { - this.statusBar.show(); - }, this.twoSeconds); this.handleMessage(message, payload, this.doGather); break; @@ -93,9 +86,6 @@ export class GatherListener implements IInteractiveWindowListener { message: InteractiveWindowMessages.Gathering, payload: { cellId: payload.id, gathering: true } }); - setTimeout(() => { - this.statusBar.show(); - }, this.twoSeconds); this.handleMessage(message, payload, this.doGatherToScript); break; @@ -166,13 +156,12 @@ export class GatherListener implements IInteractiveWindowListener { traceError(`Gather to Notebook error: ${err}`); this.applicationShell.showErrorMessage(err); }) - .finally(() => { + .finally(() => this.postEmitter.fire({ message: InteractiveWindowMessages.Gathering, payload: { cellId: payload.id, gathering: false } - }); - this.statusBar.hide(); - }); + }) + ); } private doGatherToScript(payload: ICell): Promise { @@ -181,13 +170,12 @@ export class GatherListener implements IInteractiveWindowListener { traceError(`Gather to Script error: ${err}`); this.applicationShell.showErrorMessage(err); }) - .finally(() => { + .finally(() => this.postEmitter.fire({ message: InteractiveWindowMessages.Gathering, payload: { cellId: payload.id, gathering: false } - }); - this.statusBar.hide(); - }); + }) + ); } private gatherCodeInternal = async (cell: ICell, toScript: boolean = false) => { From 6e816191895674cceda921e7a00f808b48df7a85 Mon Sep 17 00:00:00 2001 From: DavidKutu Date: Wed, 5 Aug 2020 15:04:18 -0700 Subject: [PATCH 10/10] changed noop import --- src/client/datascience/gather/gatherListener.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/datascience/gather/gatherListener.ts b/src/client/datascience/gather/gatherListener.ts index 0cf86ea513a1..11e71948c613 100644 --- a/src/client/datascience/gather/gatherListener.ts +++ b/src/client/datascience/gather/gatherListener.ts @@ -8,9 +8,9 @@ import { PYTHON_LANGUAGE } from '../../common/constants'; import { traceError } from '../../common/logger'; import type { nbformat } from '@jupyterlab/coreutils'; -import { noop } from 'lodash'; import { IConfigurationService, Resource } from '../../common/types'; import * as localize from '../../common/utils/localize'; +import { noop } from '../../common/utils/misc'; import { StopWatch } from '../../common/utils/stopWatch'; import { sendTelemetryEvent } from '../../telemetry'; import { generateCellsFromString } from '../cellFactory';