Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use documenter for docs #152

Merged
merged 3 commits into from
Feb 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@ deps/downloads
deps/src
deps/usr
deps/deps.jl
docs/build
docs/src/examples
.DS_Store
*~
*.jl.cov
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -10,6 +10,11 @@ julia:
- 1.3
- nightly

branches:
only:
- master
- /release-.*/

jobs:
exclude:
- julia: nightly
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -13,8 +13,8 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Tk_jll = "056b5f69-f28f-5060-ad8a-df43647a2b5c"

[compat]
Cairo = "1"
Graphics = "1"
julia = "1.3"
Tcl_jll = "8.6"
Tk_jll = "8.6"
Cairo = "1"
julia = "1.3"
6 changes: 0 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -6,12 +6,6 @@ platform:
- x86 # 32-bit
- x64 # 64-bit

matrix:
allow_failures:
- platform: x86



branches:
only:
- master
8 changes: 8 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
Tk = "4225ea8a-3324-57e7-9ddc-5798a2cb9eab"

[compat]
Documenter = "0.24"
Literate = "2.2.1"
20 changes: 20 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Documenter, Literate
using Tk

Literate.markdown("../examples/manipulate.jl", "src/examples"; documenter=true)
Literate.markdown("../examples/process.jl", "src/examples"; documenter=true)
Literate.markdown("../examples/sketch.jl", "src/examples"; documenter=true)
Literate.markdown("../examples/test.jl", "src/examples"; documenter=true)

makedocs(modules = [Tk],
sitename = "Tk.jl",
pages = Any[
"Home" => "index.md",
"More" => Any[
"Manipulate" => "examples/manipulate.md",
"Process" => "examples/process.md",
"Sketch" => "examples/sketch.md",
"Test" => "examples/test.md"
],
"API Reference" => "api.md"
])
9 changes: 9 additions & 0 deletions docs/src/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Tk.jl API

```@index
```

```@autodocs
Modules = [Tk]
Order = [:type, :function]
```
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
3 changes: 2 additions & 1 deletion examples/README.md → docs/src/index.md
Original file line number Diff line number Diff line change
@@ -67,6 +67,7 @@ convenience methods defined.


## Examples
### Hello world

A simple "Hello world" example, which shows off many of the styles is given by:

@@ -146,7 +147,7 @@ pack(f, expand=true, fill="both")
* resizing top level windows with the mouse can leave visual artifacts, at least on a
Mac. This is not optimal! (The picture below can be avoided by packing an expanding frame into the top level widget.)

<img src="munged-window.png"></img>
![Munged Windows](munged-window.png)

### Message Box

File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
27 changes: 13 additions & 14 deletions examples/manipulate.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## This is an example mimicking RStudio's `manipulate` package (inspired by Mathematica's no doubt)
## The manipulate function makes it easy to create "interactive" GUIs. In this case, we can
## dynamically control parameters of a `Winston` graph.
## To add a control is easy. There are just a few: slider, picker, checkbox, button, and entry
# This is an example mimicking RStudio's `manipulate` package (inspired by Mathematica's no doubt)
# The manipulate function makes it easy to create "interactive" GUIs. In this case, we can
# dynamically control parameters of a `Winston` graph.
# To add a control is easy. There are just a few: slider, picker, checkbox, button, and entry

using Winston
using Tk
@@ -17,9 +17,10 @@ function render(c, p)
Tk.update()
end

## do a manipulate type thing
# do a manipulate type thing

# context to store dynamic values

## context to store dynamic values
module ManipulateContext
using Winston
end
@@ -92,7 +93,7 @@ get_label(widget::ButtonWidget) = nothing
button(label::AbstractString) = ButtonWidget(label, nothing)


## Add text widget to gather one-line of text
# Add text widget to gather one-line of text
mutable struct EntryWidget <: ManipulateWidget
nm
label
@@ -104,7 +105,7 @@ entry(nm::AbstractString, initial::AbstractString) = EntryWidget(nm, nm, initial
entry(nm::AbstractString) = EntryWidget(nm, nm, "{}")


## Expression returns a plot object. Use names as values
# Expression returns a plot object. Use names as values
function manipulate(ex::(Union{Symbol,Expr}), controls...)
widgets = Array(Tk.Widget, 0)

@@ -147,17 +148,16 @@ function manipulate(ex::(Union{Symbol,Expr}), controls...)
render(graph, p)
end
map(u -> callback_add(u, make_graphic), widgets)
# make_graphic()
widgets
end




## we need to make an expression
## here we need to
## * use semicolon (perhaps)
## * return p, the FramedPlot object to draw
# we need to make an expression.
# here we need to
# * use semicolon (perhaps)
# * return p, the FramedPlot object to draw

ex = quote
x = linspace( 0, n * pi, 100 )
@@ -181,4 +181,3 @@ obj = manipulate(ex,
,picker("color", "Cos color", ["red", "green", "yellow"])
,button("update")
)

4 changes: 2 additions & 2 deletions examples/process.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
f = "radio.png"
f = "logo.gif"
using Base64

function process_file(f)
a = readchomp(`cat $f`)
"<!-- $f -->\n<img src='data:image/png;base64,$(base64encode(a))'></img>"
"<!-- $f -->\n<img src='data:image/gif;base64,$(base64encode(a))'></img>"
end

process_file(f)
12 changes: 6 additions & 6 deletions examples/test.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
## Example of widgets put into container with change handler assigned
# Example of widgets put into container with change handler assigned

using Tk

w = Toplevel("Test window", false)
## pack in tk frame for themed widgets
# pack in tk frame for themed widgets
f = Frame(w)
configure(f, Dict(:padding => [3,3,2,2], :relief=>"groove"))
pack(f, expand=true, fill="both")

## widgets
# widgets
b = Button(f, "one")
cb = Checkbutton(f, "checkbutton")
rg = Radio(f, ["one", "two", "trhee"])
@@ -17,10 +17,10 @@ sl = Spinbox(f, 1:10)
e = Entry(f, "starting text")
widgets = (b, cb, rg, sc, sl, e)

## oops, typo!
# oops, typo!
set_items(rg.buttons[3], "three")

## packing
# packing
pack_style = ["pack", "grid", "formlayout"][3]

if pack_style == "pack"
@@ -35,7 +35,7 @@ else
map(u -> formlayout(u, "label"), widgets)
end

## bind a callback to each widget
# bind a callback to each widget
change_handler(path,xs...) = println(map(get_value, widgets))
map(u -> callback_add(u, change_handler), widgets)