Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9af6a20

Browse files
committed
Simplify menu entry label
1 parentfc663a5 commit9af6a20

File tree

3 files changed

+28
-42
lines changed

3 files changed

+28
-42
lines changed

‎packages/application-extension/src/index.ts‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,14 @@ const sidebarVisibility: JupyterFrontEndPlugin<void> = {
734734
}
735735
};
736736

737+
constgetSidebarLabel=(area:SideBarPanel.Area)=>{
738+
if(area==='left'){
739+
returntrans.__(`Left Sidebar`);
740+
}else{
741+
returntrans.__(`Right Sidebar`);
742+
}
743+
};
744+
737745
/**
738746
* Function called when a sidebar has a widget added or removed.
739747
*
@@ -748,7 +756,8 @@ const sidebarVisibility: JupyterFrontEndPlugin<void> = {
748756
)=>{
749757
// Update the menu entries.
750758
if(menu){
751-
updateMenu(sidebar.area,sidebar.menuEntryLabel);
759+
constlabel=getSidebarLabel(sidebar.area);
760+
updateMenu(sidebar.area,label);
752761
}
753762

754763
// Update the palette entries.
@@ -764,14 +773,13 @@ const sidebarVisibility: JupyterFrontEndPlugin<void> = {
764773
app.restored.then(()=>{
765774
// Create menu entries for left and right panel.
766775
if(menu){
767-
updateMenu(
768-
notebookShell.leftHandler.area,
769-
notebookShell.leftHandler.menuEntryLabel
770-
);
771-
updateMenu(
772-
notebookShell.rightHandler.area,
773-
notebookShell.rightHandler.menuEntryLabel
774-
);
776+
constleftArea=notebookShell.leftHandler.area;
777+
constleftLabel=getSidebarLabel(leftArea);
778+
updateMenu(leftArea,leftLabel);
779+
780+
constrightArea=notebookShell.rightHandler.area;
781+
constrightLabel=getSidebarLabel(rightArea);
782+
updateMenu(rightArea,rightLabel);
775783
}
776784

777785
// Add palette entries for side panels.

‎packages/application/src/app.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ export class NotebookApp extends JupyterFrontEnd<INotebookShell> {
5656
readonlystatus=newLabStatus(this);
5757

5858
/**
59-
* Promise that resolves when state is first restored, returning layout
60-
* description.
59+
* Promise that resolves when the state is first restored
6160
*/
6261
readonlyrestored:Promise<void>;
6362

‎packages/application/src/shell.ts‎

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
7171
constleftHandler=this._leftHandler;
7272
constrightHandler=this._rightHandler;
7373

74-
this.leftPanel.id='jp-left-stack';
75-
this.rightPanel.id='jp-right-stack';
74+
leftHandler.panel.id='jp-left-stack';
75+
rightHandler.panel.id='jp-right-stack';
7676

7777
// Hide the side panels by default.
7878
leftHandler.hide();
@@ -164,32 +164,20 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
164164
returnthis._rightHandler;
165165
}
166166

167-
/**
168-
* Shortcut to get the left area handler's stacked panel
169-
*/
170-
getleftPanel():Panel{
171-
returnthis._leftHandler.panel;
172-
}
173-
174-
/**
175-
* Shortcut to get the right area handler's stacked panel
176-
*/
177-
getrightPanel():Panel{
178-
returnthis._rightHandler.panel;
179-
}
180-
181167
/**
182168
* Is the left sidebar visible?
183169
*/
184170
getleftCollapsed():boolean{
185-
return!(this._leftHandler.isVisible&&this.leftPanel.isVisible);
171+
return!(this._leftHandler.isVisible&&this._leftHandler.panel.isVisible);
186172
}
187173

188174
/**
189175
* Is the right sidebar visible?
190176
*/
191177
getrightCollapsed():boolean{
192-
return!(this._rightHandler.isVisible&&this.rightPanel.isVisible);
178+
return!(
179+
this._rightHandler.isVisible&&this._rightHandler.panel.isVisible
180+
);
193181
}
194182

195183
/**
@@ -308,7 +296,7 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
308296
* Expand the left panel to show the sidebar with its widget.
309297
*/
310298
expandLeft(id?:string):void{
311-
this.leftPanel.show();
299+
this._leftHandler.panel.show();
312300
this._leftHandler.expand(id);// Show the current widget, if any
313301
this._onLayoutModified();
314302
}
@@ -318,15 +306,15 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
318306
*/
319307
collapseLeft():void{
320308
this._leftHandler.collapse();
321-
this.leftPanel.hide();
309+
this._leftHandler.panel.hide();
322310
this._onLayoutModified();
323311
}
324312

325313
/**
326314
* Expand the right panel to show the sidebar with its widget.
327315
*/
328316
expandRight(id?:string):void{
329-
this.rightPanel.show();
317+
this._rightHandler.panel.show();
330318
this._rightHandler.expand(id);// Show the current widget, if any
331319
this._onLayoutModified();
332320
}
@@ -336,7 +324,7 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
336324
*/
337325
collapseRight():void{
338326
this._rightHandler.collapse();
339-
this.rightPanel.hide();
327+
this._rightHandler.panel.hide();
340328
this._onLayoutModified();
341329
}
342330

@@ -414,7 +402,6 @@ export class SideBarHandler {
414402

415403
this._current=null;
416404
this._lastCurrent=null;
417-
this._menuEntryLabel=`${area[0].toUpperCase()}${area.slice(1)} Sidebar`;
418405

419406
this._widgetPanel=newStackedPanel();
420407
this._widgetPanel.widgetRemoved.connect(this._onWidgetRemoved,this);
@@ -450,13 +437,6 @@ export class SideBarHandler {
450437
returnthis._area;
451438
}
452439

453-
/**
454-
* Get the menu entry label of the side panel
455-
*/
456-
getmenuEntryLabel():string{
457-
returnthis._menuEntryLabel;
458-
}
459-
460440
/**
461441
* Whether the panel is visible
462442
*/
@@ -636,7 +616,6 @@ export class SideBarHandler {
636616
private_current:Widget|null;
637617
private_lastCurrent:Widget|null;
638618
private_updated:Signal<SideBarHandler,void>=newSignal(this);
639-
private_menuEntryLabel:string;
640619
private_widgetAdded:Signal<SideBarHandler,Widget>=newSignal(this);
641620
private_widgetRemoved:Signal<SideBarHandler,Widget>=newSignal(this);
642621
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp