a3b9f5c072
git-svn-id: https://code.call-cc.org/svn/chicken-eggs/release/5/qt-light@38001 fca3e652-9b03-0410-8d7b-ac86a6ce46c4
37 lines
800 B
Scheme
37 lines
800 B
Scheme
(import qt-light
|
|
(chicken condition)
|
|
(chicken io)
|
|
(chicken port)
|
|
(chicken pretty-print))
|
|
|
|
(define a (qt:init))
|
|
(define w (qt:widget
|
|
(call-with-input-file "editor.ui"
|
|
(lambda (p) (read-string #f p)))))
|
|
(define e (qt:find w "editor"))
|
|
|
|
(qt:insert e "Select some Scheme code and\npress CTRL-E to evaluate it.\n")
|
|
|
|
(define action (qt:shortcut w "Ctrl+E"))
|
|
|
|
(qt:connect
|
|
action "triggered()"
|
|
(qt:receiver
|
|
(lambda ()
|
|
(let ((code (qt:selection e)))
|
|
(qt:insert e code)
|
|
(qt:insert
|
|
e
|
|
(with-output-to-string
|
|
(lambda ()
|
|
(handle-exceptions ex
|
|
(begin
|
|
(print-error-message ex)
|
|
(print-call-chain))
|
|
(pp (eval (with-input-from-string code read)))))))))))
|
|
|
|
(qt:add-action e action)
|
|
|
|
(qt:show w)
|
|
(qt:run)
|