From 843020613e2503fced9b017f941359bfdd1fd926 Mon Sep 17 00:00:00 2001 From: Jeyaprakash-NK Date: Mon, 9 Oct 2023 12:39:58 +0530 Subject: [PATCH] onThemeChanged order change --- src/index.ts | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/index.ts b/src/index.ts index ad4c7060..809b72ac 100644 --- a/src/index.ts +++ b/src/index.ts @@ -122,6 +122,24 @@ const extension: JupyterFrontEndPlugin = { onPreviewEnabledChanged(); }); + /** + * Handler for when the Jupyter Lab theme changes. + */ + const onThemeChanged = () => { + if (!panelDpms || !panelGcs) return; + const isLightTheme = themeManager.theme + ? themeManager.isLight(themeManager.theme) + : true; + if (isLightTheme) { + panelDpms.title.icon = iconDpms; + panelGcs.title.icon = iconStorage; + } else { + panelDpms.title.icon = iconDpmsDark; + panelGcs.title.icon = iconStorageDark; + } + }; + themeManager.themeChanged.connect(onThemeChanged); + /** * Helper method for when the preview flag gets updated. This reads the * previewEnabled flag and hides or shows the GCS browser or DPMS explorer @@ -163,23 +181,7 @@ const extension: JupyterFrontEndPlugin = { new NotebookButtonExtension(app as JupyterLab, launcher, themeManager) ); - /** - * Handler for when the Jupyter Lab theme changes. - */ - const onThemeChanged = () => { - if (!panelDpms || !panelGcs) return; - const isLightTheme = themeManager.theme - ? themeManager.isLight(themeManager.theme) - : true; - if (isLightTheme) { - panelDpms.title.icon = iconDpms; - panelGcs.title.icon = iconStorage; - } else { - panelDpms.title.icon = iconDpmsDark; - panelGcs.title.icon = iconStorageDark; - } - }; - themeManager.themeChanged.connect(onThemeChanged); + const loadDpmsWidget = (value: string) => { // If DPMS is not enabled, no-op.