Compare commits

..

No commits in common. "main" and "v0.5" have entirely different histories.
main ... v0.5

8 changed files with 36 additions and 99 deletions

View file

@ -9,5 +9,5 @@ window = None
def start_webview(): def start_webview():
global window global window
window = webview.create_window(f"mower-ng launcher {sys_config.get('version')}", sys_config.get('url'), window = webview.create_window(f"mower-ng launcher {sys_config.get('version')}", sys_config.get('url'),
js_api=Api(), width=850, height=600) js_api=Api())
webview.start(debug=sys_config.get('debug')) webview.start(debug=sys_config.get('debug'))

View file

@ -89,7 +89,6 @@ provide('new_version', new_version)
class="container" class="container"
v-model:value="conf.page" v-model:value="conf.page"
@update:value="set_page" @update:value="set_page"
justify-content="center"
> >
<n-tab-pane :disabled="running" name="init" tab="初始化"><init /></n-tab-pane> <n-tab-pane :disabled="running" name="init" tab="初始化"><init /></n-tab-pane>
<n-tab-pane :disabled="running" name="update" tab="更新代码"><update /></n-tab-pane> <n-tab-pane :disabled="running" name="update" tab="更新代码"><update /></n-tab-pane>
@ -97,17 +96,15 @@ provide('new_version', new_version)
<n-tab-pane :disabled="running" name="fix" tab="依赖修复"><fix /></n-tab-pane> <n-tab-pane :disabled="running" name="fix" tab="依赖修复"><fix /></n-tab-pane>
<n-tab-pane :disabled="running" name="settings"> <n-tab-pane :disabled="running" name="settings">
<template #tab> <template #tab>
<div class="tab-content"> <n-space :wrap="false">
<span>设置</span> 设置
<n-tag v-if="update_able" class="tag" round type="success"></n-tag> <n-tag v-if="update_able" round type="success"></n-tag>
</div> </n-space>
</template> </template>
<settings /> <settings />
</n-tab-pane> </n-tab-pane>
<template #suffix> <template #suffix>
<div class="suffix-container"> <n-button type="primary" secondary size="small" @click="show_doc">帮助文档</n-button>
<n-button type="primary" secondary size="small" @click="show_doc">帮助文档</n-button>
</div>
</template> </template>
</n-tabs> </n-tabs>
</n-notification-provider> </n-notification-provider>
@ -120,17 +117,4 @@ provide('new_version', new_version)
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
} }
.suffix-container {
margin: 0 4px 6px 4px;
}
.tab-content {
position: relative;
}
.tag {
margin-left: 4px;
position: absolute;
top: 50%;
left: 100%;
transform: translateY(-50%);
}
</style> </style>

View file

@ -5,44 +5,27 @@ import hljs from 'highlight.js/lib/core'
const log = inject('log') const log = inject('log')
const log_ele = inject('log_ele') const log_ele = inject('log_ele')
const chinesePattern = {
className: 'chinese',
begin: /[\u4e00-\u9fa5]+/
}
hljs.registerLanguage('naive-log', () => ({ hljs.registerLanguage('naive-log', () => ({
contains: [ contains: [
{ {
className: 'info', className: 'info',
begin: /^\[信息\]/, begin: /\[信息\]/,
end: /$/, end: /$/
returnBegin: true,
returnEnd: true,
contains: [chinesePattern]
}, },
{ {
className: 'error', className: 'error',
begin: /^\[错误\]/, begin: /\[错误\]/,
end: /$/, end: /$/
returnBegin: true,
returnEnd: true,
contains: [chinesePattern]
}, },
{ {
className: 'execute_command', className: 'execute_command',
begin: /^\[执行命令\]/, begin: /\[执行命令\]/,
end: /$/, end: /$/
returnBegin: true,
returnEnd: true,
contains: [chinesePattern]
}, },
{ {
className: 'command_out', className: 'command_out',
begin: /^\[命令输出\]/, begin: /\[命令输出\]/,
end: /$/, end: /$/
returnBegin: true,
returnEnd: true,
contains: [chinesePattern]
} }
] ]
})) }))
@ -71,3 +54,22 @@ hljs.registerLanguage('naive-log', () => ({
user-select: text; user-select: text;
} }
</style> </style>
<style>
pre {
word-break: break-all !important;
}
.n-code pre .hljs-info {
color: #33ff33;
}
.n-code pre .hljs-error {
color: #ff0000;
}
.n-code pre .hljs-execute_command {
color: #edaf1f;
}
.n-code pre .hljs-command_out {
color: #ffffff;
}
</style>

View file

@ -1,6 +1,5 @@
import 'vfonts/Lato.css' import 'vfonts/Lato.css'
import 'vfonts/FiraCode.css' import 'vfonts/FiraCode.css'
import './styles/global.css'
import { createApp } from 'vue' import { createApp } from 'vue'
import { createPinia } from 'pinia' import { createPinia } from 'pinia'

View file

@ -1,6 +1,5 @@
<script setup> <script setup>
import { SyncCircle } from '@vicons/ionicons5' import { SyncCircle } from '@vicons/ionicons5'
import { form_item_label_style } from '@/styles/styles.js'
const notification = useNotification() const notification = useNotification()
@ -58,7 +57,7 @@ async function check_update() {
<template> <template>
<n-flex vertical style="gap: 16px; height: 100%; padding: 16px; box-sizing: border-box"> <n-flex vertical style="gap: 16px; height: 100%; padding: 16px; box-sizing: border-box">
<n-form label-placement="left" :show-feedback="false" label-width="auto" label-align="left"> <n-form label-placement="left" :show-feedback="false" label-width="auto" label-align="left">
<n-form-item label="版本" :label-style="form_item_label_style"> <n-form-item label="版本">
<n-space align="center"> <n-space align="center">
{{ version }} {{ version }}
<n-button <n-button

View file

@ -1,6 +1,5 @@
<script setup> <script setup>
import { useConfigStore } from '@/stores/config.js' import { useConfigStore } from '@/stores/config.js'
import { form_item_label_style } from '@/styles/styles.js'
const conf = useConfigStore().config const conf = useConfigStore().config
const branch = ref(null) const branch = ref(null)
@ -28,7 +27,7 @@ provide('current_state', current_state)
<template> <template>
<n-flex vertical style="gap: 16px; height: 100%; padding: 16px; box-sizing: border-box"> <n-flex vertical style="gap: 16px; height: 100%; padding: 16px; box-sizing: border-box">
<n-form label-placement="left" :show-feedback="false" label-width="auto" label-align="left"> <n-form label-placement="left" :show-feedback="false" label-width="auto" label-align="left">
<n-form-item label="mower-ng 代码分支" :label-style="form_item_label_style"> <n-form-item label="mower-ng 代码分支">
<n-radio-group v-model:value="conf.branch"> <n-radio-group v-model:value="conf.branch">
<n-flex> <n-flex>
<n-radio value="fast">测试版</n-radio> <n-radio value="fast">测试版</n-radio>
@ -36,7 +35,7 @@ provide('current_state', current_state)
</n-flex> </n-flex>
</n-radio-group> </n-radio-group>
</n-form-item> </n-form-item>
<n-form-item label="PyPI 仓库镜像" :label-style="form_item_label_style"> <n-form-item label="PyPI 仓库镜像">
<n-radio-group v-model:value="conf.mirror"> <n-radio-group v-model:value="conf.mirror">
<n-flex> <n-flex>
<n-radio value="pypi">PyPI</n-radio> <n-radio value="pypi">PyPI</n-radio>

View file

@ -1,43 +0,0 @@
/* src/assets/styles/global.css */
/* 日志样式 */
.n-code pre {
word-break: break-all !important;
}
.n-code pre .hljs-info {
color: #33ff33;
}
.n-code pre .hljs-error {
color: #ff0000;
}
.n-code pre .hljs-execute_command {
color: #edaf1f;
}
.n-code pre .hljs-command_out {
color: #ffffff;
}
.n-code pre .hljs-chinese {
font-family: '微软雅黑', sans-serif;
}
/* 确保 chinese 类在所有父级类下生效 */
.n-code pre .hljs-info .hljs-chinese {
color: #33ff33;
}
.n-code pre .hljs-error .hljs-chinese {
color: #ff0000;
}
.n-code pre .hljs-execute_command .hljs-chinese {
color: #edaf1f;
}
.n-code pre .hljs-command_out .hljs-chinese {
color: #ffffff;
}

View file

@ -1,3 +0,0 @@
export const form_item_label_style = {
alignSelf: 'center'
}