将命令移至main.py中
This commit is contained in:
parent
d9f1aae27c
commit
32496af392
4 changed files with 19 additions and 10 deletions
15
main.py
15
main.py
|
@ -22,6 +22,19 @@ def custom_event(name, data):
|
|||
window.evaluate_js(js)
|
||||
|
||||
|
||||
command_list = {
|
||||
"ensurepip": "python\\python -m ensurepip --default-pip --no-warn-script-location",
|
||||
"clone": "git\\bin\\git clone https://git.zhaozuohong.vip/mower-ng/mower-ng.git --branch slow",
|
||||
"fetch": "..\\git\\bin\\git fetch",
|
||||
"switch_fast": "..\\git\\bin\\git switch -f fast",
|
||||
"switch_slow": "..\\git\\bin\\git switch -f slow",
|
||||
"reset_fast": "..\\git\\bin\\git reset --hard origin/fast",
|
||||
"reset_slow": "..\\git\\bin\\git reset --hard origin/slow",
|
||||
"webview": "start ..\\python\\pythonw webview_ui.py",
|
||||
"manager": "start ..\\python\\pythonw manager.py",
|
||||
}
|
||||
|
||||
|
||||
class Api:
|
||||
def get_branch(self):
|
||||
return config["branch"]
|
||||
|
@ -37,7 +50,7 @@ class Api:
|
|||
|
||||
def run(self, command, cwd=None):
|
||||
with Popen(
|
||||
command,
|
||||
command_list[command],
|
||||
stdout=PIPE,
|
||||
stderr=STDOUT,
|
||||
shell=True,
|
||||
|
|
|
@ -3,11 +3,11 @@ const steps = ref([
|
|||
{ title: '设置Git LFS', command: ['git\\bin\\git lfs install'] },
|
||||
{
|
||||
title: '安装pip',
|
||||
command: ['python\\python -m ensurepip --default-pip --no-warn-script-location']
|
||||
command: ['ensurepip']
|
||||
},
|
||||
{
|
||||
title: '下载代码',
|
||||
command: ['git\\bin\\git clone https://git.zhaozuohong.vip/mower-ng/mower-ng.git --branch slow']
|
||||
command: ['clone']
|
||||
}
|
||||
])
|
||||
provide('steps', steps)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<script setup>
|
||||
function webview() {
|
||||
pywebview.api.run('start ..\\python\\pythonw webview_ui.py', 'mower-ng')
|
||||
pywebview.api.run('webview', 'mower-ng')
|
||||
}
|
||||
|
||||
function manager() {
|
||||
pywebview.api.run('start ..\\python\\pythonw manager.py', 'mower-ng')
|
||||
pywebview.api.run('manager', 'mower-ng')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -14,11 +14,7 @@ watch(branch, () => {
|
|||
const steps = computed(() => [
|
||||
{
|
||||
title: '下载源码',
|
||||
command: [
|
||||
'..\\git\\bin\\git fetch',
|
||||
`..\\git\\bin\\git switch -f ${branch.value}`,
|
||||
`..\\git\\bin\\git reset --hard origin/${branch.value}`
|
||||
],
|
||||
command: ['fetch', `switch_${branch.value}`, `reset_${branch.value}`],
|
||||
cwd: 'mower-ng'
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue