Skip to content

Commit

Permalink
Merge pull request #100 from XpressAI/adry/refresh-labIcon
Browse files Browse the repository at this point in the history
💄Change into labIcon and replace the refresh icon
  • Loading branch information
MFA-X-AI authored Feb 14, 2022
2 parents a746884 + 09805fc commit f4ea8b4
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 33 deletions.
3 changes: 2 additions & 1 deletion src/debugger/SidebarDebugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { commandIDs } from '../components/xircuitBodyWidget';
import { DebuggerWidget } from './DebuggerWidget';
import { XircuitFactory } from '../xircuitFactory';
import { Toolbar, CommandToolbarButton } from '@jupyterlab/apputils';
import { breakpointIcon } from '../ui-components/icons';

export const DebuggerCommandIDs = {
continue: 'Xircuits-debugger:continue',
Expand Down Expand Up @@ -166,7 +167,7 @@ export const DebuggerCommandIDs = {
// Add command signal to toggle breakpoint
app.commands.addCommand(commandIDs.breakpointXircuit, {
caption: trans.__('Toggle Breakpoint'),
iconClass: 'jp-BreakpointLogo',
icon: breakpointIcon,
isEnabled: () => {
return debugMode ?? false;
},
Expand Down
26 changes: 23 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { DocumentWidget } from '@jupyterlab/docregistry';
import { runIcon, saveIcon } from '@jupyterlab/ui-components';
import { addContextMenuCommands } from './commands/ContextMenu';
import { Token } from '@lumino/coreutils';
import { xircuitsIcon, debuggerIcon } from './ui-components/icons';


const FACTORY = 'Xircuits editor';

Expand Down Expand Up @@ -83,7 +85,7 @@ const xircuits: JupyterFrontEndPlugin<void> = {
name: 'xircuits',
displayName: 'Xircuits',
extensions: ['.xircuits'],
iconClass: 'jp-XircuitLogo'
icon: xircuitsIcon
});

// Registering the widget factory
Expand Down Expand Up @@ -115,6 +117,24 @@ const xircuits: JupyterFrontEndPlugin<void> = {
name: widget => widget.context.path
});

// Find the MainLogo widget in the shell and replace it with the Xircuits Logo
const widgets = app.shell.widgets('top');
let widget = widgets.next();

while (widget !== undefined) {
if (widget.id === 'jp-MainLogo') {
xircuitsIcon.element({
container: widget.node,
justify: 'center',
height: 'auto',
width: '25px'
});
break;
}

widget = widgets.next();
}

// Creating the sidebar widget for the xai components
const sidebarWidget = ReactWidget.create(<Sidebar lab={app}/>);
sidebarWidget.id = 'xircuits-component-sidebar';
Expand All @@ -127,7 +147,7 @@ const xircuits: JupyterFrontEndPlugin<void> = {
// Creating the sidebar debugger
const sidebarDebugger = new XircuitsDebugger.Sidebar({ app, translator, widgetFactory })
sidebarDebugger.id = 'xircuits-debugger-sidebar';
sidebarDebugger.title.iconClass = 'jp-DebuggerLogo';
sidebarDebugger.title.icon = debuggerIcon;
sidebarDebugger.title.caption = "Xircuits Debugger";
restorer.add(sidebarDebugger, sidebarDebugger.id);
app.shell.add(sidebarDebugger, 'right', { rank: 1001 });
Expand All @@ -147,7 +167,7 @@ const xircuits: JupyterFrontEndPlugin<void> = {
// Add a command for creating a new xircuits file.
app.commands.addCommand(commandIDs.createNewXircuit, {
label: 'Create New Xircuits',
iconClass: 'jp-XircuitLogo',
icon: xircuitsIcon,
caption: 'Create a new xircuits file',
execute: () => {
app.commands
Expand Down
3 changes: 2 additions & 1 deletion src/kernel/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Message } from '@lumino/messaging';
import { StackedPanel } from '@lumino/widgets';

import { Log } from '../log/LogPlugin';
import { xircuitsIcon } from '../ui-components/icons';
import { XircuitFactory } from '../xircuitFactory';

/**
Expand All @@ -46,7 +47,7 @@ export class OutputPanel extends StackedPanel {
this.id = 'xircuit-output-panel';
this.title.label = this._trans.__('Xircuit Output');
this.title.closable = true;
this.title.iconClass = 'jp-XircuitLogo';
this.title.icon = xircuitsIcon;

this._sessionContext = new SessionContext({
sessionManager: manager.sessions,
Expand Down
4 changes: 4 additions & 0 deletions src/svg.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const value: string;
export default value;
}
10 changes: 10 additions & 0 deletions src/ui-components/icons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { LabIcon } from '@jupyterlab/ui-components';
import xircuitsSvg from '../../style/icons/xpress-logo.svg';
import debuggerSvg from '../../style/icons/debugger.svg';
import lockSvg from '../../style/icons/lock.svg';
import breakpointSvg from '../../style/icons/breakpoint.svg';

export const xircuitsIcon = new LabIcon({ name: 'xircuits:xircuits', svgstr: xircuitsSvg });
export const debuggerIcon = new LabIcon({ name: 'xircuits:debuggerIcon', svgstr: debuggerSvg });
export const lockIcon = new LabIcon({ name: 'xircuits:lockIcon', svgstr: lockSvg });
export const breakpointIcon = new LabIcon({ name: 'xircuits:breakpointIcon', svgstr: breakpointSvg });
5 changes: 3 additions & 2 deletions src/xircuitFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { commandIDs } from './components/xircuitBodyWidget';
import { CommandIDs } from './log/LogPlugin';
import { ServiceManager } from '@jupyterlab/services';
import { RunSwitcher } from './components/RunSwitcher';
import { lockIcon, xircuitsIcon } from './ui-components/icons';

const XPIPE_CLASS = 'xircuits-editor';

Expand Down Expand Up @@ -107,7 +108,7 @@ export class XircuitFactory extends ABCWidgetFactory<DocumentWidget> {

const widget = new DocumentWidget({ content, context });
widget.addClass(XPIPE_CLASS);
widget.title.iconClass = 'jp-XircuitLogo';
widget.title.icon = xircuitsIcon;

/**
* Create a save button toolbar item.
Expand Down Expand Up @@ -190,7 +191,7 @@ export class XircuitFactory extends ABCWidgetFactory<DocumentWidget> {
* Create a lock button toolbar item.
*/
let lockButton = new ToolbarButton({
iconClass: 'jp-LockLogo',
icon: lockIcon,
tooltip: "Lock all non-general nodes connected from start node",
onClick: (): void => {
this.commands.execute(commandIDs.lockXircuit);
Expand Down
38 changes: 12 additions & 26 deletions style/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/

#jp-MainLogo {
background-image: url(../style/icons/xpress-logo.svg);
background-repeat: no-repeat;
/* Refresh Icon */
#main-logo{
background-image: url(../style/icons/xpress-logo.svg);
background-repeat: no-repeat;
position: fixed;
width: 15%;
height: 15%;
top: 50%;
left: 55%;
transform: translate(-50%, -50%);
}

#jp-MainLogo > svg {
visibility: hidden;
#main-logo > svg{
visibility: hidden;
}

.jp-DebuggerWidget {
Expand All @@ -26,21 +32,6 @@
flex: 0 0 auto;
}

.jp-XircuitLogo {
background-image: url(./icons/xpress-logo.svg);
background-repeat: no-repeat;
}

.jp-DebuggerLogo {
background-image: url(./icons/debugger.svg);
background-repeat: no-repeat;
}

.jp-LockLogo {
background-image: url(./icons/lock.svg);
background-repeat: no-repeat;
}

.jp-ComponentLibraryLogo {
background-image: url(./icons/component-library.svg);
background-repeat: no-repeat;
Expand All @@ -53,11 +44,6 @@
background-size: 25px 25px;
}

.jp-BreakpointLogo {
background-image: url(./icons/breakpoint.svg);
background-repeat: no-repeat;
}

/* Close button for image viewer*/
.close {
color: #fff;
Expand Down

0 comments on commit f4ea8b4

Please sign in to comment.