From 1360406d5a53cf7819a3e8c152f1fe753c7148ef Mon Sep 17 00:00:00 2001 From: Aidan Hahn Date: Mon, 15 Jul 2019 22:37:09 -0700 Subject: [PATCH] significantly more sane design --- .#README.md | 1 + CHANGELOG.md | 18 +----------------- src/whisper/core.clj | 12 ++++++------ src/whisper/signald.clj | 2 ++ src/whisper/ui.clj | 18 ++++++++++++++++++ 5 files changed, 28 insertions(+), 23 deletions(-) create mode 120000 .#README.md create mode 100644 src/whisper/ui.clj diff --git a/.#README.md b/.#README.md new file mode 120000 index 0000000..192ca7b --- /dev/null +++ b/.#README.md @@ -0,0 +1 @@ +ink@Magellan.6427:1563239860 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 63c0b7f..f1e02ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,20 +5,4 @@ All notable changes to this project will be documented in this file. This change ### Changed - Add a new arity to `make-widget-async` to provide a different widget shape. -## [0.1.1] - 2019-07-06 -### Changed -- Documentation on how to make the widgets. - -### Removed -- `make-widget-sync` - we're all async, all the time. - -### Fixed -- Fixed widget maker to keep working when daylight savings switches over. - -## 0.1.0 - 2019-07-06 -### Added -- Files from the new template. -- Widget maker public API - `make-widget-sync`. - -[Unreleased]: https://github.com/your-name/whisper/compare/0.1.1...HEAD -[0.1.1]: https://github.com/your-name/whisper/compare/0.1.0...0.1.1 +[Unreleased]: https://git.aidanis.online/aidan/whisper/compare/HEAD diff --git a/src/whisper/core.clj b/src/whisper/core.clj index 0c56039..bc2815b 100644 --- a/src/whisper/core.clj +++ b/src/whisper/core.clj @@ -3,13 +3,13 @@ (:use [whisper.ui] [whisper.signald])) -;; SEESAW GUI STUFF -(def mainWindow (frame :title "Signald Version Reader")) +(defn main-loop + "updates UI with data from Signald" + [content] + (update mainWindow content) + (recur (get-next-update))) (defn -main "packs and shows main window with signald version string" [& args] - (println (config! (-> mainWindow pack! show!) - :content (reduce (fn [k v] - (apply str [k v])) - (get-next-update))))) + ()) diff --git a/src/whisper/signald.clj b/src/whisper/signald.clj index b8f203b..90b91c3 100644 --- a/src/whisper/signald.clj +++ b/src/whisper/signald.clj @@ -4,12 +4,14 @@ (org.newsclub.net.unix AFUNIXSocket AFUNIXSocketAddress) (java.io File BufferedReader InputStreamReader))) +;; Signald global state vars (def sigdSock (AFUNIXSocket/connectTo (AFUNIXSocketAddress. (File. "/var/run/signald/signald.sock")))) (def sigdRead (BufferedReader. (InputStreamReader. (. sigdSock getInputStream)))) (def sigdWrite (. sigdSock getOutputStream)) +;; Signald Functions (defn get-next-update "Retrieves and parses next line of incoming data from signald" [] diff --git a/src/whisper/ui.clj b/src/whisper/ui.clj new file mode 100644 index 0000000..8e90808 --- /dev/null +++ b/src/whisper/ui.clj @@ -0,0 +1,18 @@ +(ns whisper.ui + "Whisper UI Module" + (:use [seesaw.core])) + +;; UI Global State +(native!) +(def mainWindow (frame :title "Signald Version Reader" + :content " Loading... " + :width 250 + :height 40)) + +;; UI Functions +(defn update + "Updates WINDOW to display additional content: CONTENT" + [window content] + (config! window :content + (concat (:content window) content)) + window)