#|-------------------- 0.95 |# "./examples/" 0
#|-------------------- 0.95 |# "./examples/egg-browser.scm" 1999
;;;; egg-browser.scm
(use qt-light posix regex utils matchable)
(define *application* (qt:init))
(define *window* (qt:widget (read-all "egg-browser.ui")))
(define *list* (qt:find *window* "eggList"))
(define *props* (qt:find *window* "eggProperties"))
(define *count* (qt:find *window* "countLabel"))
(define *ubutton* (qt:find *window* "uninstallButton"))
(define (refresh)
(let ((eggs (sort (map pathname-file (glob (make-pathname (repository-path) "*.setup-info"))) string)))
(qt:clear *list*)
(qt:clear *props*)
(for-each (cut qt:add *list* <>) eggs)
(set! (qt:property *count* "text") (number->string (length eggs))) ) )
(define (item-changed)
(set! (qt:property *ubutton* "enabled") #t)
(qt:clear *props*)
(let ((row (qt:property *list* "currentRow")))
(if (positive? row)
(for-each
(cut qt:add *props* <>)
(let ((info (extension-information (string->symbol (qt:item *list* row)))))
(if info
(sort
(map (match-lambda
((name) (->string name))
((name vals ...) (conc name ": " (string-intersperse (map ->string vals) " ")))
(_ "") )
info)
string)
'("") ) ) )
(set! (qt:property *ubutton* "enabled") #f) ) ) )
(define (uninstall)
(and-let* ((i (qt:property *list* "currentRow"))
(name (qt:item *list* i)) )
(when (zero? (qt:message (conc "Are you sure you want to uninstall `" name "' ?")
button1: "Yes" button2: "No") )
(set! (qt:property *count* "text") (number->string (sub1 (string->number (qt:property *count* "text")))))
(set! (qt:property *ubutton* "enabled") #f)
(system* "chicken-uninstall ~s" name)
(refresh) ) ) )
(qt:connect (qt:find *window* "exitButton") "clicked()" *application* "quit()")
(qt:connect (qt:find *window* "refreshButton") "clicked()" refresh)
(qt:connect *list* "currentItemChanged(QListWidgetItem *, QListWidgetItem *)" item-changed)
(qt:connect *ubutton* "clicked()" uninstall)
(qt:show *window*)
(refresh)
(qt:run)
#|-------------------- 0.95 |# "./examples/edit.scm" 673
(use qt-light utils extras)
(require-library chicken-syntax)
(define a (qt:init))
(define w (qt:widget (read-all "editor.ui")))
(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)
#|-------------------- 0.95 |# "./examples/editor.ui" 1129
Form
0
0
633
471
Form
0
-
Lucida Console
12
QTextEdit {
background: black;
color: white;
}
Qt::ScrollBarAlwaysOff
Qt::ScrollBarAlwaysOff
#|-------------------- 0.95 |# "./examples/egg-browser.ui" 2573
EggBrowser
0
0
581
529
CHICKEN Egg Browser
450
480
120
40
Exit
10
480
70
31
Installed:
Qt::AlignCenter
false
320
480
120
40
Refresh
91
480
70
31
false
260
10
310
460
false
190
480
120
41
Uninstall
10
10
240
460
qPixmapFromMimeSource
#|-------------------- 0.95 |# "./examples/hello.scm" 223
(use qt-light utils protobj)
(define a (qt:init))
(define w (qt:widget (read-all "hello.ui")))
(print (? w pointer))
(define b (qt:find w "quitButton"))
(print b)
(qt:connect b "clicked()" a "quit()")
(qt:show w)
(qt:run)
#|-------------------- 0.95 |# "./examples/hello.ui" 1103
Form
0
0
295
144
40
30
160
31
15
75
true
Hello, world!
Qt::AlignCenter
180
90
75
31
Quit
#|-------------------- 0.95 |# "./examples/lisp-lizard.png" 13450
PNG
IHDR x V R gAMA OX2 tEXtSoftware Adobe ImageReadyqe<