NiGui icon indicating copy to clipboard operation
NiGui copied to clipboard

Doesn't NiGui support asynchronous calls?

Open zhouhm opened this issue 11 months ago • 1 comments

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..."

zhouhm avatar Apr 02 '24 09:04 zhouhm

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.

simonkrauter avatar Apr 02 '24 11:04 simonkrauter