87 lines
2.1 KiB
Plaintext
87 lines
2.1 KiB
Plaintext
import { Button, VerticalBox } from "std-widgets.slint";
|
|
|
|
export global Globals {
|
|
//启动按钮状态
|
|
in-out property <bool> StartEnable: false;
|
|
//停止按钮状态
|
|
in-out property <bool> StopEnable: false;
|
|
}
|
|
|
|
export component MainWindow inherits Window {
|
|
title: "VoileTftpTools";
|
|
icon: @image-url("../tftp.png");
|
|
height: 180px;
|
|
width: 320px;
|
|
default-font-family: "Segoe UI";
|
|
default-font-size: 16px;
|
|
default-font-weight: 700;
|
|
in-out property <bool> StartEnable <=> Globals.StartEnable;
|
|
in-out property <bool> StopEnable <=> Globals.StopEnable;
|
|
//选择路径回调
|
|
callback BrowserFolder() -> string;
|
|
property <string> SelectFolder: "";
|
|
//启动回调
|
|
callback StartTftp();
|
|
//停止回调
|
|
callback StopTftp();
|
|
//选择路径按钮
|
|
Rectangle {
|
|
height: 35px;
|
|
width: 95px;
|
|
x: 10px;
|
|
y: 10px;
|
|
Button {
|
|
height: parent.height;
|
|
width: parent.width;
|
|
text: "选择路径";
|
|
clicked => {
|
|
SelectFolder = BrowserFolder();
|
|
}
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
height: 35px;
|
|
width: 95px;
|
|
x: 110px;
|
|
y: 10px;
|
|
Button {
|
|
height: parent.height;
|
|
width: parent.width;
|
|
text: "启动";
|
|
enabled: StartEnable;
|
|
clicked => {
|
|
StartTftp();
|
|
}
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
height: 35px;
|
|
width: 95px;
|
|
x: 210px;
|
|
y: 10px;
|
|
Button {
|
|
height: parent.height;
|
|
width: parent.width;
|
|
text: "停止";
|
|
enabled: StopEnable;
|
|
clicked => {
|
|
StopTftp();
|
|
}
|
|
}
|
|
}
|
|
|
|
Text {
|
|
x: 13px;
|
|
y: 55px;
|
|
text: "路径:";
|
|
}
|
|
Text {
|
|
x: 60px;
|
|
y: 55px;
|
|
width: 200px;
|
|
wrap: word-wrap; // 自动换行关键属性
|
|
text: SelectFolder;
|
|
}
|
|
} |