Skip to content

Commit 53e2745

Browse files
authored
Fix icons in the insider build. Remove warning about extra command (microsoft#3846)
* Fix icons in the insider build. Remove warning about extra command * Add news entry * Add new dependency
1 parent cf30aa8 commit 53e2745

File tree

8 files changed

+183
-50
lines changed

8 files changed

+183
-50
lines changed

news/2 Fixes/3775.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Address problem with Python Interactive icons not working in insider's build. VS Code is more restrictive on what files can load in a webview.

package-lock.json

Lines changed: 56 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.datascience-ui.dependencies.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
"style-loader",
122122
"styled-jsx",
123123
"stylis-rule-sheet",
124+
"svg-inline-react",
124125
"svg-path-bounding-box",
125126
"svgpath",
126127
"tinycolor2",

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,6 @@
321321
"command": "python.datascience.collapseallcells",
322322
"title": "%python.command.python.datascience.collapseallcells.title%",
323323
"category": "Python"
324-
},
325-
{
326-
"command": "python.datascience.exportoutputasnotebook",
327-
"title": "%python.command.python.datascience.exportoutputasnotebook.title%",
328-
"category": "Python"
329324
}
330325
],
331326
"menus": {
@@ -1846,6 +1841,7 @@
18461841
"rxjs": "^5.5.9",
18471842
"semver": "^5.5.0",
18481843
"sudo-prompt": "^8.2.0",
1844+
"svg-inline-react": "^3.1.0",
18491845
"tmp": "^0.0.29",
18501846
"tree-kill": "^1.2.0",
18511847
"typescript-char": "^0.0.0",

src/datascience-ui/history-react/MainPanel.tsx

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import { ErrorBoundary } from '../react-common/errorBoundary';
1313
import { getLocString } from '../react-common/locReactSide';
1414
import { IMessageHandler, PostOffice } from '../react-common/postOffice';
1515
import { Progress } from '../react-common/progress';
16-
import { RelativeImage } from '../react-common/relativeImage';
1716
import { Cell, ICellViewModel } from './cell';
1817
import { CellButton } from './cellButton';
18+
import { Image, ImageName } from './image';
1919
import { createCellVM, generateTestState, IMainPanelState } from './mainPanelState';
2020
import { MenuBar } from './menuBar';
2121

@@ -53,23 +53,6 @@ export class MainPanel extends React.Component<IMainPanelProps, IMainPanelState>
5353

5454
public render() {
5555

56-
const clearButtonImage = this.props.theme !== 'vscode-dark' ? './images/Cancel/Cancel_16xMD_vscode.svg' :
57-
'./images/Cancel/Cancel_16xMD_vscode_dark.svg';
58-
const redoImage = this.props.theme !== 'vscode-dark' ? './images/Redo/Redo_16x_vscode.svg' :
59-
'./images/Redo/Redo_16x_vscode_dark.svg';
60-
const undoImage = this.props.theme !== 'vscode-dark' ? './images/Undo/Undo_16x_vscode.svg' :
61-
'./images/Undo/Undo_16x_vscode_dark.svg';
62-
const restartImage = this.props.theme !== 'vscode-dark' ? './images/Restart/Restart_grey_16x_vscode.svg' :
63-
'./images/Restart/Restart_grey_16x_vscode_dark.svg';
64-
const saveAsImage = this.props.theme !== 'vscode-dark' ? './images/SaveAs/SaveAs_16x_vscode.svg' :
65-
'./images/SaveAs/SaveAs_16x_vscode_dark.svg';
66-
const collapseAllImage = this.props.theme !== 'vscode-dark' ? './images/CollapseAll/CollapseAll_16x_vscode.svg' :
67-
'./images/CollapseAll/CollapseAll_16x_vscode_dark.svg';
68-
const expandAllImage = this.props.theme !== 'vscode-dark' ? './images/ExpandAll/ExpandAll_16x_vscode.svg' :
69-
'./images/ExpandAll/ExpandAll_16x_vscode_dark.svg';
70-
const interruptImage = this.props.theme !== 'vscode-dark' ? './images/Interrupt/Interrupt_16x_vscode.svg' :
71-
'./images/Interrupt/Interrupt_16x_vscode_dark.svg';
72-
7356
const progressBar = this.state.busy && !this.props.ignoreProgress ? <Progress /> : undefined;
7457

7558
return (
@@ -78,28 +61,28 @@ export class MainPanel extends React.Component<IMainPanelProps, IMainPanelState>
7861
<MenuBar theme={this.props.theme} stylePosition='top-fixed'>
7962
{this.renderExtraButtons()}
8063
<CellButton theme={this.props.theme} onClick={this.collapseAll} disabled={!this.canCollapseAll()} tooltip={getLocString('DataScience.collapseAll', 'Collapse all cell inputs')}>
81-
<RelativeImage class='cell-button-image' path={collapseAllImage}/>
64+
<Image theme={this.props.theme} class='cell-button-image' image={ImageName.CollapseAll}/>
8265
</CellButton>
8366
<CellButton theme={this.props.theme} onClick={this.expandAll} disabled={!this.canExpandAll()} tooltip={getLocString('DataScience.expandAll', 'Expand all cell inputs')}>
84-
<RelativeImage class='cell-button-image' path={expandAllImage}/>
67+
<Image theme={this.props.theme} class='cell-button-image' image={ImageName.ExpandAll}/>
8568
</CellButton>
8669
<CellButton theme={this.props.theme} onClick={this.export} disabled={!this.canExport()} tooltip={getLocString('DataScience.export', 'Export as Jupyter Notebook')}>
87-
<RelativeImage class='cell-button-image' path={saveAsImage}/>
70+
<Image theme={this.props.theme} class='cell-button-image' image={ImageName.SaveAs}/>
8871
</CellButton>
8972
<CellButton theme={this.props.theme} onClick={this.restartKernel} tooltip={getLocString('DataScience.restartServer', 'Restart iPython Kernel')}>
90-
<RelativeImage class='cell-button-image' path={restartImage}/>
73+
<Image theme={this.props.theme} class='cell-button-image' image={ImageName.Restart}/>
9174
</CellButton>
9275
<CellButton theme={this.props.theme} onClick={this.interruptKernel} tooltip={getLocString('DataScience.interruptKernel', 'Interrupt iPython Kernel')}>
93-
<RelativeImage class='cell-button-image' path={interruptImage}/>
76+
<Image theme={this.props.theme} class='cell-button-image' image={ImageName.Interrupt}/>
9477
</CellButton>
9578
<CellButton theme={this.props.theme} onClick={this.undo} disabled={!this.canUndo()} tooltip={getLocString('DataScience.undo', 'Undo')}>
96-
<RelativeImage class='cell-button-image' path={undoImage}/>
79+
<Image theme={this.props.theme} class='cell-button-image' image={ImageName.Undo}/>
9780
</CellButton>
9881
<CellButton theme={this.props.theme} onClick={this.redo} disabled={!this.canRedo()} tooltip={getLocString('DataScience.redo', 'Redo')}>
99-
<RelativeImage class='cell-button-image' path={redoImage}/>
82+
<Image theme={this.props.theme} class='cell-button-image' image={ImageName.Redo}/>
10083
</CellButton>
10184
<CellButton theme={this.props.theme} onClick={this.clearAll} tooltip={getLocString('DataScience.clearAll', 'Remove All Cells')}>
102-
<RelativeImage class='cell-button-image' path={clearButtonImage}/>
85+
<Image theme={this.props.theme} class='cell-button-image' image={ImageName.Cancel}/>
10386
</CellButton>
10487
</MenuBar>
10588
<div className='top-spacing'/>

src/datascience-ui/history-react/cell.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,21 @@ import './cell.css';
66
import { nbformat } from '@jupyterlab/coreutils';
77
import ansiToHtml from 'ansi-to-html';
88
import * as React from 'react';
9-
10-
// tslint:disable-next-line:match-default-export-name import-name
119
import JSONTree from 'react-json-tree';
1210

1311
import { concatMultilineString } from '../../client/datascience/common';
1412
import { CellState, ICell } from '../../client/datascience/types';
1513
import { getLocString } from '../react-common/locReactSide';
16-
import { RelativeImage } from '../react-common/relativeImage';
1714
import { CellButton } from './cellButton';
1815
import { Code } from './code';
1916
import { CollapseButton } from './collapseButton';
2017
import { ExecutionCount } from './executionCount';
18+
import { Image, ImageName } from './image';
2119
import { MenuBar } from './menuBar';
2220
import { SysInfo } from './sysInfo';
2321
import { displayOrder, richestMimetype, transforms } from './transforms';
2422

23+
// tslint:disable-next-line:match-default-export-name import-name
2524
interface ICellProps {
2625
cellVM: ICellViewModel;
2726
theme: string;
@@ -89,19 +88,15 @@ export class Cell extends React.Component<ICellProps> {
8988
}
9089

9190
private renderNormalCell() {
92-
const clearButtonImage = this.props.theme !== 'vscode-dark' ? './images/Cancel/Cancel_16xMD_vscode.svg' :
93-
'./images/Cancel/Cancel_16xMD_vscode_dark.svg';
94-
const gotoSourceImage = this.props.theme !== 'vscode-dark' ? './images/GoToSourceCode/GoToSourceCode_16x_vscode.svg' :
95-
'./images/GoToSourceCode/GoToSourceCode_16x_vscode_dark.svg';
9691

9792
return (
9893
<div className='cell-wrapper'>
9994
<MenuBar theme={this.props.theme}>
10095
<CellButton theme={this.props.theme} onClick={this.props.delete} tooltip={this.getDeleteString()}>
101-
<RelativeImage class='cell-button-image' path={clearButtonImage} />
96+
<Image theme={this.props.theme} class='cell-button-image' image={ImageName.Cancel}/>
10297
</CellButton>
10398
<CellButton theme={this.props.theme} onClick={this.props.gotoCode} tooltip={this.getGoToCodeString()}>
104-
<RelativeImage class='cell-button-image' path={gotoSourceImage} />
99+
<Image theme={this.props.theme} class='cell-button-image' image={ImageName.GoToSourceCode}/>
105100
</CellButton>
106101
</MenuBar>
107102
<div className='cell-outer'>

0 commit comments

Comments
 (0)