Debugging problems with webui.
Signed-off-by: Hans Dijkema <hans@dijkewijk.nl>
This commit is contained in:
@@ -640,12 +640,12 @@
|
|||||||
(define/override (html-loaded)
|
(define/override (html-loaded)
|
||||||
(ww-debug "HTML LOADED")
|
(ww-debug "HTML LOADED")
|
||||||
(super html-loaded)
|
(super html-loaded)
|
||||||
(let* ((btn (send this element 'app-button)))
|
;(let* ((btn (send this element 'app-button)))
|
||||||
(send btn connect 'click (λ (data)
|
; (send btn connect 'click (λ (data)
|
||||||
(new test-dialog% [parent this]))))
|
; (new test-dialog% [parent this]))))
|
||||||
(ww-debug "SETTING MENU")
|
;(ww-debug "SETTING MENU")
|
||||||
(send this set-menu! test-menu)
|
;(send this set-menu! test-menu)
|
||||||
(send this connect-menu! 'm-quit (λ () (send this close)))
|
;(send this connect-menu! 'm-quit (λ () (send this close)))
|
||||||
)
|
)
|
||||||
|
|
||||||
(begin
|
(begin
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
"../utils/utils.rkt"
|
"../utils/utils.rkt"
|
||||||
"css.rkt"
|
"css.rkt"
|
||||||
"menu.rkt"
|
"menu.rkt"
|
||||||
"webui-wire-ffi.rkt"
|
|
||||||
"webui-wire-ipc.rkt"
|
"webui-wire-ipc.rkt"
|
||||||
"webui-wire-download.rkt"
|
"webui-wire-download.rkt"
|
||||||
)
|
)
|
||||||
@@ -174,6 +173,7 @@
|
|||||||
[reader-thread #:mutable]
|
[reader-thread #:mutable]
|
||||||
[type #:mutable]
|
[type #:mutable]
|
||||||
)
|
)
|
||||||
|
#:transparent
|
||||||
)
|
)
|
||||||
|
|
||||||
(define ww-current-handle #f)
|
(define ww-current-handle #f)
|
||||||
@@ -251,12 +251,6 @@
|
|||||||
|
|
||||||
(define process-log process-log-ipc)
|
(define process-log process-log-ipc)
|
||||||
|
|
||||||
(define (process-log-ffi kind* msg*)
|
|
||||||
(let ((kind (bytes->string/utf-8 kind*))
|
|
||||||
(msg (bytes->string/utf-8 msg*)))
|
|
||||||
(put-in-fifo kind msg)
|
|
||||||
(ensure-fifo)))
|
|
||||||
|
|
||||||
(define (ww-do-display item filter)
|
(define (ww-do-display item filter)
|
||||||
(let ((displ #f))
|
(let ((displ #f))
|
||||||
(when (eq? filter #f)
|
(when (eq? filter #f)
|
||||||
@@ -322,21 +316,16 @@
|
|||||||
(when (eq? ww-current-handle #f)
|
(when (eq? ww-current-handle #f)
|
||||||
(let ((h (make-web-rkt (if (eq? type 'ipc)
|
(let ((h (make-web-rkt (if (eq? type 'ipc)
|
||||||
(webui-ipc event-queuer-ipc process-log-ipc)
|
(webui-ipc event-queuer-ipc process-log-ipc)
|
||||||
(let ((existing-h (webwire-current)))
|
(error "ffi integration not implemented"))
|
||||||
(if (eq? existing-h #f)
|
|
||||||
(webwire-new)
|
|
||||||
existing-h)))
|
|
||||||
#f
|
#f
|
||||||
#f
|
#f
|
||||||
#f
|
#f
|
||||||
type)))
|
type)))
|
||||||
(when (eq? type 'ffi)
|
(when (eq? type 'ffi)
|
||||||
(unless (eq? (webwire-status (web-rkt-handle h)) 'valid)
|
(error "ffi integration not implemented"))
|
||||||
(error (format "Invalid handle, cannot start webui-wire ffi, reason: ~a"
|
|
||||||
(webwire-status->string (webwire-status (web-rkt-handle h)))))))
|
|
||||||
(let ((thrd (event-handler h)))
|
(let ((thrd (event-handler h)))
|
||||||
(when (eq? type 'ffi)
|
(when (eq? type 'ffi)
|
||||||
(webwire-handlers! (web-rkt-handle h) event-queuer-ffi process-log-ffi))
|
(error "ffi integration not implemented"))
|
||||||
(set-web-rkt-event-thread! h thrd)
|
(set-web-rkt-event-thread! h thrd)
|
||||||
(set! ww-current-handle h))
|
(set! ww-current-handle h))
|
||||||
))
|
))
|
||||||
@@ -355,11 +344,12 @@
|
|||||||
(let ((handler (hash-ref windows-evt-handlers win-id)))
|
(let ((handler (hash-ref windows-evt-handlers win-id)))
|
||||||
(handler 'destroyed #f)))
|
(handler 'destroyed #f)))
|
||||||
keys))
|
keys))
|
||||||
(ww-cmd "exit")
|
(with-handlers ([exn:fail? (λ (e) #t)])
|
||||||
|
(ww-cmd "exit"))
|
||||||
(let ((thr (web-rkt-event-thread ww-current-handle)))
|
(let ((thr (web-rkt-event-thread ww-current-handle)))
|
||||||
(kill-thread thr))
|
(kill-thread thr))
|
||||||
(when (eq? (web-rkt-type ww-current-handle) 'ffi)
|
(when (eq? (web-rkt-type ww-current-handle) 'ffi)
|
||||||
(webwire-destroy (web-rkt-handle ww-current-handle)))
|
(error "ffi integration not implemented"))
|
||||||
(set! ww-current-handle #f)))
|
(set! ww-current-handle #f)))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -429,7 +419,7 @@
|
|||||||
(let* ((type (web-rkt-type ww-current-handle))
|
(let* ((type (web-rkt-type ww-current-handle))
|
||||||
(result (if (eq? type 'ipc)
|
(result (if (eq? type 'ipc)
|
||||||
((web-rkt-handle ww-current-handle) cmd)
|
((web-rkt-handle ww-current-handle) cmd)
|
||||||
(webwire-command (web-rkt-handle ww-current-handle) cmd)))
|
(error "ffi implementation not implemented")))
|
||||||
)
|
)
|
||||||
(let ((r (convert-result result)))
|
(let ((r (convert-result result)))
|
||||||
(check-nok cmd r)
|
(check-nok cmd r)
|
||||||
@@ -474,6 +464,9 @@
|
|||||||
(define (any? v)
|
(define (any? v)
|
||||||
#t)
|
#t)
|
||||||
|
|
||||||
|
(define (path-or-string? s)
|
||||||
|
(or (path? s) (string? s)))
|
||||||
|
|
||||||
(define (selector? s)
|
(define (selector? s)
|
||||||
(or (symbol? s) (string? s)
|
(or (symbol? s) (string? s)
|
||||||
(if (list? s)
|
(if (list? s)
|
||||||
@@ -522,6 +515,7 @@
|
|||||||
((eq? type 'ww-win) (make-ww-win (string->number str)))
|
((eq? type 'ww-win) (make-ww-win (string->number str)))
|
||||||
((eq? type 'void) 'void)
|
((eq? type 'void) 'void)
|
||||||
((eq? type 'css-style) (string->css-style str))
|
((eq? type 'css-style) (string->css-style str))
|
||||||
|
((eq? type 'path) (string->path str))
|
||||||
(else str)))
|
(else str)))
|
||||||
|
|
||||||
(define (check-cmd-type v vname type typename)
|
(define (check-cmd-type v vname type typename)
|
||||||
@@ -559,6 +553,9 @@
|
|||||||
((eq? type 'boolean?) (if (eq? v #f) 'false 'true))
|
((eq? type 'boolean?) (if (eq? v #f) 'false 'true))
|
||||||
((eq? type 'symbol-or-string?) v)
|
((eq? type 'symbol-or-string?) v)
|
||||||
((eq? type 'number?) v)
|
((eq? type 'number?) v)
|
||||||
|
((eq? type 'path-or-string?) (if (string? v)
|
||||||
|
v
|
||||||
|
(path->string v)))
|
||||||
(else (begin
|
(else (begin
|
||||||
(ww-error (format "Convert-arg-to-cmd Unexpected: ~a ~a ~a" vname type v))
|
(ww-error (format "Convert-arg-to-cmd Unexpected: ~a ~a ~a" vname type v))
|
||||||
v))))
|
v))))
|
||||||
@@ -726,15 +723,22 @@
|
|||||||
;; Web Wire Commands
|
;; Web Wire Commands
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;; Set the log level of webui-wire
|
||||||
(def-cmd ww-log-level
|
(def-cmd ww-log-level
|
||||||
loglevel () ((level symbol?)) -> symbol)
|
loglevel () ((level symbol?)) -> symbol)
|
||||||
|
|
||||||
|
;; Get the spoken protocol by webui-wire
|
||||||
(def-cmd ww-protocol
|
(def-cmd ww-protocol
|
||||||
protocol () () -> int)
|
protocol () () -> int)
|
||||||
|
|
||||||
|
;; Get/set the current directory of webui-wire
|
||||||
|
(def-cmd ww-cwd
|
||||||
|
cwd () [(path path-or-string?)] -> path)
|
||||||
|
|
||||||
;; Global stylesheet
|
;; Global stylesheet
|
||||||
(def-cmd ww-set-stylesheet
|
(def-cmd ww-set-stylesheet
|
||||||
set-stylesheet ((st stylesheet-or-string?)) () -> void)
|
set-stylesheet ((st stylesheet-or-string?)) () -> void)
|
||||||
|
|
||||||
(def-cmd ww-get-stylesheet
|
(def-cmd ww-get-stylesheet
|
||||||
get-stylesheet () () -> stylesheet)
|
get-stylesheet () () -> stylesheet)
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,8 @@
|
|||||||
;(define (current-release os)
|
;(define (current-release os)
|
||||||
|
|
||||||
(define (ww-webui-wire)
|
(define (ww-webui-wire)
|
||||||
(list "/home/hans/src/racket/webui-wire/build/Release/webui-wire")
|
(list "C:/devel/racket/webui-wire/build/Release/webui-wire.exe")
|
||||||
|
;(list "/home/hans/src/racket/webui-wire/build/Release/webui-wire")
|
||||||
;(list "/usr/bin/flatpak" "run" "nl.dijkewijk.webui-wire")
|
;(list "/usr/bin/flatpak" "run" "nl.dijkewijk.webui-wire")
|
||||||
;(list "/Users/hans/src/webui-wire/build/Release/webui-wire")
|
;(list "/Users/hans/src/webui-wire/build/Release/webui-wire")
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
#t
|
#t
|
||||||
#f)))
|
#f)))
|
||||||
|
|
||||||
|
;; This function only expects one character, namely \n
|
||||||
|
;; In windows disable text mode on stdout/stderr of webui-wire.
|
||||||
(define (read-eol port)
|
(define (read-eol port)
|
||||||
(read-string 1 port))
|
(read-string 1 port))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user