diff --git a/src/main/pythonenvdialog/pythonenvdialog.ts b/src/main/pythonenvdialog/pythonenvdialog.ts index 39e31e74..82bc1051 100644 --- a/src/main/pythonenvdialog/pythonenvdialog.ts +++ b/src/main/pythonenvdialog/pythonenvdialog.ts @@ -221,7 +221,7 @@ export class ManagePythonEnvironmentDialog { height: 100%; } #content-area { - background: var(--neutral-layer-4); + background: var(--neutral-layer-2); width: 100%; } #env-list-progress { @@ -363,11 +363,11 @@ export class ManagePythonEnvironmentDialog { padding-left: 15px; } jp-menu-item.menu-category { - background: var(--neutral-layer-2); + background: var(--neutral-layer-3); padding-left: 5px; } jp-menu-item.active { - background: var(--neutral-layer-3); + background: var(--neutral-layer-4); } jp-menu-item::part(content) { width: 100%; @@ -941,7 +941,10 @@ export class ManagePythonEnvironmentDialog { createCommandPreview.value = \`conda create -p \$\{getEnvInstallPath()\} \$\{getCondaChannels()\}\ \$\{getPackageList()\}\`; } else { const envPath = getEnvInstallPath(); - createCommandPreview.value = \`python -m venv create \$\{envPath\}\n\$\{envPath\}\$\{pathSeparator\}${activateRelPath.replace("\\", "\\\\")}\npython -m pip install \$\{getPackageList()\}\`; + createCommandPreview.value = \`python -m venv create \$\{envPath\}\n\$\{envPath\}\$\{pathSeparator\}${activateRelPath.replace( + '\\', + '\\\\' + )}\npython -m pip install \$\{getPackageList()\}\`; } } diff --git a/src/main/pythonenvselectpopup/preload.ts b/src/main/pythonenvselectpopup/preload.ts index 30b72de2..3e1d09b1 100644 --- a/src/main/pythonenvselectpopup/preload.ts +++ b/src/main/pythonenvselectpopup/preload.ts @@ -3,7 +3,10 @@ import { IPythonEnvironment } from '../tokens'; const { contextBridge, ipcRenderer } = require('electron'); -type CurrentPythonPathSetListener = (path: string) => void; +type CurrentPythonPathSetListener = ( + path: string, + relativePath: string +) => void; type ResetPythonEnvSelectPopupListener = () => void; type CustomPythonPathSelectedListener = (path: string) => void; type SetPythonEnvironmentListListener = (envs: IPythonEnvironment[]) => void; @@ -56,11 +59,14 @@ contextBridge.exposeInMainWorld('electronAPI', { } }); -ipcRenderer.on(EventTypeRenderer.SetCurrentPythonPath, (event, path) => { - if (onCurrentPythonPathSetListener) { - onCurrentPythonPathSetListener(path); +ipcRenderer.on( + EventTypeRenderer.SetCurrentPythonPath, + (event, path, relativePath) => { + if (onCurrentPythonPathSetListener) { + onCurrentPythonPathSetListener(path, relativePath); + } } -}); +); ipcRenderer.on(EventTypeRenderer.ResetPythonEnvSelectPopup, event => { if (onResetPythonEnvSelectPopupListener) { diff --git a/src/main/pythonenvselectpopup/pythonenvselectpopup.ts b/src/main/pythonenvselectpopup/pythonenvselectpopup.ts index 9365ef80..04c10d42 100644 --- a/src/main/pythonenvselectpopup/pythonenvselectpopup.ts +++ b/src/main/pythonenvselectpopup/pythonenvselectpopup.ts @@ -8,6 +8,7 @@ import { ThemedView } from '../dialog/themedview'; import { EventTypeRenderer } from '../eventtypes'; import { IPythonEnvironment } from '../tokens'; import { IApplication } from '../app'; +import { getRelativePathToUserHome } from '../utils'; export class PythonEnvironmentSelectPopup { constructor(options: PythonEnvironmentSelectView.IOptions) { @@ -20,6 +21,8 @@ export class PythonEnvironmentSelectPopup { const { envs, defaultPythonPath, bundledPythonPath } = options; this._envs = options.envs; const currentPythonPath = options.currentPythonPath || ''; + const currentPythonPathRelative = + getRelativePathToUserHome(currentPythonPath) || currentPythonPath; const uFuzzyScriptSrc = fs.readFileSync( path.join(__dirname, '../../../app-assets/uFuzzy.iife.min.js') @@ -53,13 +56,29 @@ export class PythonEnvironmentSelectPopup { display: flex; align-items: center; gap: 10px; - color: var(--neutral-foreground-hint); + margin-left: 5px; + padding: 6px 0 8px 0; + border-image: linear-gradient(to right, var(--neutral-stroke-active), transparent) 1; + border-width: 1px; + border-style: none none solid none; + } + #current-python-path-label { + display: flex; + margin-right: 5px; + } + #current-python-path-label .current-python-path { + display: block; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 370px; + margin-left: 5px; } #popup-title { flex-grow: 1; margin-left: 5px; - height: 30px; - line-height: 30px; + height: 25px; + line-height: 25px; font-weight: bold; } #header .toolbar-button { @@ -115,6 +134,9 @@ export class PythonEnvironmentSelectPopup { width: 100%; box-shadow: none; } + ::-webkit-scrollbar { + display: none; + } jp-menu { background: none; } @@ -130,23 +152,36 @@ export class PythonEnvironmentSelectPopup { jp-menu-item::part(end) { margin-left: 10px; } + .current-session-actions { + display: flex; + gap: 5px; + align-items: center; + flex-grow: 1; + }