Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LabGUI.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
processes
LabGUI.jl
Commits
3e681153
Commit
3e681153
authored
7 years ago
by
Jacob Wikmark
Browse files
Options
Downloads
Patches
Plain Diff
obs => observe
parent
91b97ae9
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/construct.jl
+1
-1
1 addition, 1 deletion
src/construct.jl
src/gui.jl
+7
-7
7 additions, 7 deletions
src/gui.jl
src/tools.jl
+1
-1
1 addition, 1 deletion
src/tools.jl
test/runtests.jl
+3
-3
3 additions, 3 deletions
test/runtests.jl
with
12 additions
and
12 deletions
src/construct.jl
+
1
−
1
View file @
3e681153
...
...
@@ -17,7 +17,7 @@ end
function
map_block
(
block
,
symbols
)
lambda
=
Expr
(
:
(
->
),
Expr
(
:
tuple
,
symbols
...
),
block
)
:
(
map
(
$
lambda
,
$
(
map
(
s
->:
(
obs
(
$
s
)),
symbols
)
...
)))
:
(
map
(
$
lambda
,
$
(
map
(
s
->:
(
obs
erve
(
$
s
)),
symbols
)
...
)))
end
function
symbols
(
bindings
)
...
...
This diff is collapsed.
Click to expand it.
src/gui.jl
+
7
−
7
View file @
3e681153
...
...
@@ -80,7 +80,7 @@ Used to set the widgets, the dom or the data array of the GUI. This replaces any
"""
function
set!
(
gui
::
GUI
,
widgets
::
Widget_Container
)
gui
.
widgets
=
widgets
gui
.
values
=
[
obs
(
widget
)
.
val
for
widget
in
gui
.
widgets
.
widgets
]
gui
.
values
=
[
obs
erve
(
widget
)
.
val
for
widget
in
gui
.
widgets
.
widgets
]
end
function
set!
(
gui
::
GUI
,
dom
::
WebIO
.
Node
)
...
...
@@ -109,11 +109,11 @@ function Base.push!(gui::GUI, values::Tuple, indices::Tuple)
end
function
Base.getindex
(
gui
::
GUI
,
s
::
Symbol
)
obs
(
gui
.
widgets
[
s
])[]
obs
erve
(
gui
.
widgets
[
s
])[]
end
function
Base.setindex!
(
gui
::
GUI
,
newval
,
s
::
Symbol
)
obs
(
gui
.
widgets
[
s
])[]
=
newval
obs
erve
(
gui
.
widgets
[
s
])[]
=
newval
end
"""
...
...
@@ -126,7 +126,7 @@ function add!(gui::GUI, widgets::Widget_Container)
end
gui
.
widgets
.
widgets
=
vcat
(
gui
.
widgets
.
widgets
,
widgets
.
widgets
)
gui
.
widgets
.
vals
=
merge
(
gui
.
widgets
.
vals
,
newdict
)
gui
.
values
=
vcat
(
gui
.
values
,
[
obs
(
w
)[]
for
w
in
widgets
.
widgets
])
gui
.
values
=
vcat
(
gui
.
values
,
[
obs
erve
(
w
)[]
for
w
in
widgets
.
widgets
])
end
...
...
@@ -196,14 +196,14 @@ function update(gui::GUI, s::Symbol, watchsymbol=:0)
# if the value of the widget associated with watchsymbol has changed
w
=
gui
.
widgets
[
s
]
if
watchsymbol
==:
0
||
has_changed
(
gui
,
watchsymbol
)
#obs(w).listeners[2](obs(w)[])
obs
(
w
)[]
=
obs
(
w
)[]
#obs
erve
(w).listeners[2](obs
erve
(w)[])
obs
erve
(
w
)[]
=
obs
erve
(
w
)[]
end
end
function
update
(
gui
::
GUI
,
a
::
Array
,
watchsymbol
=:
0
)
W
=
[
gui
.
widgets
[
s
]
for
s
in
a
]
if
watchsymbol
==:
0
||
has_changed
(
gui
,
watchsymbol
)
[
obs
(
w
)
.
listeners
[
2
](
obs
(
w
)[])
for
w
in
W
]
[
obs
erve
(
w
)
.
listeners
[
2
](
obs
erve
(
w
)[])
for
w
in
W
]
end
end
...
...
This diff is collapsed.
Click to expand it.
src/tools.jl
+
1
−
1
View file @
3e681153
...
...
@@ -4,7 +4,7 @@ Links the values of two observables by adding a listener. Optional arguments f a
Example:
link(o1, o2, (x) -> 2*x, (x) -> x/2)
will ensure obs(o2)[] is always 2*obs(o1)[] and vice versa.
will ensure obs
erve
(o2)[] is always 2*obs
erve
(o1)[] and vice versa.
"""
function
link!
(
o1
::
Observable
,
o2
::
Observable
,
f
=
(
x
)
->
(
x
),
g
=
(
x
)
->
(
x
),
master
=
false
)
...
...
This diff is collapsed.
Click to expand it.
test/runtests.jl
+
3
−
3
View file @
3e681153
...
...
@@ -59,7 +59,7 @@ end
add!
(
gui
,
wid2
)
gui
[
:
dummy
]
=
23
@test
typeof
(
gui
())
<:
WebIO
.
Node
@test
obs
(
dummy
)[]
==
23
@test
obs
erve
(
dummy
)[]
==
23
@test
gui
.
widgets
[
:
dummy
]
==
dummy
end
...
...
@@ -86,6 +86,6 @@ end
WebIO
.
render
(
dummy
)
end
@test
typeof
(
ui
)
<:
WebIO
.
Node
{
WebIO
.
DOM
}
obs
(
dummy
)[]
=
80
@test
obs
(
dummy
)[]
==
80
obs
erve
(
dummy
)[]
=
80
@test
obs
erve
(
dummy
)[]
==
80
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment