NiGui
NiGui copied to clipboard
Doesn't NiGui support asynchronous calls?
var tv_info = newLabel()
...
btnStartSnotout.onClick = proc(event: ClickEvent) =
if not isRunning:
isRunning = true
btnFileChoose.enabled = false
btnClear.enabled = false
etFileName.editable = false
btnUpdateLicense.enabled = false
btnForceUpdateLicense.enabled = false
btnViewLicense.enabled = false
btnCopyLicense.enabled = false
btnStopSnotout.enabled = false
btnRefreshChina.enabled = false
btnRefreshPlan.enabled = false
let ret = execCmdEx("[ -f /opt/Snotout/run/Snotout.pid ]").exitCode
if ret == 0:
tv_info.text = "1111"
else:
tv_info.text = "2222..."
let retCode = execCmdEx("sudo /opt/Snotout/scripts/start_all.sh > /dev/null 2>&1").exitCode
if retCode == 0:
tv_info.text = "3333"
else:
tv_info.text = "4444"
...
When I click Start button. None of these functions take effect. For example:
btnFileChoose.enabled = false
btnClear.enabled = false
tv_info.text = "1111"
tv_info.text = "2222..."
It is no problem to use execCmdEx
with NiGui.
From your posted code I don't see any problem, but it's only a small part.