/ui-xml-generator

Primary LanguageCommon LispMIT LicenseMIT

README

UI XML Generator

I need to convert a tree of Lisp keywords and strings to an XML string from my experiments with Gtk 4 user interface creation.

Trying it

loading

(push "~/Programming/Lisp/ui-xml-generator/" asdf:*central-registry*)
(ql:quickload :ui-xml-generator)

example use

Run this in your REPL.

(ui-xml-generator:xml-string
 '(:interface nil :children
   (:requires (:lib "gtk" :version "4.6") :content :none)
   (:object (:class "GtkApplicationWindow" :id "window") :children
    (:property (:name "title") :content "UI File Example")
    (:child nil :children
     (:object (:class "GtkBox") :children
              (:property (:name "orientation") :content "vertical")
              (:child nil :children
                      (:object (:class "GtkLabel" :id "label") :children
                               (:property (:name "height-request") :content "50")
                               (:property (:name "label") :content "Hello with <b>HTML</b> markup")
                               (:property (:name "use-markup") :content "True")
                               (:property (:name "vexpand") :content "True")
                               (:property (:name "width-request") :content "100")))
              (:child nil :children
                      (:object (:class "GtkButton" :id "button-exit") :children
                               (:property (:name "label") :content "Exit"))))))))

Using it in other projects

If you use SBCL and quicklisp, either copy or symlink it to quicklisp/local-projects and add it to the asd file of your project, in the :depends-on section.

symlink example

cd ~/quicklisp/local-projects
ln -s ~/Programming/Lisp/ui-xml-generator ./ui-xml-generator