From bef8174e1229e8e40d8ecd4ae9d532a68541dbdd Mon Sep 17 00:00:00 2001
From: u214892 <u214892@sbb.ch>
Date: Tue, 18 Jun 2019 14:43:53 +0200
Subject: [PATCH] #69 enhanced output

---
 flatland/utils/graphics_pil.py | 14 +++++++-------
 tox.ini                        |  2 ++
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/flatland/utils/graphics_pil.py b/flatland/utils/graphics_pil.py
index 23f8b87..f3a27c5 100644
--- a/flatland/utils/graphics_pil.py
+++ b/flatland/utils/graphics_pil.py
@@ -358,17 +358,17 @@ class PILSVG(PILGL):
             "NN SS": "Bahnhof_#d50000_Gleis_vertikal.svg"}
 
         # Dict of rail cell images indexed by binary transitions
-        self.dPilRail = self.loadSVGs(dRailFiles, rotate=True, backgroundImage="Background_rail.svg",
+        dPilRailFiles = self.loadSVGs(dRailFiles, rotate=True, backgroundImage="Background_rail.svg",
                                       whitefilter="Background_white_filter.svg")
 
         # Load the target files (which have rails and transitions of their own)
         # They are indexed by (binTrans, iAgent), ie a tuple of the binary transition and the agent index
-        dPilRail2 = self.loadSVGs(dTargetFiles, rotate=False, agent_colors=self.ltAgentColors,
-                                  backgroundImage="Background_rail.svg",
-                                  whitefilter="Background_white_filter.svg")
+        dPilTargetFiles = self.loadSVGs(dTargetFiles, rotate=False, agent_colors=self.ltAgentColors,
+                                        backgroundImage="Background_rail.svg",
+                                        whitefilter="Background_white_filter.svg")
         # Merge them with the regular rails.
         # https://stackoverflow.com/questions/38987/how-to-merge-two-dictionaries-in-a-single-expression
-        self.dPilRail = {**self.dPilRail, **dPilRail2}
+        self.dPilRail = {**dPilRailFiles, **dPilTargetFiles}
 
     def loadSVGs(self, dDirFile, rotate=False, agent_colors=False, backgroundImage=None, whitefilter=None):
         dPil = {}
@@ -445,13 +445,13 @@ class PILSVG(PILGL):
 
                 self.drawImageRC(pilTrack, (row, col))
             else:
-                print("Illegal rail:", row, col, format(binTrans, "#018b")[2:])
+                print("Illegal rail:", row, col, format(binTrans, "#018b")[2:], binTrans)
         else:
             if (binTrans, iTarget) in self.dPilRail:
                 pilTrack = self.dPilRail[(binTrans, iTarget)]
                 self.drawImageRC(pilTrack, (row, col))
             else:
-                print("Illegal target rail:", row, col, format(binTrans, "#018b")[2:])
+                print("Illegal target rail:", row, col, format(binTrans, "#018b")[2:], (binTrans, iTarget))
 
             if isSelected:
                 svgBG = self.pilFromSvgFile("svg", "Selected_Target.svg")
diff --git a/tox.ini b/tox.ini
index 43a02f3..61f8b0a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -98,7 +98,9 @@ deps =
 commands =
 ; run tests from subfolder to ensure that resources are accessed via resources and not via relative paths
     sh -c 'mkdir -p {envtmpdir}/6f59bc68108c3895b1828abdd04b9a06'
+    sh -c 'jupyter nbextension install --py --sys-prefix widgetsnbextension'
     sh -c 'jupyter nbextension enable --py --sys-prefix widgetsnbextension'
+    sh -c 'jupyter nbextension install --py --sys-prefix jpy_canvas'
     sh -c 'jupyter nbextension enable --py --sys-prefix jpy_canvas'
 ; https://stackoverflow.com/questions/35545402/how-to-run-an-ipynb-jupyter-notebook-from-terminal/35545463
     sh -c 'ls notebooks/*.ipynb  | xargs -n 1 jupyter nbconvert --to python'
-- 
GitLab