mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-05 18:20:36 -08:00
builder in clogframe
This commit is contained in:
parent
909e444b5f
commit
fd0ddc55fa
9 changed files with 29 additions and 10 deletions
11
NATIVE.md
vendored
11
NATIVE.md
vendored
|
|
@ -1,6 +1,6 @@
|
|||
# Creating Native Applications with CLOG
|
||||
|
||||
Simple solution:
|
||||
## The Simple solution:
|
||||
|
||||
Common to all solutions is compiling you CLOG application to an executable.
|
||||
See demos/make-snake and the source of the 01-demo.lisp file.
|
||||
|
|
@ -8,11 +8,15 @@ See demos/make-snake and the source of the 01-demo.lisp file.
|
|||
make-snake produces a native app that launches a browser. When snake game
|
||||
exist the executable quits.
|
||||
|
||||
More advanced solutions:
|
||||
or better yet use CLOGFRAME - see clogframe/README.md and the built in
|
||||
browser control on your OS.
|
||||
|
||||
|
||||
## More advanced solutions:
|
||||
|
||||
1. Open app using chrome in app mode (not exactly native but looks it)
|
||||
|
||||
2. Use MacGap on Mac (best native option for Mac)
|
||||
2. Use MacGap on Mac
|
||||
|
||||
3. Native app using (ql:quickload :ceramic) (works well for Windows and Linux)
|
||||
|
||||
|
|
@ -123,3 +127,4 @@ https://cordova.apache.org/
|
|||
|
||||
https://github.com/webview/webview
|
||||
|
||||
See clogframe for working external example
|
||||
1
clogframe/make-builder
vendored
Executable file
1
clogframe/make-builder
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
sbcl --eval "(ql:quickload :clog/tools)" --eval "(sb-ext:save-lisp-and-die #P\"builder\" :toplevel (lambda () (clog-tools:clog-builder :port 0 :app t :start-browser nil :clogframe t)) :executable t :compression t)"
|
||||
1
make-builder
vendored
Executable file
1
make-builder
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
sbcl --eval "(ql:quickload :clog/tools)" --eval "(sb-ext:save-lisp-and-die #P\"builder\" :toplevel (lambda () (clog-tools:clog-builder :port 0 :app t :start-browser t)(loop (sleep 10))) :executable t :compression t)"
|
||||
1
make-exe
vendored
1
make-exe
vendored
|
|
@ -1 +0,0 @@
|
|||
sbcl --eval "(ql:quickload :clog/tools)" --eval "(sb-ext:save-lisp-and-die #P\"./builder\" :toplevel (lambda () (clog-tools:clog-builder :port 0 :app t :start-browser t)(loop (sleep 10))) :executable t :compression t)"
|
||||
|
|
@ -106,7 +106,7 @@ set (logging to browser console), "
|
|||
(clog-gui:clog-gui-initialize body))
|
||||
(setf clog-user::*body* body))
|
||||
:path "/repl")
|
||||
(open-browser :url "http://127.0.0.1:8080/repl")
|
||||
(open-browser :url (format nil "http://127.0.0.1:~A/repl" *clog-port*))
|
||||
(format t "Use clog-user:*body* to access the clog-repl window."))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ the same as the clog directy this overides the relative paths used in them.")
|
|||
(defvar *extended-routing* nil
|
||||
"If true extended routing is done.")
|
||||
|
||||
(defparameter *clog-port* 8080
|
||||
"Port this instance of clog was started on")
|
||||
|
||||
;;;;;;;;;;;;;;;;
|
||||
;; initialize ;;
|
||||
;;;;;;;;;;;;;;;;
|
||||
|
|
@ -111,6 +114,7 @@ example."
|
|||
(set-on-new-window on-new-window-handler :path "/" :boot-file boot-file))
|
||||
(unless *clog-running*
|
||||
(setf *clog-running* t)
|
||||
(setf *clog-port* port)
|
||||
(setf *static-root* (truename (or *overide-static-root*
|
||||
static-root)))
|
||||
(apply #'clog-connection:initialize
|
||||
|
|
@ -163,7 +167,7 @@ BOOT-FILE will be used. If BOOT-FILE is nil path is removed."
|
|||
;; open-browser ;;
|
||||
;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun open-browser (&key (url "http://127.0.0.1:8080"))
|
||||
(defun open-browser (&key (url (format nil "http://127.0.0.1:~A" *clog-port*)))
|
||||
"Launch on os a web browser on local machine to URL. See OPEN-WINDOW
|
||||
for openning windows on remote machines."
|
||||
(handler-case
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ embedded in a native template application.)"
|
|||
"CLOG Startup and Shutdown"
|
||||
(initialize function)
|
||||
(*static-root* variable)
|
||||
(*clog-port* variable)
|
||||
(set-on-new-window function)
|
||||
(is-running-p function)
|
||||
(shutdown function)
|
||||
|
|
|
|||
|
|
@ -41,4 +41,3 @@
|
|||
(window-close (win panel))))))))
|
||||
(t
|
||||
(window-close (win panel))))))))
|
||||
|
||||
|
|
|
|||
|
|
@ -1273,7 +1273,10 @@ of controls and double click to select control."
|
|||
(format nil ":boot-file \"~A\" " custom-boot)
|
||||
""))
|
||||
:eval-in-package package)))
|
||||
(open-window (window (connection-body obj)) "http://127.0.0.1:8080/test")
|
||||
(if *app-mode*
|
||||
(open-browser :url (format nil "http://127.0.0.1:~A/test" *clog-port*))
|
||||
(open-window (window (connection-body obj))
|
||||
(format nil "http://127.0.0.1:~A/test" *clog-port*)))
|
||||
(on-open-file obj :title-class "w3-yellow" :title "test eval" :text result)))
|
||||
|
||||
(defun on-show-control-properties-win (obj)
|
||||
|
|
@ -2599,7 +2602,8 @@ of controls and double click to select control."
|
|||
(create-gui-menu-item tools :content "Thread Viewer" :on-click 'on-show-thread-viewer)
|
||||
(create-gui-menu-item tools :content "CLOG Builder REPL" :on-click 'on-repl)
|
||||
(create-gui-menu-item tools :content "Copy/Cut History" :on-click 'on-show-copy-history-win)
|
||||
(create-gui-menu-item tools :content "Image to HTML Data" :on-click 'on-image-to-data)
|
||||
(unless *app-mode*
|
||||
(create-gui-menu-item tools :content "Image to HTML Data" :on-click 'on-image-to-data))
|
||||
(create-gui-menu-item tools :content "Launch DB Admin" :on-click
|
||||
(lambda (obj)
|
||||
(declare (ignore obj))
|
||||
|
|
@ -2656,7 +2660,7 @@ of controls and double click to select control."
|
|||
clog-builder window.")
|
||||
|
||||
(defun clog-builder (&key (port 8080) (start-browser t)
|
||||
app project static-root system)
|
||||
app project static-root system clogframe)
|
||||
"Start clog-builder. When PORT is 0 choose a random port. When APP is
|
||||
t, shutdown applicatoin on termination of first window. If APP eq :BATCH then
|
||||
must specific default project :PROJECT and it will be batch rerendered
|
||||
|
|
@ -2679,6 +2683,11 @@ to use that asdf system's static root."
|
|||
(set-on-new-window 'on-new-db-admin :path "/dbadmin")
|
||||
(set-on-new-window 'on-attach-builder-page :path "/builder-page")
|
||||
(set-on-new-window 'on-convert-image :path "/image-to-data")
|
||||
(when clogframe
|
||||
(uiop:run-program (list "./clogframe"
|
||||
"CLOG Builder"
|
||||
(format nil "~A/builder" port)
|
||||
(format nil "~A" 1280) (format nil "~A" 840))))
|
||||
(when start-browser
|
||||
(format t "If browser does not start go to http://127.0.0.1:~A/builder" port)
|
||||
(open-browser :url (format nil "http://127.0.0.1:~A/builder" port))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue