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