This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-15
Channels
- # aleph (1)
- # announcements (7)
- # beginners (6)
- # calva (24)
- # cider (18)
- # clj-otel (1)
- # clojars (8)
- # clojure (22)
- # clojure-dev (11)
- # clojure-europe (52)
- # clojure-finland (12)
- # clojure-nl (1)
- # clojure-norway (28)
- # clojure-uk (7)
- # clojured (1)
- # cursive (6)
- # datomic (1)
- # events (1)
- # humbleui (41)
- # hyperfiddle (75)
- # lsp (46)
- # malli (34)
- # matrix (1)
- # off-topic (16)
- # releases (1)
- # shadow-cljs (12)
- # squint (11)
- # timbre (1)
- # tools-deps (24)
Who said UI apps had to be scary? This is all that’s required to get this window on screen (once I merge vdom branch, soon)
How to specify the dependency upon io.github.humbleui.ui in lein-new-app created project's project.clj? I naively tried:
:dependencies [[org.clojure/clojure "1.10.0"]
[io.github.humbleui/humbleui {:git/sha "c5b4179e44c486b2d9171be845eb14ff8a7936cf"}]]
Of course, the above bombed out with:
java.lang.IllegalArgumentException: Bad artifact coordinates io.github.humbleui:humbleui:jar:{:git/sha "c5b4179e44c486b2d9171be845eb14ff8a7936cf"}, expected format is :[:[:]]:
(I stole the incantation from the following:
).I’m not sure if lein can consume git deps or deps.edn project. Sorry it’s not convenient but the framework itself is still far from being usable so no reason to get comfortable yet
UPDATE:
I seem to have been successful in overcoming the above obstacle.
The next obstacle is:
java.lang.ClassNotFoundException: http://io.github.humbleui.jwm.App
I tried both the above code and the following (taken from end of
):
(ns scaryui.core
(:require [io.github.humbleui.ui :as ui])
(:gen-class))
(def ui
(ui/default-theme {}
(ui/center
(ui/label "Hello from Humble UI! 👋"))))
(defn -main ;; I enclosed your ui/start-app! form inside -main.
"Trying it"
[& args]
(ui/start-app!
(ui/window
{:title "Humble 🐝 UI"}
#'ui)))
At this point I am surrendering to the Gods of Sleep.FYI, my project.clj at this moment is attached below. I did not bother to clean it up.
Hello! I am a newbie.
Is it posible to run and debug HumbleUI applications using only Clojure CLI tools?
No python, no shell and so on..
I tried directly, but often Java crashes. And impossible to catch exception :(
@U06CUH4D2BT,
Is this the Java exception that you see?
java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "x" is null
# # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007fb842bcf28d, pid=14916, tid=14987 # # JRE version: OpenJDK Runtime Environment (11.0.21+9) (build 11.0.21+9-post-Ubuntu-0ubuntu122.04) # Java VM: OpenJDK 64-Bit Server VM (11.0.21+9-post-Ubuntu-0ubuntu122.04, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64) # Problematic frame: # C [libskija.so+0x3bf28d] SkFont::refTypefaceOrDefault() const+0x1d # # Core dump will be written. Default location: Core dumps may be processed with "/lib/systemd/systemd-coredump %P %u %g %s %t 9223372036854775808 %h" (or dumping to /home/ru/clojure/pro-humbleui/core.14916) # # An error report file with more information is saved as: # /home/ru/clojure/pro-humbleui/hs_err_pid14916.log # # If you would like to submit a bug report, please visit: # https://bugs.launchpad.net/ubuntu/+source/openjdk-lts # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # rlwrap: warning: clojure crashed, killed by SIGABRT (core dumped). rlwrap itself has not crashed, but for transparency, it will now kill itself with the same signal warnings can be silenced by the --no-warnings (-n) option Aborted (core dumped)
No Java Exceptions at all. Java crash and in terminal something like this.
Thanks. You seem to be using Java 11. I use Java 17, and there is Java 21. I do not know if this tidbit is relevant.
Thanks for tip. I try on upgraded Java. Just in case full dump is: ru@ru-sitrol:~/clojure/HumbleUI$ clj Clojure 1.11.1 (require '[io.github.humbleui.ui :as ui]) nil (def UI-animation (ui/row (ui/column (ui/animation "dev/images/animated.gif") (ui/gap 0 10) (ui/label "GIF")) (ui/gap 10 0) (ui/column (ui/animation "dev/images/animated.webp") (ui/gap 0 10) (ui/label "WebP")))) #'user/UI-animation (defn run-animation [] (ui/start-app! (ui/window {:title "Humble 🐝 Animation" :exit-on-close? false} #'UI-animation))) #'user/run-animation (run-animation) #object[clojure.core$future_call$reify__8544 0x11170228 {:status :pending, :val nil}] user=> # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007f72e6bcf28d, pid=16077, tid=16189 # # JRE version: OpenJDK Runtime Environment (11.0.21+9) (build 11.0.21+9-post-Ubuntu-0ubuntu122.04) # Java VM: OpenJDK 64-Bit Server VM (11.0.21+9-post-Ubuntu-0ubuntu122.04, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64) # Problematic frame: # C [libskija.so+0x3bf28d] SkFont::refTypefaceOrDefault() const+0x1d # # Core dump will be written. Default location: Core dumps may be processed with "/lib/systemd/systemd-coredump %P %u %g %s %t 9223372036854775808 %h" (or dumping to /home/ru/clojure/HumbleUI/core.16077) # # An error report file with more information is saved as: # /home/ru/clojure/HumbleUI/hs_err_pid16077.log # # If you would like to submit a bug report, please visit: # https://bugs.launchpad.net/ubuntu/+source/openjdk-lts # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # rlwrap: warning: clojure crashed, killed by SIGABRT (core dumped). rlwrap itself has not crashed, but for transparency, it will now kill itself with the same signal warnings can be silenced by the --no-warnings (-n) option Aborted (core dumped) ru@ru-sitrol:~/clojure/HumbleUI$
Same result for Java 17 :(
@Руслан Сорокин,
I ran your code (without the ui/animation calls, because I do not have your files).
I got the same Java exception I got before:
java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "x" is null
Seems to be a HumbleUI bug (expected, as this package is being developed).
Thank you. It will be great to have a clean HumbleUI environment and easy launch and debugging only on Clojure. So far it's not very "humble" :)
@U06CUH4D2BT all I was saying is that your clj command is all bash https://github.com/clojure/brew-install/blob/1.11.1/src/main/resources/clojure/install/clojure
For me, too. This is exactly what I wanted! Thank you Niki. I wasn't entirely clear when I mentioned Shell and Bash. In some humbleui apps I saw such formula to start: "./script/.." This is new for me, especially that furher goes somthing like "blabla.py" or "blabla.sh". This move me to discuss cleanliness of environment. I understand that CLI is bash, but to use CLI I have to know only CLI, no need to know bash language (almost). That's I mean.
I see. We have python scripts for the sole reason that bash (including Clojure CLI) doesn't work well on Windows
It seems that the problem (the Cannot invoke "Object.getClass()" because "x" is null
exception) with when using leiningen to run my scaryui (the HumbleUI toy application) is due to a difference among java/IRect.java
and java-clojure/IRect.java
in
, which is imported by my application as the dependency [io.github.humbleui/types "0.2.0"]
(part of :dependencies declaration).
The java-clojure/IRect.java
variant declares :x and :y as keywords, but the other variant does not.
I still have to find how to get my leiningen configuration to pick up the java-clojure
variant rather than the java
variant.
DISCLAIMER: I did not confirm, yet, that patching the io.github.humbleui/types
dependency would cause the problem to go away.
Yes. I think it maven world it’s called “classifier”, so you need io.github.humbleui/types
version 0.2.0
with classifier clojure
. I have an explanation here https://tonsky.me/blog/humble-decomposition/
@U050UBKAA,
Thanks for the explanation. It confirms my guess that it must be something simple and, from your side of things, trivial.
After figuring out how to declare a classifier in leiningen world: by golly, it works!
Simply, in :dependencies
write:
[io.github.humbleui/types "0.2.0" :classifier "clojure"]
The full project.clj
, that I used in my scaryui
toy project, is attached to this response.
You may want to advise how can we go about adding it to your HumbleUI demo projects so that everyone will be able to freely choose between clj and leiningen.I slightly changed humbleui-starter example to run application several times:
(ns starter
(:require
[io.github.humbleui.ui :as ui]))
(ui/defcomp app []
[ui/center
[ui/label "Hello, world"]])
(defn run []
(ui/start-app!
(ui/window
{:exit-on-close? false}
#'app)))
(require 'starter) nil (starter/run) #object[clojure.core$future_call$reify__8544 0x497ed877 {:status :pending, :val nil}] user=> 00:28.729 Loading align 00:28.762 Loading label
After closing first window the program hung..
How can I debug application, if I can't run it several times?
I usually just never close the window. But if you want to do it, call (ui/start-app!)
just once (maybe without window even, it should work, I think), and then call (ui/window {:exit-on-close? false} #'app)
as many times as you want (maybe wrapped in app/doui
if needed)
@U050UBKAA How do you debug app never closing the window? Can you point me a link to example in which I can update code of the application and repaint its window without closing.
The idea is simple: put window somewhere safe, pass app reference as a var (opposed to plain value), then update that var. Window will automatically redraw All my projects are set up this way, reloading is done by tools.namespace Take a look: https://github.com/HumbleUI/HumbleUI/blob/321a27826b6dca2e35bde3b6ec0fc261f2e71121/dev/user.clj#L37-L44 https://github.com/HumbleUI/humble-deck/blob/8743bda64aff11074dc871b8c8e45da96c02594b/dev/user.clj#L36-L42
@U050UBKAA I see. Humbleui-deck is great. Thank you very much!
# # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007fb842bcf28d, pid=14916, tid=14987 # # JRE version: OpenJDK Runtime Environment (11.0.21+9) (build 11.0.21+9-post-Ubuntu-0ubuntu122.04) # Java VM: OpenJDK 64-Bit Server VM (11.0.21+9-post-Ubuntu-0ubuntu122.04, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64) # Problematic frame: # C [libskija.so+0x3bf28d] SkFont::refTypefaceOrDefault() const+0x1d # # Core dump will be written. Default location: Core dumps may be processed with "/lib/systemd/systemd-coredump %P %u %g %s %t 9223372036854775808 %h" (or dumping to /home/ru/clojure/pro-humbleui/core.14916) # # An error report file with more information is saved as: # /home/ru/clojure/pro-humbleui/hs_err_pid14916.log # # If you would like to submit a bug report, please visit: # https://bugs.launchpad.net/ubuntu/+source/openjdk-lts # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # rlwrap: warning: clojure crashed, killed by SIGABRT (core dumped). rlwrap itself has not crashed, but for transparency, it will now kill itself with the same signal warnings can be silenced by the --no-warnings (-n) option Aborted (core dumped)