diff --git a/docs/conf.py b/docs/conf.py index f63d090bf3a9ecf7370bcf2fa5edc37afb019b79..8223e1c7238176cccaaa116c0776bf80438750c7 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -76,10 +76,10 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' -# If true, `todo` and `todoList` produce output, else they produce nothing. +# If true, `todo` and `todoList` produce output_generator, else they produce nothing. todo_include_todos = False -# -- Options for HTML output ------------------------------------------- +# -- Options for HTML output_generator ------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. @@ -97,12 +97,12 @@ html_theme = "sphinx_rtd_theme" # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] -# -- Options for HTMLHelp output --------------------------------------- +# -- Options for HTMLHelp output_generator --------------------------------------- # Output file base name for HTML help builder. htmlhelp_basename = 'flatlanddoc' -# -- Options for LaTeX output ------------------------------------------ +# -- Options for LaTeX output_generator ------------------------------------------ latex_elements = { # The paper size ('letterpaper' or 'a4paper'). @@ -131,7 +131,7 @@ latex_documents = [ u'S.P. Mohanty', 'manual'), ] -# -- Options for manual page output ------------------------------------ +# -- Options for manual page output_generator ------------------------------------ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). @@ -141,7 +141,7 @@ man_pages = [ [author], 1) ] -# -- Options for Texinfo output ---------------------------------------- +# -- Options for Texinfo output_generator ---------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, diff --git a/flatland/utils/editor.py b/flatland/utils/editor.py index b3bae7ebca6af5e2de9fde89b0afc146e774ed26..d0af20269ca27f2a2f4f3ed62d3ac4f56c4c3de9 100644 --- a/flatland/utils/editor.py +++ b/flatland/utils/editor.py @@ -48,13 +48,13 @@ class View(object): self.sGL = sGL def display(self): - self.output.clear_output() + self.output_generator.clear_output() return self.wMain def init_canvas(self): # update the rendertool with the env self.new_env() - self.oRT.render_env(spacing=False, arrows=False, sRailColor="gray", show=False) + self.oRT.render_env(spacing=False, arrows=False, rail_color="gray", show=False) img = self.oRT.get_image() self.wImage = jpy_canvas.Canvas(img) self.yxSize = self.wImage.data.shape[:2] @@ -75,7 +75,7 @@ class View(object): self.debug_move.observe(self.controller.set_debug_move, names="value") # This is like a cell widget where loggin goes - self.output = Output() + self.output_generator = Output() # Filename textbox self.filename = Text(description="Filename") @@ -145,9 +145,10 @@ class View(object): self.oRT = rt.RenderTool(self.editor.env, gl=self.sGL) def redraw(self): - with self.output: + print("redrawing outside") + print(self.output_generator) + with self.output_generator: self.oRT.set_new_rail() - self.model.env.agents = self.model.env.agents_static for a in self.model.env.agents: if hasattr(a, 'old_position') is False: @@ -155,7 +156,7 @@ class View(object): if hasattr(a, 'old_direction') is False: a.old_direction = a.direction - self.oRT.render_env(spacing=False, arrows=False, sRailColor="gray", agents=True, + self.oRT.render_env(rail_color="gray", agents=True, show=False, selected_agent=self.model.selected_agent, show_observations=False) img = self.oRT.get_image() @@ -186,8 +187,8 @@ class View(object): return rcCell def log(self, *args, **kwargs): - if self.output: - with self.output: + if self.output_generator: + with self.output_generator: print(*args, **kwargs) else: print(*args, **kwargs) @@ -521,6 +522,7 @@ class EditorModel(object): eg rcCells [(3,4), (2,4), (2,5)] would result in the transitions N->E and W->S in cell (2,4). """ + rc3Cells = array(lrcStroke[:3]) # the 3 cells rcMiddle = rc3Cells[1] # the middle cell which we will update bDeadend = np.all(lrcStroke[0] == lrcStroke[2]) # deadend means cell 0 == cell 2 diff --git a/flatland/utils/graphics_pil.py b/flatland/utils/graphics_pil.py index 21b272e100692fab1090cd0ea488c852f24ffdc4..a6835902ae3451848b064ea72cfee21efe3c1c33 100644 --- a/flatland/utils/graphics_pil.py +++ b/flatland/utils/graphics_pil.py @@ -221,7 +221,7 @@ class PILGL(GraphicsLayer): def save_image(self, filename): """ Renders the current scene into a image file - :param filename: filename where to store the rendering output (supported image format *.bmp , .. , *.png) + :param filename: filename where to store the rendering output_generator (supported image format *.bmp , .. , *.png) """ img = self.alpha_composite_layers() img.save(filename) diff --git a/flatland/utils/rendertools.py b/flatland/utils/rendertools.py index a15f7d9f6f4d55a123051f9524051adeb8ccc00e..f3039e2db7d4d5e65da017ccf58339e30b37006d 100644 --- a/flatland/utils/rendertools.py +++ b/flatland/utils/rendertools.py @@ -389,11 +389,11 @@ class RenderTool(object): agents=True, # whether to include agents show_observations=True, # whether to include observations show_predictions=True, # whether to include predictions - sRailColor="gray", # color to use in drawing rails (not used with SVG) + rail_color="gray", # color to use in drawing rails (not used with SVG) frames=False, # frame counter to show (intended since invocation) episode=None, # int episode number to show step=None, # int step number to show in image - iSelectedAgent=None, # indicate which agent is "selected" in the editor + selected_agent=None, # indicate which agent is "selected" in the editor action_dict=None): # defunct - was used to indicate agent intention to turn """ Draw the environment using the GraphicsLayer this RenderTool was created with. (Use show=False from a Jupyter notebook with %matplotlib inline) @@ -403,9 +403,9 @@ class RenderTool(object): self.render_env_2(show=show, curves=curves, spacing=spacing, arrows=arrows, agents=agents, show_observations=show_observations, show_predictions=show_predictions, - rail_color=sRailColor, + rail_color=rail_color, frames=frames, episode=episode, step=step, - selected_agent=iSelectedAgent, action_dict=action_dict) + selected_agent=selected_agent, action_dict=action_dict) return if type(self.gl) is PILGL: @@ -417,7 +417,7 @@ class RenderTool(object): # Draw each agent + its orientation + its target if agents: - self.plot_agents(targets=True, selected_agent=iSelectedAgent) + self.plot_agents(targets=True, selected_agent=selected_agent) if show_observations: self.render_observation(range(env.get_num_agents()), env.dev_obs_dict) if show_predictions: diff --git a/notebooks/Scene_Editor.ipynb b/notebooks/Scene_Editor.ipynb index 963a4610205aac030aa994afc26d9e1efc19dba1..ae179c7d76f9080470536aeb8e83dfb0f728d8bf 100644 --- a/notebooks/Scene_Editor.ipynb +++ b/notebooks/Scene_Editor.ipynb @@ -70,7 +70,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "911371ed51fd4a768b837128b3f96d06", + "model_id": "7718da709cad43d980540e69cdabc918", "version_major": 2, "version_minor": 0 },