Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
f6b3636e
Commit
f6b3636e
authored
Aug 06, 2012
by
Gary Hodgson
Committed by
Guillaume Seguin
May 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make copy of svg element before scaling, otherwise subsequent calls are scaled again.
parent
2c793281
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
projectlayer.py
projectlayer.py
+16
-11
No files found.
projectlayer.py
View file @
f6b3636e
...
@@ -24,6 +24,7 @@ import shutil
...
@@ -24,6 +24,7 @@ import shutil
from
cairosvg.surface
import
PNGSurface
from
cairosvg.surface
import
PNGSurface
import
cStringIO
import
cStringIO
import
imghdr
import
imghdr
import
copy
class
DisplayFrame
(
wx
.
Frame
):
class
DisplayFrame
(
wx
.
Frame
):
def
__init__
(
self
,
parent
,
title
,
res
=
(
1024
,
768
),
printer
=
None
,
scale
=
1.0
,
offset
=
(
0
,
0
)):
def
__init__
(
self
,
parent
,
title
,
res
=
(
1024
,
768
),
printer
=
None
,
scale
=
1.0
,
offset
=
(
0
,
0
)):
...
@@ -91,19 +92,23 @@ class DisplayFrame(wx.Frame):
...
@@ -91,19 +92,23 @@ class DisplayFrame(wx.Frame):
elif
self
.
slicer
==
'Slic3r'
:
elif
self
.
slicer
==
'Slic3r'
:
if
int
(
self
.
scale
)
!=
1
:
if
int
(
self
.
scale
)
!=
1
:
height
=
float
(
image
.
get
(
'height'
)
.
replace
(
'm'
,
''
))
layercopy
=
copy
.
deepcopy
(
image
)
width
=
float
(
image
.
get
(
'width'
)
.
replace
(
'm'
,
''
))
height
=
float
(
layercopy
.
get
(
'height'
)
.
replace
(
'm'
,
''
))
width
=
float
(
layercopy
.
get
(
'width'
)
.
replace
(
'm'
,
''
))
image
.
set
(
'height'
,
str
(
height
*
self
.
scale
)
+
'mm'
)
layercopy
.
set
(
'height'
,
str
(
height
*
self
.
scale
)
+
'mm'
)
image
.
set
(
'width'
,
str
(
width
*
self
.
scale
)
+
'mm'
)
layercopy
.
set
(
'width'
,
str
(
width
*
self
.
scale
)
+
'mm'
)
image
.
set
(
'viewBox'
,
'0 0 '
+
str
(
height
*
self
.
scale
)
+
' '
+
str
(
width
*
self
.
scale
))
layercopy
.
set
(
'viewBox'
,
'0 0 '
+
str
(
height
*
self
.
scale
)
+
' '
+
str
(
width
*
self
.
scale
))
g
=
image
.
find
(
"{http://www.w3.org/2000/svg}g"
)
g
=
layercopy
.
find
(
"{http://www.w3.org/2000/svg}g"
)
g
.
set
(
'transform'
,
'scale('
+
str
(
self
.
scale
)
+
')'
)
g
.
set
(
'transform'
,
'scale('
+
str
(
self
.
scale
)
+
')'
)
stream
=
cStringIO
.
StringIO
(
PNGSurface
.
convert
(
dpi
=
self
.
dpi
,
bytestring
=
xml
.
etree
.
ElementTree
.
tostring
(
layercopy
)))
stream
=
cStringIO
.
StringIO
(
PNGSurface
.
convert
(
dpi
=
self
.
dpi
,
bytestring
=
xml
.
etree
.
ElementTree
.
tostring
(
image
)))
image
=
wx
.
ImageFromStream
(
stream
)
image
=
wx
.
ImageFromStream
(
stream
)
dc
.
DrawBitmap
(
wx
.
BitmapFromImage
(
image
),
self
.
offset
[
0
],
self
.
offset
[
1
],
True
)
dc
.
DrawBitmap
(
wx
.
BitmapFromImage
(
image
),
self
.
offset
[
0
],
self
.
offset
[
1
],
True
)
else
:
stream
=
cStringIO
.
StringIO
(
PNGSurface
.
convert
(
dpi
=
self
.
dpi
,
bytestring
=
xml
.
etree
.
ElementTree
.
tostring
(
image
)))
image
=
wx
.
ImageFromStream
(
stream
)
dc
.
DrawBitmap
(
wx
.
BitmapFromImage
(
image
),
self
.
offset
[
0
],
self
.
offset
[
1
],
True
)
elif
self
.
slicer
==
'bitmap'
:
elif
self
.
slicer
==
'bitmap'
:
if
isinstance
(
image
,
str
):
if
isinstance
(
image
,
str
):
image
=
wx
.
Image
(
image
)
image
=
wx
.
Image
(
image
)
...
@@ -568,7 +573,7 @@ class SettingsFrame(wx.Frame):
...
@@ -568,7 +573,7 @@ class SettingsFrame(wx.Frame):
self
.
display_frame
.
slicer
=
self
.
layers
[
2
]
self
.
display_frame
.
slicer
=
self
.
layers
[
2
]
self
.
display_frame
.
dpi
=
self
.
get_dpi
()
self
.
display_frame
.
dpi
=
self
.
get_dpi
()
self
.
display_frame
.
draw_layer
(
self
.
layers
[
0
][
0
]
)
self
.
display_frame
.
draw_layer
(
copy
.
deepcopy
(
self
.
layers
[
0
][
0
])
)
self
.
calibrate
.
SetValue
(
False
)
self
.
calibrate
.
SetValue
(
False
)
self
.
bounding_box
.
SetValue
(
False
)
self
.
bounding_box
.
SetValue
(
False
)
if
self
.
show_first_layer_timer
!=
-
1.0
:
if
self
.
show_first_layer_timer
!=
-
1.0
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment