https://github.com/lilactown/7-humble-guis
An implementation of 7 GUIs using HumbleUI
https://github.com/lilactown/7-humble-guis
Last synced: 6 months ago
JSON representation
An implementation of 7 GUIs using HumbleUI
- Host: GitHub
- URL: https://github.com/lilactown/7-humble-guis
- Owner: lilactown
- License: mit
- Created: 2022-12-21T17:53:01.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-02T08:43:40.000Z (almost 3 years ago)
- Last Synced: 2023-04-20T17:01:24.539Z (over 2 years ago)
- Language: Clojure
- Size: 2 MB
- Stars: 30
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 7 Humble GUIs
An implementation of [7 GUIs](https://eugenkiss.github.io/7guis/tasks/) in
Clojure + [HumbleUI](https://github.com/HumbleUI/HumbleUI).Built using [lilactown/humble-starter](https://github.com/lilactown/humble-starter).
## GUIs
### GUI 1: Counter
**STATUS**: Complete

### GUI 2: Temperature converter
**STATUS**: Complete

### GUI 3: Flight booker
**STATUS**: Complete

### GUI 4: Timer
**STATUS**: Complete

### GUI 5: CRUD
**STATUS**: Complete

### GUI 6: Circle drawer
**STATUS**: Complete

### GUI 7: Cells
**STATUS**: WIP

## Running
To run each GUI, pass the `./script/run.sh` script the number you want to run.
```clojure
# run the "Counter" GUI
./script/run.sh 1# run the "Timer" GUI
./script/run.sh 4
```## Development
To start a REPL (including a minimal nREPL server), you can run `./scripts/nrepl.sh`.
For Editor tooling, see below section.To run each GUI, evaluate the namespace (e.g. `town.lilac.humble.app.gui-1`)
through the REPL. To see changes, evaluate it again.### IntelliJ/Cursive
Create a REPL for HumbleUI apps as you would for any other application:
- Create a [Local REPL configuration](https://cursive-ide.com/userguide/repl.html#local-repls), and accept all the defaults
- Run that newly created REPL### CIDER
> TL;DR: Customize the jack in command, delete the `:cider/nrepl` alias at the
> end of the command and replace it with `:dev:cider`If you use an editor like Emacs or Calva which integrates using CIDER, you can
customize the jack-in command to work with your HumbleUI app.> NOTE: The default jack-in command will not work, since we need to start the
> HumbleUI app on a different thread than the nREPL server. By default, the
> nREPL server will start and then you would evaluate commands via this
> connection, but this will not work when starting the HumbleUI app.To ensure that you are loading the correct version of nREPL and CIDER, we start
by running the jack-in command but customizing it. In Emacs, this is
`C-u M-x cider-jack-in`. An example of what the default command looks like:```
/opt/homebrew/bin/clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "1.0.0"} cider/cider-nrepl {:mvn/version "0.28.6"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}}}' -M:cider/nrepl
```For our purposes, the `user` ns has a `-main` function which handles all of the
app and nREPL server initialization. The only thing we need to replace the call to
CIDER's main with our own and pass in the middlewares to it.Below, we show the command after we delete the use of the `:cider/nrepl` alias
and replace it with the `:dev:cider` alias configured in our deps.edn, which
calls our custom `-main` function wiht the CIDER middlewares```
/opt/homebrew/bin/clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "1.0.0"} cider/cider-nrepl {:mvn/version "0.28.6"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}}}' -M:dev:cider
```
## Credit
A lot of this code was copied and then modified from the HumbleUI codebase
itself, as well as [humble-dec](https://github.com/tonsky/humble-deck/) and
[humble-animations](https://github.com/oakmac/humble-animations). Thanks to
@tonsky for developing HumbleUI and releasing so many cool examples, and @oakmac
for showing me some cool stuff too!## License & Copyright
Licensed under MIT. Copyright Will Acton 2022.