Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val mkOk = (comp:Composite) => {
- val ok = new Button(comp, SWT.PUSH)
- ok.setText("OK")
- ok.addSelectionListener(new SelectionAdapter() {
- var running = false
- override def widgetSelected(e: SelectionEvent) {
- if (running) {
- } else {
- running = true
- val input = JsonField.mkObject(Seq(t1, t2, t3, t4))
- val t = new TimedThread {
- var killproc:Option[() => Unit] = None
- val name = "Send email"
- val runnable = new Runnable {
- val (destroy, doact) = exec(Seq("python", "C:/Users/M/Desktop/test.py"), input)
- killproc = Some(destroy)
- override def run() {
- Log.info("Sending email")
- val (out,err,retval) = doact()
- }
- }
- override def cleanup() {
- running = false
- }
- override def kill() {
- try {
- killproc foreach (_())
- } catch {
- case e:Exception => Log.warn(e.getMessage)
- }
- }
- }
- t.start()
- }
- }
- })
- ok
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement