diff --git a/examples/demo.py b/examples/demo.py index be2654c5b53710991263d78f7d546671eb022de0..6a454a4202afbfa234b4b27551bfad834afa0239 100644 --- a/examples/demo.py +++ b/examples/demo.py @@ -154,7 +154,6 @@ class Demo: if iAgent == 4: action = 0 - if False: agent = self.env.agents[iAgent] trial = 0 @@ -165,7 +164,6 @@ class Demo: break action_dict.update({iAgent: action}) - self.renderer.renderEnv(show=True, action_dict=action_dict) # Environment step diff --git a/flatland/envs/agent_utils.py b/flatland/envs/agent_utils.py index 52cdb1029d59c9e47188cfe29208903b5e8eeac8..db7f9ae05483f4b4879e24f93716a384690f6432 100644 --- a/flatland/envs/agent_utils.py +++ b/flatland/envs/agent_utils.py @@ -4,6 +4,7 @@ from itertools import starmap import numpy as np # from flatland.envs.rail_env import RailEnv + @attrs class EnvDescription(object): """ EnvDescription - This is a description of a random env, diff --git a/flatland/envs/rail_env.py b/flatland/envs/rail_env.py index 3fa4a9cdc6c014995bc56ef07e021fc689df69a6..89feaab01e6512226d2037185850c211e2d9c274 100644 --- a/flatland/envs/rail_env.py +++ b/flatland/envs/rail_env.py @@ -4,8 +4,8 @@ Definition of the RailEnv environment and related level-generation functions. Generator functions are functions that take width, height and num_resets as arguments and return a GridTransitionMap object. """ -### TODO _ this is a global method --> utils or remove later -from inspect import currentframe +# TODO: _ this is a global method --> utils or remove later +# from inspect import currentframe import msgpack import numpy as np diff --git a/flatland/utils/editor.py b/flatland/utils/editor.py index 021a708e34c919dc8c2ee85991e1e351022da8f6..7c9e0687b15f6d599ad8338906b082fc9bac7a8c 100644 --- a/flatland/utils/editor.py +++ b/flatland/utils/editor.py @@ -240,7 +240,7 @@ class Controller(object): def on_click(self, wid, event): x = event['canvasX'] y = event['canvasY'] - self.debug("debug:", x,y) + self.debug("debug:", x, y) rcCell = self.view.xy_to_rc(x, y) @@ -320,7 +320,6 @@ class Controller(object): # lrcStroke.append(rcCell) self.view.redisplayImage() - else: self.model.mod_path(not event["shiftKey"]) @@ -621,10 +620,9 @@ class EditorModel(object): self.redraw() - - def clearCell(self,rcCell): + def clearCell(self, rcCell): self.debug_cell(rcCell) - self.env.rail.grid[rcCell[0],rcCell[1]] = 0 + self.env.rail.grid[rcCell[0], rcCell[1]] = 0 self.redraw() def reset(self, replace_agents=False, nAgents=0): diff --git a/flatland/utils/render_qt.py b/flatland/utils/render_qt.py index a41f5a26ca31c70ff8f7759ad7c45043bcd2c2d3..233f07bca474204ea31aec5d75b530911071bfad 100644 --- a/flatland/utils/render_qt.py +++ b/flatland/utils/render_qt.py @@ -135,28 +135,6 @@ class QTSVG(GraphicsLayer): self.agents_prev = [] # svgWidget = None -<<<<<<< HEAD - - # iArt = 0 - # iCol = 0 - # iRow = 0 - # nCols = 10 - - # if False: - # for binTrans in self.track.dSvg.keys(): - # sSVG = self.track.dSvg[binTrans].to_string() - # self.layout.addWidget(create_QtSvgWidget_from_svg_string(sSVG), iRow, iCol) - # - # iArt += 1 - # iRow = int(iArt / nCols) - # iCol = iArt % nCols - # - # svgWidget2 = QtSvg.QSvgWidget() - # svgWidget2.renderer().load(bySVG) - # - # self.layout.addWidget(svgWidget2, 0, 0) -======= ->>>>>>> 38-jw-SBB-graphics def is_raster(self): return False diff --git a/flatland/utils/rendertools.py b/flatland/utils/rendertools.py index b34467bfd4365a93063163eef8bec2d9612fa5ad..03c1c63dfc60b4fe1a867d0cfb83d54fe9dbf30e 100644 --- a/flatland/utils/rendertools.py +++ b/flatland/utils/rendertools.py @@ -782,10 +782,9 @@ class RenderTool(object): # pass print("invalid action - agent ", iAgent, " bend ", agent.direction, new_direction) self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction) - else: - self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction, color=oColor) else: print("invalid action - agent ", iAgent, " bend ", agent.direction, new_direction) + self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction, color=oColor) # self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction) if show: