envelope-panel* load project/tools when starting builder with a project

This commit is contained in:
David Botton 2024-07-14 17:36:33 -04:00
parent 45a0cf9243
commit 0bbbcc292e
6 changed files with 228 additions and 186 deletions

282
OCICL.md vendored
View file

@ -1,133 +1,149 @@
OCICL is a complete secure alternative to a QuickLisp CLOG install OCICL is a complete secure alternative to a QuickLisp CLOG install
OCICL loads dependencies with your project. Once setup the command line OCICL loads dependencies with your project. Once setup the command line
tool ocicl is used to prepare a directory for a new project or to convert tool ocicl is used to prepare a directory for a new project or to convert
and existing project to an ocicl based one. To add dependecies you just and existing project to an ocicl based one. To add dependecies you just
add them to your asd file and will be downloaded as needed. A simple add them to your asd file and will be downloaded as needed. A simple
run of "ocicl latest" updates your project dependecies. run of "ocicl latest" updates your project dependecies.
Once installed either in an empty new project dir or existing project do: Once installed either in an empty new project dir or existing project do:
(Do not call your project clog, creates asdf circular dependecies.) (Do not call your project clog, that creates an asdf circular dependecy.)
``` ```
ocicl setup > init ocicl setup > init
ocicl install clog ocicl install clog
``` ```
Note for Windows: unzip https://rabbibotton.github.io/clog/clogframe.zip for
Then start to dev with the CLOG Builder: needed dlls in directory
``` Then start to dev with the CLOG Builder:
sbcl --userinit init --eval "(asdf:load-system :clog/tools)" --eval "(clog-tools:clog-builder :port 0 :app t)"
``` ```
(or replace ecl for sbcl) sbcl --userinit init --eval "(asdf:load-system :clog/tools)" --eval "(clog-tools:clog-builder :port 0 :app t)"
On Windows: and after first run can use "bash run-ocicl" (or chmod 775 run-oicl to make the batch file executable)
```
``` (or replace ecl for sbcl)
sbcl --userinit init --eval "(setf asdf:*compile-file-failure-behaviour* :warn)" --eval "(asdf:load-system :clog/tools)" --eval "(clog-tools:clog-builder :port 0 :app t)"
On Windows:
and after first run can use run-ocicl.bat
``` ```
Note for Windows: unzip https://rabbibotton.github.io/clog/clogframe.zip for sbcl --userinit init --eval "(setf asdf:*compile-file-failure-behaviour* :warn)" --eval "(asdf:load-system :clog/tools)" --eval "(clog-tools:clog-builder :port 0 :app t)"
needed dlls in directory
and after first run can use "run-ocicl.bat"
I N S T A L L ```
=============
Update ocicl *frequenlty* with:
These are directions for getting started from scratch:
```
* Step 1 - Install SBCL * ocicl latest
```
Linux:
I N S T A L L
Use OS package manager like for example =============
``` These are directions for getting started from scratch:
sudo apt-get install sbcl
``` * Step 1 - Install SBCL *
Mac: Linux:
On Mac install homebrew from https://brew.sh/ Use OS package manager like for example
``` ```
brew install sbcl sudo apt-get install sbcl
brew install ocicl ```
```
Mac:
For Mac - skip step 2 - you are ready to go!
On Mac install homebrew from https://brew.sh/
Windows:
```
On Windows install Windows AMD 64 from here - brew install sbcl
https://www.sbcl.org/platform-table.html brew install ocicl
For example: ```
http://prdownloads.sourceforge.net/sbcl/sbcl-2.4.6-x86-64-windows-binary.msi
For Mac - skip step 2 - you are ready to go!
* Step 2 - Install OCICL * Windows:
Create a dir for example projects and cd to it then do: On Windows install Windows AMD 64 from here -
https://www.sbcl.org/platform-table.html
``` For example:
git clone https://github.com/ocicl/ocicl.git http://prdownloads.sourceforge.net/sbcl/sbcl-2.4.6-x86-64-windows-binary.msi
```
the cd in to ocicl and run: * Step 2 - Install OCICL *
``` Create a dir for example projects and cd to it then do:
sbcl --load setup.lisp
``` ```
git clone https://github.com/ocicl/ocicl.git
Make sure the created ocicl is on your PATH ```
On Linux: the cd in to ocicl and run to create ocicl in ~/.local/bin:
Close your terminal and reopen and in most distros is, as .local/bin is usually ```
added if exists. sbcl --load setup.lisp
```
On Windows:
Make sure the created ocicl is on your PATH
Permanently make available, by using:
On Linux:
search then type env -> then pick Edit the system environment variables
click the button environment variables -> select Path under User variables Close your terminal and reopen and in most distros is, as .local/bin is usually
click Edit... -> New and type "%USERPROFILE%\AppData\Local\ocicl\bin\" added if exists.
"Close the terminal and open a new one
On Windows:
* Step 3 - Create your project directory Permanently make available, by using:
Note: ~/common-lisp is always searched so make sure no conflicts in most cases search then type env -> then pick Edit the system environment variables
you do not want that directory to exist click the button environment variables -> select Path under User variables
click Edit... -> New and type "%USERPROFILE%\AppData\Local\ocicl\bin\"
(If converting a clog project just do in the directory with your .asd file) "Close the terminal and open a new one
For this example using projects/ctest
* Step 3 - Create your project directory
cd to projects/ctest
Note: ~/common-lisp is always searched so make sure no conflicts in most cases
``` you do not want that directory to exist
ocicl setup > init
ocicl install clog (If converting a clog project just do in the directory with your .asd file)
```
For this example using projects/ctest
Note for Windows: unzip https://rabbibotton.github.io/clog/clogframe.zip for
needed dlls in directory. You may also need to add to sbcl cd to projects/ctest
--eval "(setf asdf:*compile-file-failure-behaviour* :warn)"
```
to use sbcl any time in your own ocicl world use: ocicl setup > init
``` ocicl install clog
sbcl --userinit init ```
``` Note: run frequenlty oclicl latest to get the latest version of clog
and to start the builder in sbcl: Note for Windows: unzip https://rabbibotton.github.io/clog/clogframe.zip for
needed dlls in directory. You will also need to add to sbcl
``` --eval "(setf asdf:*compile-file-failure-behaviour* :warn)"
(asdf:load-system :clog/tools)
(clog-tools:clog-builder) To use sbcl any time in your own ocicl world use:
``` ```
sbcl --userinit init
If this is the new project a .asd file, first .lisp file and www directory ```
will be created as well. For windows run-ocicl.bat also created.
and to start the builder in sbcl:
```
(asdf:load-system :clog/tools)
(clog-tools:clog-builder)
```
If this is the new project an .asd file, first .lisp file and www directory
will be created as well. Batch files that will use your asd files to load
plugins are also configured run-ocicl.bat / run-ocicl and run-ql.bat / run-ql
are also created.
Update ocicl frequenlty with:
```
ocicl latest
```

View file

@ -150,11 +150,11 @@ nil. Resizable only works if overflow is set to :SCROLL"))
(defgeneric envelope-panel (clog-element panel width height (defgeneric envelope-panel (clog-element panel width height
&key class style units) &key class style units)
(:documentation "Create a panel of WIDTH and HEIGHT with :relative (:documentation "Create a envelope of WIDTH and HEIGHT with :relative
positioning to envelope PANEL. This allows any type of clog-panel (including positioning to envelope PANEL. The envelope is a child of CLOG-ELEMENT.
those created by CLOG Builder, to be positioned within DISPLAY :flex or This allows any type of clog-panel (including those created by CLOG Builder,
:grid layouts or otherwise treat the panel as an inline object. to be positioned within a DISPLAY :flex or :grid layout or otherwise treat the
Returns envelope-panel")) panel as an inline object. Returns the new envelope of PANEL"))
(defmethod envelope-panel ((obj clog-element) (panel clog-element) (defmethod envelope-panel ((obj clog-element) (panel clog-element)
width height width height
@ -165,6 +165,21 @@ Returns envelope-panel"))
(place-inside-top-of e panel) (place-inside-top-of e panel)
e)) e))
;;;;;;;;;;;;;;;;;;;;
;; envelope-panel ;;
;;;;;;;;;;;;;;;;;;;;
(defgeneric envelope-panel* (panel width height
&key class style units)
(:documentation "Like envelope panel, but usses the panels parent as the
parent of the envelope. Returns the new envelope of PANEL"))
(defmethod envelope-panel* ((panel clog-element)
width height
&key (units :px) class (style ""))
(envelope-panel (parent panel) panel width height
:units units :class class :style style))
;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;
;; center-children ;; ;; center-children ;;
;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;

View file

@ -650,6 +650,7 @@ embedded in a native template application.)"
"CLOG-Panel-Box-Layout" "CLOG-Panel-Box-Layout"
(clog-panel-box-layout class) (clog-panel-box-layout class)
(envelope-panel generic-function) (envelope-panel generic-function)
(envelope-panel* generic-function)
(center-children generic-function) (center-children generic-function)
(create-panel-box-layout function) (create-panel-box-layout function)
(center-panel generic-function) (center-panel generic-function)

View file

@ -276,17 +276,19 @@
(projects-load sys)) (projects-load sys))
(defun projects-add-plugin (panel sys) (defun projects-add-plugin (panel sys)
(input-dialog panel (format nil "Enter plugin name (without /tools), ~ (let ((*default-title-class* *builder-title-class*)
plugin will be added to the runtime and designtime:") (*default-border-class* *builder-border-class*))
(lambda (result) (input-dialog panel (format nil "Enter plugin name (without /tools), ~
(when result plugin will be added to the runtime and designtime:")
(let* ((s (format nil "~A/tools" sys))) (lambda (result)
(add-dep-to-defsystem s (format nil "~A/tools" result)) (when result
(projects-load s)) (let* ((s (format nil "~A/tools" sys)))
(add-dep-to-defsystem sys result) (add-dep-to-defsystem s (format nil "~A/tools" result))
(projects-load sys) (projects-load s))
(projects-populate panel))) (add-dep-to-defsystem sys result)
:height 250)) (projects-load sys)
(projects-populate panel)))
:height 250)))
(defun add-dep-to-defsystem (sys file) (defun add-dep-to-defsystem (sys file)
(let ((fname (asdf:system-source-file (asdf:find-system sys))) (let ((fname (asdf:system-source-file (asdf:find-system sys)))
@ -324,42 +326,46 @@
(pprint n s)))))) (pprint n s))))))
(defun projects-add-lisp (panel sys) (defun projects-add-lisp (panel sys)
(Input-dialog panel "Enter lisp component name (with out .lisp):" (let ((*default-title-class* *builder-title-class*)
(lambda (result) (*default-border-class* *builder-border-class*))
(when result (Input-dialog panel "Enter lisp component name (with out .lisp):"
(let ((path (asdf:component-pathname (lambda (result)
(asdf:find-system sys)))) (when result
(write-file "" (format nil "~A~A.lisp" (let ((path (asdf:component-pathname
path result) (asdf:find-system sys))))
:action-if-exists nil) (write-file "" (format nil "~A~A.lisp"
(add-file-to-defsystem sys result :file) path result)
(projects-load sys) :action-if-exists nil)
(projects-populate panel)))) (add-file-to-defsystem sys result :file)
:height 230) (projects-load sys)
(projects-load sys)) (projects-populate panel))))
:height 230)
(projects-load sys)))
(defun projects-add-clog (panel sys) (defun projects-add-clog (panel sys)
(input-dialog panel (format nil "Enter clog component name (with out .clog), ~ (let ((*default-title-class* *builder-title-class*)
a lisp component will also be created in the runtime system:") (*default-border-class* *builder-border-class*))
(lambda (result) (input-dialog panel (format nil "Enter clog component name (with out .clog), ~
(when result a lisp component will also be created in the runtime system:")
(let* ((s (format nil "~A/tools" sys)) (lambda (result)
(path (asdf:component-pathname (when result
(asdf:find-system s)))) (let* ((s (format nil "~A/tools" sys))
(write-file "" (format nil "~A~A.clog" (path (asdf:component-pathname
path result) (asdf:find-system s))))
:action-if-exists nil) (write-file "" (format nil "~A~A.clog"
(add-file-to-defsystem s result :clog-file) path result)
(projects-load s)) :action-if-exists nil)
(let ((path (asdf:component-pathname (add-file-to-defsystem s result :clog-file)
(asdf:find-system sys)))) (projects-load s))
(write-file "" (format nil "~A~A.lisp" (let ((path (asdf:component-pathname
path result) (asdf:find-system sys))))
:action-if-exists nil) (write-file "" (format nil "~A~A.lisp"
(add-file-to-defsystem sys result :file) path result)
(projects-load sys) :action-if-exists nil)
(projects-populate panel)))) (add-file-to-defsystem sys result :file)
:height 250)) (projects-load sys)
(projects-populate panel))))
:height 250)))
(defun add-file-to-defsystem (system file ftype) (defun add-file-to-defsystem (system file ftype)
(let ((fname (asdf:system-source-file (asdf:find-system system))) (let ((fname (asdf:system-source-file (asdf:find-system system)))

View file

@ -679,8 +679,12 @@ clog-builder window.")
(if project (if project
(progn (progn
(setf *start-project* (string-downcase (format nil "~A" project))) (setf *start-project* (string-downcase (format nil "~A" project)))
(projects-load *start-project*) (handler-case
(setf static-root (merge-pathnames "./www/" (format nil "~A" (asdf:system-source-directory project))))) (progn
(projects-load (format nil "~A/tools" *start-project*))
(setf static-root (merge-pathnames "./www/" (format nil "~A" (asdf:system-source-directory project)))))
(error ()
(projects-load *start-project*))))
(setf *start-project* nil)) (setf *start-project* nil))
(when dir (when dir
(setf *start-dir* dir)) (setf *start-dir* dir))

View file

@ -5,7 +5,7 @@
;; (pushnew #P"/path/of/projects" ql:*local-project-directories* :test #'equalp) ;; (pushnew #P"/path/of/projects" ql:*local-project-directories* :test #'equalp)
;; ;;
;; System to be available but not listed: ;; System to be available but not listed:
;; (pushnew #P"/path/to/a/projects" asdf:*central-registry* :test #'equalp) ;; (pushnew #P"/path/to/a/project" asdf:*central-registry* :test #'equalp)
;; Preferences loaded on next call to clog-tools:clog-builder or [Eval All] ;; Preferences loaded on next call to clog-tools:clog-builder or [Eval All]