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
965a7e47
Commit
965a7e47
authored
5 years ago
by
Egli Adrian (IT-SCI-API-PFI)
Browse files
Options
Downloads
Patches
Plain Diff
clean up
parent
e7d921e6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
flatland/utils/graphics_pil.py
+4
-8
4 additions, 8 deletions
flatland/utils/graphics_pil.py
with
4 additions
and
8 deletions
flatland/utils/graphics_pil.py
+
4
−
8
View file @
965a7e47
...
@@ -19,16 +19,15 @@ def enable_windows_cairo_support():
...
@@ -19,16 +19,15 @@ def enable_windows_cairo_support():
os
.
environ
[
'
PATH
'
]
=
os
.
environ
[
'
PATH
'
]
+
'
;
'
+
default_os_path
os
.
environ
[
'
PATH
'
]
=
os
.
environ
[
'
PATH
'
]
+
'
;
'
+
default_os_path
if
ctypes
.
util
.
find_library
(
'
cairo
'
)
is
not
None
:
if
ctypes
.
util
.
find_library
(
'
cairo
'
)
is
not
None
:
print
(
"
cairo installed: OK
"
)
print
(
"
cairo installed: OK
"
)
enable_windows_cairo_support
()
enable_windows_cairo_support
()
from
cairosvg
import
svg2png
from
cairosvg
import
svg2png
from
screeninfo
import
get_monitors
from
IPython.display
import
SVG
from
flatland.core.transitions
import
RailEnvTransitions
# from copy import copy
# from copy import copy
from
flatland.core.transitions
import
RailEnvTransitions
from
screeninfo
import
get_monitors
class
PILGL
(
GraphicsLayer
):
class
PILGL
(
GraphicsLayer
):
def
__init__
(
self
,
width
,
height
,
nPixCell
=
60
):
def
__init__
(
self
,
width
,
height
,
nPixCell
=
60
):
...
@@ -252,9 +251,6 @@ class PILSVG(PILGL):
...
@@ -252,9 +251,6 @@ class PILSVG(PILGL):
def
pilFromSvgFile
(
self
,
sfPath
):
def
pilFromSvgFile
(
self
,
sfPath
):
with
open
(
sfPath
,
"
r
"
)
as
fIn
:
with
open
(
sfPath
,
"
r
"
)
as
fIn
:
bytesPNG
=
svg2png
(
file_obj
=
fIn
,
output_height
=
self
.
nPixCell
,
output_width
=
self
.
nPixCell
)
bytesPNG
=
svg2png
(
file_obj
=
fIn
,
output_height
=
self
.
nPixCell
,
output_width
=
self
.
nPixCell
)
image
=
SVG
(
url
=
sfPath
)
with
io
.
BytesIO
(
bytesPNG
)
as
fIn
:
with
io
.
BytesIO
(
bytesPNG
)
as
fIn
:
pil_img
=
Image
.
open
(
fIn
)
pil_img
=
Image
.
open
(
fIn
)
pil_img
.
load
()
pil_img
.
load
()
...
...
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