add cnMirror

This commit is contained in:
josc146
2023-05-21 10:49:45 +08:00
parent 8d730d71ba
commit 825cbd15f8
7 changed files with 31 additions and 9 deletions

View File

@@ -94,5 +94,6 @@
"Python target not found, would you like to download it?": "没有找到目标Python, 是否下载?",
"Python dependencies are incomplete, would you like to install them?": "Python依赖缺失, 是否安装?",
"Install": "安装",
"This is the latest version": "已是最新版"
"This is the latest version": "已是最新版",
"Use Tsinghua Pip Mirrors": "使用清华大学Pip镜像源"
}

View File

@@ -52,7 +52,7 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
});
} else if (depErrorMsg.includes('DepCheck Error')) {
toastWithButton(t('Python dependencies are incomplete, would you like to install them?'), t('Install'), () => {
InstallPyDep();
InstallPyDep(commonStore.settings.cnMirror);
});
} else {
toast(depErrorMsg, {type: 'error'});

View File

@@ -18,6 +18,7 @@ export type SettingsType = {
language: Language,
darkMode: boolean
autoUpdatesCheck: boolean
cnMirror: boolean
}
export const Settings: FC = observer(() => {
@@ -63,6 +64,17 @@ export const Settings: FC = observer(() => {
checkUpdate(true);
}}/>
}/>
{
commonStore.settings.language === 'zh' &&
<Labeled label={t('Use Tsinghua Pip Mirrors')} flex spaceBetween content={
<Switch checked={commonStore.settings.cnMirror}
onChange={(e, data) => {
commonStore.setSettings({
cnMirror: data.checked
});
}}/>
}/>
}
</div>
}/>
);

View File

@@ -48,7 +48,8 @@ class CommonStore {
settings: SettingsType = {
language: getUserLanguage(),
darkMode: !isSystemLightMode(),
autoUpdatesCheck: true
autoUpdatesCheck: true,
cnMirror: getUserLanguage() === 'zh'
};
// about