From b356b6e390a67be4d3ea0859c0bd7754a44516cf Mon Sep 17 00:00:00 2001 From: rafaqz Date: Mon, 6 Dec 2021 14:00:58 +0100 Subject: [PATCH] update docs, bump DG version to 0.21, and patch version to 0.6.3 --- Project.toml | 4 ++-- src/electron.jl | 8 +++++++- src/interact.jl | 39 ++++++++++++++++++++++++--------------- src/server.jl | 12 ++++++------ 4 files changed, 39 insertions(+), 24 deletions(-) diff --git a/Project.toml b/Project.toml index ff51da2..96a9e4f 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "DynamicGridsInteract" uuid = "3ccff026-9a20-11e9-1704-43e1c6ed0af5" authors = ["Rafael Schouten "] -version = "0.6.2" +version = "0.6.3" [deps] Blink = "ad839575-38b3-5650-b840-f874b8c74a25" @@ -16,7 +16,7 @@ WebSockets = "104b5d7c-a370-577a-8038-80a2059c5097" [compat] Blink = "0.12" -DynamicGrids = "^0.18.4, 0.19, 0.20" +DynamicGrids = "0.21" ImageShow = "0.2.3, 0.3" Interact = "0.10" InteractBase = "0.10" diff --git a/src/electron.jl b/src/electron.jl index 430f1b0..f8d362e 100644 --- a/src/electron.jl +++ b/src/electron.jl @@ -8,7 +8,13 @@ A html output using Interact.jl and an Electron window through Blink.jl ElectronOutput automatically generates sliders to control simulations in realtime. args and kwargs are passed to [`InteractOutput`](@ref). -Keyword arguments are passed to [`InteractOutput`](@ref). +# Arguments + +- `init`: initialisation `AbstractArray` or `NamedTuple` of `AbstractArray`. + +# Keywords + +$INTERACT_OUTPUT_KEYWORDS """ mutable struct ElectronOutput{T,F,I<:InteractOutput{T,F}} <: AbstractInteractOutput{T,F} interface::I diff --git a/src/interact.jl b/src/interact.jl index 8d007ab..a9990ee 100644 --- a/src/interact.jl +++ b/src/interact.jl @@ -1,4 +1,26 @@ +const INTERACT_OUTPUT_KEYWORDS = """ +- `ruleset::Ruleset`: the ruleset to run in the interface simulations. + +#### `DynamicGrids.Extent` keywords: + +$(DynamicGrids.EXTENT_KEYWORDS) + +An `Extent` object can be also passed to the `extent` keyword, and other keywords will be ignored. + +#### `DynamicGrids.GraphicConfig` keywords: + +$(DynamicGrids.GRAPHICCONFIG_KEYWORDS) + +A `GraphicConfig` object can be also passed to the `graphicconfig` keyword, and other keywords will be ignored. + +#### `DynamicGrids.ImageConfig` keywords: + +$(DynamicGrids.IMAGECONFIG_KEYWORDS) + +(See DynamicGrids.jl docs for more details) +""" + """ AbstractInteractOutput @@ -18,24 +40,11 @@ and the back-end for [`ElectronOutput`](@ref) and [`ServerOutput`](@ref). # Arguments: -- `init`: initialisation `Array` or `NamedTuple` of arrays. +- `init`: initialisation `AbstractArray` or `NamedTuple` of `AbstractArray`. # Keywords -- `ruleset::Ruleset`: the ruleset to run in the interface simulations. -- `tspan`: `AbstractRange` timespan for the simulation -- `aux`: NamedTuple of arbitrary input data. Use `get(data, Aux(:key), I...)` - to access from a `Rule` in a type-stable way. -- `mask`: `BitArray` for defining cells that will/will not be run. -- `padval`: padding value for grids with neighborhood rules. The default is `zero(eltype(init))`. -- `font`: `String` font name, used in default `TextConfig`. A default will be guessed. -- `text`: `TextConfig` object or `nothing` for no text. -- `scheme`: ColorSchemes.jl scheme, or `Greyscale()` -- `renderer`: `Renderer` such as `Image` or `Layout` -- `minval`: minimum value(s) to set colour maximum -- `maxval`: maximum values(s) to set colour minimum - -(See DynamicGrids.jl docs for more details) +$INTERACT_OUTPUT_KEYWORDS """ mutable struct InteractOutput{T,F<:AbstractVector{T},E,GC,IC,RS<:Ruleset,Pa,IM,TI} <: AbstractInteractOutput{T,F} frames::F diff --git a/src/server.jl b/src/server.jl index d6f8081..ed0bb6d 100644 --- a/src/server.jl +++ b/src/server.jl @@ -13,19 +13,19 @@ Each page load gets a newly initialised Rulset. # Keyword arguments -- `port`: port number to reach the server. ie localhost:8080 -- `ruleset::Ruleset`: the ruleset to run in the interface simulations. -- `tspan`: `AbstractRange` timespan for the simulation -- `kw`: other keyword arguments to be passed to [`InteractOuput`](@ref). +- `port`: port number to reach the server. `8080` by default, found at `localhost:8080`. +$INTERACT_OUTPUT_KEYWORDS + +An `ImageConfig` object can be also passed to the `imageconfig` keyword, and other keywords will be ignored. """ mutable struct ServerOutput{I} init::I port::Int end -function ServerOutput(init; port=8080, ruleset, kwargs...) +function ServerOutput(init; port=8080, ruleset, kw...) server = ServerOutput(init, port) function app(request) - InteractOutput(deepcopy(server.init); ruleset=deepcopy(ruleset), kwargs...).page + InteractOutput(deepcopy(server.init); ruleset=deepcopy(ruleset), kw...).page end WebIO.webio_serve(Mux.page("/", request -> app(request)), port) return server