CircosHeatmap-aardio/main.aardio

75 lines
2.7 KiB
Plaintext
Raw Normal View History

2025-01-12 22:35:14 +08:00
import fonts.fontAwesome;
2025-01-12 00:52:51 +08:00
import win.ui;
/*DSG{{*/
2025-01-12 22:35:14 +08:00
mainForm = win.form(text="CircosHeatmap-aardio";right=800;bottom=600;bgcolor=16777215)
2025-01-12 00:52:51 +08:00
mainForm.add(
2025-01-12 22:48:58 +08:00
btnRun={cls="plus";text="生成pdf";left=684;top=413;right=791;bottom=448;align="left";border={color=-16777216;width=1};db=1;dr=1;font=LOGFONT(h=-16;name='微软雅黑');iconStyle={align="left";font=LOGFONT(h=-13;name='FontAwesome');padding={left=15}};iconText='\uF08B';textPadding={left=32};z=3};
btnSelectFile={cls="plus";text="数据源";left=569;top=413;right=676;bottom=448;align="left";border={color=-16777216;width=1};db=1;dr=1;font=LOGFONT(h=-16;name='微软雅黑');iconStyle={align="left";font=LOGFONT(h=-13;name='FontAwesome');padding={left=18}};iconText='\uF15C';textPadding={left=35};z=2};
editConsole={cls="edit";left=10;top=459;right=791;bottom=591;bgcolor=4274224;border=1;color=15326936;db=1;dl=1;dr=1;hscroll=1;multiline=1;vscroll=1;z=5};
editRScript={cls="edit";left=10;top=10;right=791;bottom=401;border=1;color=4473924;db=1;dl=1;dr=1;dt=1;hscroll=1;multiline=1;vscroll=1;z=4};
inputFile={cls="plus";left=10;top=413;right=562;bottom=448;align="left";border={color=-16736064;width=1};db=1;dl=1;dr=1;editable="edit";font=LOGFONT(h=-13);textPadding={left=5;top=8;right=5;bottom=2};z=1}
2025-01-12 00:52:51 +08:00
)
/*}}*/
2025-01-12 22:35:14 +08:00
mainForm.btnSelectFile.skin({
2025-01-12 04:16:59 +08:00
background={
2025-01-12 22:35:14 +08:00
active=0xFF5AAEC4;
default=0xFF71D9F5;
disabled=0xFFCCCCCC;
};
color={
active=0xFFFFFFFF;
default=0xFF000000;
disabled=0xFF6D6D6D
2025-01-12 04:16:59 +08:00
}
2025-01-12 22:35:14 +08:00
});
mainForm.btnRun.skin({
background={
active=0xFF30BE3F;
default=0xFF7DED7B;
disabled=0xFFCCCCCC;
};
color={
active=0xFFFFFFFF;
default=0xFF000000;
disabled=0xFF6D6D6D
}
});
2025-01-12 04:16:59 +08:00
2025-01-12 00:52:51 +08:00
import console;
import process.r;
import fsys.dlg;
mainForm.editRScript.print($"\script\heatmap_script.R");
2025-01-12 04:16:59 +08:00
2025-01-12 00:52:51 +08:00
// 选择文件按钮点击事件
mainForm.btnSelectFile.oncommand = function(id, event) {
var filePath = fsys.dlg.open("CSV 文件|*.csv||",, "选择输入文件");
if (filePath) {
mainForm.inputFile.text = filePath; // 将选择的文件路径显示在输入框中
}
}
// 运行按钮点击事件
mainForm.btnRun.oncommand = function(id, event) {
var inputFilePath = mainForm.inputFile.text;
if (!inputFilePath) {
console.log("请先选择输入文件!");
return;
}
// 弹出保存文件对话框选择PDF保存路径
var outputFilePath = fsys.dlg.save("PDF 文件|*.pdf||",, "选择保存路径");
if (!outputFilePath) {
console.log("请选择PDF文件的保存路径");
return;
}
// 执行 R 脚本
2025-01-12 04:16:59 +08:00
var out = process.r.exec(mainForm.editRScript.text, inputFilePath, outputFilePath);
2025-01-12 00:52:51 +08:00
mainForm.editConsole.print(out);
}
// 显示主窗口
mainForm.show();
return win.loopMessage();