original commit: 7a82c4cc7e562c26174a544913ff47e1bea8b4a5
This commit is contained in:
Paul Steckler 2002-07-15 22:04:59 +00:00
parent 6a82b47be1
commit 88d66a2a98

View File

@ -12,6 +12,7 @@
(define launch-browser? #t) (define launch-browser? #t)
(define external-connections? #f) (define external-connections? #f)
(define iconize? #f) (define iconize? #f)
(define quiet? #f)
(define port #f) (define port #f)
(command-line (command-line
@ -24,6 +25,8 @@
(set! external-connections? #t)] (set! external-connections? #t)]
[("-i" "--iconize") "Iconize the control panel" [("-i" "--iconize") "Iconize the control panel"
(set! iconize? #t)] (set! iconize? #t)]
[("-q" "--quiet") "Don't show the control panel"
(set! quiet? #t)]
[("-p" "--port") number "Use given port number" [("-p" "--port") number "Use given port number"
(with-handlers (with-handlers
((void (lambda _ ((void (lambda _
@ -51,78 +54,82 @@
; allow browser startup time ; allow browser startup time
(sleep 2)) (sleep 2))
(define hd-frame% (if quiet?
(class frame% (semaphore-wait (make-semaphore 0))
(inherit show) (let* ([hd-frame%
(field (class frame%
[panel #f] (inherit show)
[main-sd-button #f] (field
[shutdown-dialog [panel #f]
(lambda () [main-sd-button #f]
(let* ([cb-frame (instantiate frame% () [shutdown-dialog
(label "Confirm"))] (lambda ()
[vpanel (instantiate vertical-panel% () (let* ([cb-frame (instantiate frame% ()
(parent cb-frame))] (label "Confirm"))]
[msg (instantiate message% () [vpanel (instantiate vertical-panel% ()
(label "Really shutdown Help Desk server?") (parent cb-frame))]
(parent vpanel))] [msg (instantiate message% ()
[hpanel (instantiate horizontal-panel% () (label "Really shutdown Help Desk server?")
(parent vpanel) (parent vpanel))]
(alignment '(center center)))] [hpanel (instantiate horizontal-panel% ()
[sd-button (instantiate button% () (parent vpanel)
(label "Shutdown") (alignment '(center center)))]
(parent hpanel) [sd-button (instantiate button% ()
(callback (lambda (b ev) (label "Shutdown")
(send cb-frame show #f) (parent hpanel)
(send this show #f))))] (callback (lambda (b ev)
[no-sd-button (instantiate button% () (send cb-frame show #f)
(label "Cancel") (send this show #f))))]
(parent hpanel) [no-sd-button (instantiate button% ()
(callback (lambda (b ev) (label "Cancel")
(send main-sd-button (parent hpanel)
enable #t) (callback (lambda (b ev)
(send cb-frame show #f))))]) (send main-sd-button
(send main-sd-button enable #f) enable #t)
(send cb-frame center) (send cb-frame show #f))))])
(send cb-frame show #t)))]) (send main-sd-button enable #f)
(super-instantiate ()) (send cb-frame center)
(set! panel (send cb-frame show #t)))])
(instantiate vertical-panel% () (super-instantiate ())
(parent this))) (set! panel
(instantiate message% () (instantiate vertical-panel% ()
(label (format "Help Desk server running on port ~a" (parent this)))
(hd-cookie->port hd-cookie))) (instantiate message% ()
(parent panel)) (label (format "Help Desk server running on port ~a"
(instantiate button% () (hd-cookie->port hd-cookie)))
(label "Help Desk Home") (parent panel))
(parent panel) (instantiate button% ()
(min-width 100) (label "Help Desk Home")
(callback (parent panel)
(lambda (b ev) (min-width 100)
(help-desk-browser hd-cookie)))) (callback
(set! main-sd-button (lambda (b ev)
(instantiate button% () (help-desk-browser hd-cookie))))
(label "Shutdown Server") (set! main-sd-button
(parent panel) (instantiate button% ()
(min-width 100) (label "Shutdown Server")
(callback (lambda (b ev) (parent panel)
(shutdown-dialog))))))) (min-width 100)
(callback (lambda (b ev)
(define frame (shutdown-dialog))))))]
(instantiate hd-frame% () [frame
(label "PLT Help Desk") (instantiate hd-frame% ()
(min-width 175) (label "PLT Help Desk")
(stretchable-width #f) (min-width 175)
(stretchable-height #f))) (stretchable-width #f)
(stretchable-height #f))])
(send frame center) (send frame center)
(send frame show #t) (send frame show #t)
(when iconize? (when iconize?
(send frame iconize #t))) (send frame iconize #t)))))