Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't NiGui support asynchronous calls? #183

Open
zhouhm opened this issue Apr 2, 2024 · 1 comment
Open

Doesn't NiGui support asynchronous calls? #183

zhouhm opened this issue Apr 2, 2024 · 1 comment

Comments

@zhouhm
Copy link

zhouhm commented Apr 2, 2024

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..."
@simonkrauter
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants