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
pranjal_dhole
Flatland
Commits
9aa13034
Commit
9aa13034
authored
5 years ago
by
Egli Adrian (IT-SCI-API-PFI)
Browse files
Options
Downloads
Patches
Plain Diff
editor bug fix
parent
314e17c7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
flatland/utils/editor.py
+1
-1
1 addition, 1 deletion
flatland/utils/editor.py
notebooks/Editor2.ipynb
+18
-4
18 additions, 4 deletions
notebooks/Editor2.ipynb
with
19 additions
and
5 deletions
flatland/utils/editor.py
+
1
−
1
View file @
9aa13034
...
...
@@ -160,7 +160,7 @@ class View(object):
*
self
.
lwButtons
,
# self.wRegenSize,
# self.wRegenNAgents,
self
.
wProg_steps
,
#
self.wProg_steps,
self
.
wTab
])
self
.
wMain
=
HBox
([
self
.
wImage
,
self
.
wVbox_controls
])
...
...
This diff is collapsed.
Click to expand it.
notebooks/Editor2.ipynb
+
18
−
4
View file @
9aa13034
...
...
@@ -78,7 +78,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"<flatland.utils.graphics_pil.PILSVG object at 0x0000022
E68851F9
8> <class 'flatland.utils.graphics_pil.PILSVG'>\n",
"<flatland.utils.graphics_pil.PILSVG object at 0x0000022
8826E504
8> <class 'flatland.utils.graphics_pil.PILSVG'>\n",
"<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>\n",
"Clear rails\n"
]
...
...
@@ -123,7 +123,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "
3919c0bba981455285a93e045e305a05
",
"model_id": "
a70b4e1bbe8a41cc85af8e0073862bf3
",
"version_major": 2,
"version_minor": 0
},
...
...
@@ -138,7 +138,21 @@
"name": "stdout",
"output_type": "stream",
"text": [
"<flatland.utils.graphics_pil.PILSVG object at 0x0000022E6919E630> <class 'flatland.utils.graphics_pil.PILSVG'>\n",
"<flatland.utils.graphics_pil.PILSVG object at 0x0000022882FA48D0> <class 'flatland.utils.graphics_pil.PILSVG'>\n",
"<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>\n",
"<flatland.utils.graphics_pil.PILSVG object at 0x000002288301CEB8> <class 'flatland.utils.graphics_pil.PILSVG'>\n",
"<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>\n",
"<flatland.utils.graphics_pil.PILSVG object at 0x000002288318CD30> <class 'flatland.utils.graphics_pil.PILSVG'>\n",
"<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>\n",
"<flatland.utils.graphics_pil.PILSVG object at 0x0000022883001D30> <class 'flatland.utils.graphics_pil.PILSVG'>\n",
"<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>\n",
"<flatland.utils.graphics_pil.PILSVG object at 0x0000022882FCC438> <class 'flatland.utils.graphics_pil.PILSVG'>\n",
"<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>\n",
"<flatland.utils.graphics_pil.PILSVG object at 0x0000022886C20668> <class 'flatland.utils.graphics_pil.PILSVG'>\n",
"<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>\n",
"complex_rail_generator: num_agents > nr_start_goal, changing num_agents\n",
"complex_rail_generator: num_agents > nr_start_goal, changing num_agents\n",
"<flatland.utils.graphics_pil.PILSVG object at 0x0000022882DF7518> <class 'flatland.utils.graphics_pil.PILSVG'>\n",
"<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>\n"
]
}
...
...
@@ -157,7 +171,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "
b91a94da22c846808020ab2aa1bc5ba7
",
"model_id": "
8fb6b8a5c8374de29ab80c6b62cd8fd9
",
"version_major": 2,
"version_minor": 0
},
...
...
%% Cell type:markdown id: tags:
# Rail Editor v0.2
%% Cell type:code id: tags:
```
python
%
load_ext
autoreload
%
autoreload
2
```
%% Cell type:code id: tags:
```
python
import
numpy
as
np
from
numpy
import
array
import
ipywidgets
import
IPython
from
IPython.core.display
import
display
,
HTML
```
%% Cell type:code id: tags:
```
python
display
(
HTML
(
"
<style>.container { width:95% !important; }</style>
"
))
```
%% Output
%% Cell type:code id: tags:
```
python
from
flatland.utils.editor
import
EditorMVC
,
EditorModel
,
View
,
Controller
```
%% Output
cairo installed: OK
%% Cell type:code id: tags:
```
python
mvc
=
EditorMVC
(
sGL
=
"
PILSVG
"
)
# sGL="PIL")
```
%% Output
<flatland.utils.graphics_pil.PILSVG object at 0x0000022
E68851F9
8> <class 'flatland.utils.graphics_pil.PILSVG'>
<flatland.utils.graphics_pil.PILSVG object at 0x0000022
8826E504
8> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
Clear rails
%% Cell type:markdown id: tags:
## Instructions
-
Drag to draw (improved dead-ends)
-
Shift-Drag to erase rails (erasing dead ends not yet automated - drag right across them)
-
ctrl-click to add agent
-
direction chosen randomly to fit rail
-
ctrl-shift-click to add target for last agent
-
target can be moved by repeating
-
to Resize the env (cannot preserve work):
-
select "Regen" tab, set regen size slider, click regenerate.
-
alt-click remove all rails from cell
%% Cell type:code id: tags:
```
python
mvc
.
view
.
display
()
```
%% Output
<flatland.utils.graphics_pil.PILSVG object at 0x0000022E6919E630> <class 'flatland.utils.graphics_pil.PILSVG'>
<flatland.utils.graphics_pil.PILSVG object at 0x0000022882FA48D0> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
<flatland.utils.graphics_pil.PILSVG object at 0x000002288301CEB8> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
<flatland.utils.graphics_pil.PILSVG object at 0x000002288318CD30> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
<flatland.utils.graphics_pil.PILSVG object at 0x0000022883001D30> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
<flatland.utils.graphics_pil.PILSVG object at 0x0000022882FCC438> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
<flatland.utils.graphics_pil.PILSVG object at 0x0000022886C20668> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
complex_rail_generator: num_agents > nr_start_goal, changing num_agents
complex_rail_generator: num_agents > nr_start_goal, changing num_agents
<flatland.utils.graphics_pil.PILSVG object at 0x0000022882DF7518> <class 'flatland.utils.graphics_pil.PILSVG'>
<super: <class 'PILSVG'>, <PILSVG object>> <class 'super'>
%% Cell type:code id: tags:
```
python
mvc
.
view
.
wOutput
.
clear_output
()
mvc
.
view
.
wOutput
```
%% Output
%% Cell type:code id: tags:
```
python
len
(
mvc
.
editor
.
env
.
agents
),
len
(
mvc
.
editor
.
env
.
agents_static
)
```
%% Output
(0, 0)
...
...
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