From 8fefaeefc61d9387f441bb747997231fdd72dad6 Mon Sep 17 00:00:00 2001 From: hagrid67 <jdhwatson@gmail.com> Date: Mon, 27 May 2019 18:02:09 +0100 Subject: [PATCH] fixing merge and lint errors --- examples/demo.py | 2 -- flatland/envs/agent_utils.py | 1 + flatland/envs/rail_env.py | 4 ++-- flatland/utils/editor.py | 8 +++----- flatland/utils/render_qt.py | 22 ---------------------- flatland/utils/rendertools.py | 3 +-- 6 files changed, 7 insertions(+), 33 deletions(-) diff --git a/examples/demo.py b/examples/demo.py index be2654c..6a454a4 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 52cdb10..db7f9ae 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 3fa4a9c..89feaab 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 021a708..7c9e068 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 a41f5a2..233f07b 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 b34467b..03c1c63 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: -- GitLab