Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Flatland
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
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sfwatergit
Flatland
Commits
fc7eb592
Commit
fc7eb592
authored
5 years ago
by
Egli Adrian (IT-SCI-API-PFI)
Browse files
Options
Downloads
Patches
Plain Diff
Update editor
parent
1154e8da
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
flatland/utils/editor.py
+2
-2
2 additions, 2 deletions
flatland/utils/editor.py
notebooks/Scene_Editor.ipynb
+5
-33
5 additions, 33 deletions
notebooks/Scene_Editor.ipynb
with
7 additions
and
35 deletions
flatland/utils/editor.py
+
2
−
2
View file @
fc7eb592
...
@@ -96,7 +96,7 @@ class View(object):
...
@@ -96,7 +96,7 @@ class View(object):
self
.
wRegenNAgents
=
IntSlider
(
value
=
1
,
min
=
0
,
max
=
5
,
step
=
1
,
description
=
"
# Agents
"
,
self
.
wRegenNAgents
=
IntSlider
(
value
=
1
,
min
=
0
,
max
=
5
,
step
=
1
,
description
=
"
# Agents
"
,
tip
=
"
Click regenerate or reset after changing this
"
)
tip
=
"
Click regenerate or reset after changing this
"
)
self
.
wRegenMethod
=
RadioButtons
(
description
=
"
Regen
\n
Method
"
,
options
=
[
"
Empty
"
,
"
Random Cell
"
,
"
Path-based
"
])
self
.
wRegenMethod
=
RadioButtons
(
description
=
"
Regen
\n
Method
"
,
options
=
[
"
Empty
"
,
"
Random Cell
"
])
#
, "Path-based"])
self
.
wReplaceAgents
=
Checkbox
(
value
=
True
,
description
=
"
Replace Agents
"
)
self
.
wReplaceAgents
=
Checkbox
(
value
=
True
,
description
=
"
Replace Agents
"
)
self
.
wTab
=
Tab
()
self
.
wTab
=
Tab
()
...
@@ -104,7 +104,7 @@ class View(object):
...
@@ -104,7 +104,7 @@ class View(object):
for
i
,
title
in
enumerate
(
tab_contents
):
for
i
,
title
in
enumerate
(
tab_contents
):
self
.
wTab
.
set_title
(
i
,
title
)
self
.
wTab
.
set_title
(
i
,
title
)
self
.
wTab
.
children
=
[
self
.
wTab
.
children
=
[
VBox
([
self
.
wRegenSizeWidth
,
self
.
wRegenSizeHeight
,
self
.
wRegenNAgents
])
VBox
([
self
.
wRegenSizeWidth
,
self
.
wRegenSizeHeight
,
self
.
wRegenNAgents
,
self
.
wRegenMethod
])
]
]
# abbreviated description of buttons and the methods they call
# abbreviated description of buttons and the methods they call
...
...
This diff is collapsed.
Click to expand it.
notebooks/Scene_Editor.ipynb
+
5
−
33
View file @
fc7eb592
...
@@ -9,22 +9,9 @@
...
@@ -9,22 +9,9 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
1
,
"execution_count":
null
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [],
{
"data": {
"text/html": [
"<style>.container { width:95% !important; }</style>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"source": [
"from IPython.core.display import display, HTML\n",
"from IPython.core.display import display, HTML\n",
"display(HTML(\"<style>.container { width:95% !important; }</style>\"))"
"display(HTML(\"<style>.container { width:95% !important; }</style>\"))"
...
@@ -32,7 +19,7 @@
...
@@ -32,7 +19,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
2
,
"execution_count":
null
,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
...
@@ -62,26 +49,11 @@
...
@@ -62,26 +49,11 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
3
,
"execution_count":
null
,
"metadata": {
"metadata": {
"scrolled": false
"scrolled": false
},
},
"outputs": [
"outputs": [],
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a1b27bcebefc4ddebb5bde8297d52d9e",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(Canvas(), VBox(children=(Text(value='temp.pkl', description='Filename'), Button(description='Re…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"source": [
"mvc.view.display()"
"mvc.view.display()"
]
]
...
...
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
# Railway Scene Editor
# Railway Scene Editor
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
from
IPython.core.display
import
display
,
HTML
from
IPython.core.display
import
display
,
HTML
display
(
HTML
(
"
<style>.container { width:95% !important; }</style>
"
))
display
(
HTML
(
"
<style>.container { width:95% !important; }</style>
"
))
```
```
%% Output
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
from
flatland.utils.editor
import
EditorMVC
from
flatland.utils.editor
import
EditorMVC
mvc
=
EditorMVC
(
sGL
=
"
PILSVG
"
)
mvc
=
EditorMVC
(
sGL
=
"
PILSVG
"
)
```
```
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## Instructions
## Instructions
-
Drag to draw (improved dead-ends)
-
Drag to draw (improved dead-ends)
-
ctrl-click to add agent or select agent
-
ctrl-click to add agent or select agent
-
if agent is selected:
-
if agent is selected:
-
ctrl-click to move agent position
-
ctrl-click to move agent position
-
use rotate agent to rotate 90°
-
use rotate agent to rotate 90°
-
ctrl-shift-click to set target for selected agent
-
ctrl-shift-click to set target for selected agent
-
target can be moved by repeating
-
target can be moved by repeating
-
to Resize the env (cannot preserve work):
-
to Resize the env (cannot preserve work):
-
select "Regen" tab, set regen size slider, click regenerate.
-
select "Regen" tab, set regen size slider, click regenerate.
-
alt-click remove all rails from cell
-
alt-click remove all rails from cell
Demo Scene: complex_scene.pkl
Demo Scene: complex_scene.pkl
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
mvc
.
view
.
display
()
mvc
.
view
.
display
()
```
```
%% Output
...
...
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