P417_host/dlg/setting.aardio
2023-03-14 15:49:33 +08:00

53 lines
2.1 KiB
Plaintext

import win.ui;
/*DSG{{*/
setting = win.form(text="aardio form";right=984;bottom=589)
setting.add(
btnConnect={cls="plus";text="连接";left=318;top=142;right=502;bottom=178;bgcolor=11580047;dl=0.32;dt=0.24;font=LOGFONT(h=-16;name='FontAwesome');iconStyle={align="left";font=LOGFONT(h=-16;name='FontAwesome');padding={left=20}};iconText='\uF066';notify=1;tabstop=1;z=3};
btnFresh={cls="plus";text="刷新";left=122;top=142;right=306;bottom=178;bgcolor=11580047;dl=0.12;dt=0.24;font=LOGFONT(h=-16;name='FontAwesome');iconStyle={align="left";font=LOGFONT(h=-16;name='FontAwesome');padding={left=20}};iconText='\uF021';notify=1;tabstop=1;z=2};
cbbDev={cls="combobox";left=123;top=89;right=372;bottom=115;ah=1;aw=1;dl=0.12;dt=0.15;edge=1;items={};mode="dropdown";z=5};
plus5={cls="plus";text="English";left=126;top=230;right=244;bottom=261;ah=1;align="left";aw=1;dl=0.13;dt=0.39;font=LOGFONT(h=-20;name='FontAwesome');iconStyle={align="left";font=LOGFONT(h=-16;name='FontAwesome');padding={left=5}};iconText='\uF0C8';notify=1;textPadding={left=30};z=1};
static={cls="static";left=121;top=32;right=434;bottom=48;transparent=1;z=6};
static4={cls="static";text="V2.0 20230314";left=5;top=556;right=241;bottom=587;font=LOGFONT(h=-22);notify=1;transparent=1;z=4}
)
/*}}*/
import usb2canfd;
import win.timer
import console;
loadcodex("\dlg\msg.aardio");
loadcodex("\CANThread\CanThreadStart.aardio");
setting.btnConnect.disabled = 1;
setting.btnFresh.oncommand = function(id,event){
setting.cbbDev.clear();//清空下拉框,防止反复刷新叠加
CT_Fresh();
sleep(100);
var ret = CT_GetCANHw();
if(ret != null && #ret > 0){
for(i=1;#ret;1){
setting.cbbDev.add(ret[i]);
}
setting.btnConnect.disabled = 0;
}
else {
setting.cbbDev.add("未找到硬件");
setting.btnConnect.disabled = 1;
}
setting.cbbDev.selIndex = 1
}
setting.btnConnect.oncommand = function(id,event){
CT_Connect(setting.cbbDev.selIndex,1,true);
}
CAN_Connected_callback = function(){
setting.cbbDev.disabled = 1
setting.btnFresh.disabled = 1;
setting.btnConnect.disabled = 1;
MsgProTimer.enable();
}
setting.show();
win.loopMessage();
return setting;