Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cx
- import asyncDispatch, asyncnet
- # testing some new interface ideas
- # no keyboard required to start/stop/quit
- # works by selecting the required action
- # needs xclip installed
- proc doMenu() =
- printBiCol(" .Start | .Stop ","|",lime,truetomato,xpos = 60)
- println("| .Quit ",salmon)
- var cp = ""
- var stopflag:bool = false
- proc doDash() {.async.} =
- cleanscreen()
- curdn(1)
- while true:
- cp = checkClip()
- cp = strip(cp,true,false)
- if cp.startswith(".Stop") == true and stopflag == false :
- stopflag = true
- curup(1)
- printlnBiCol(rightarrow & " Status : stopped",":",greenyellow,red,xpos = 90)
- # we are still getting high cpu upon stop
- elif cp.startswith(".Start") == true and stopflag == true:
- stopflag = false
- curup(1)
- printlnBiCol(rightarrow & " Status : ok" & spaces(6),":",greenyellow,skyblue,xpos = 90)
- elif cp.startswith(".Quit") == true :
- #curup(1)
- printlnBiCol(rightarrow & " Status : exiting" & spaces(6),":",greenyellow,salmon,xpos = 90)
- quit(0)
- else : discard
- var s = 0
- if stopflag == false and cp.startswith(".Start") == true:
- print(clearline)
- curup(1)
- for x in 0.. 100000:
- s = getRandomInt(0,10000)
- printSlimNumber($s,xpos = 2)
- curup(3)
- doMenu()
- await sleepAsync(1000)
- cleanscreen()
- echo()
- printBiCol(" .Start | .Stop ","|",lime,truetomato,xpos = 60)
- println("| .Quit ",salmon)
- asyncCheck doDash()
- runForever()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement