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
3b901d97
Commit
3b901d97
authored
May 27, 2012
by
Gary Hodgson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added bitmap support for gif,tiff,jpg,jpeg,bmp,png
parent
0d009ac5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
projectlayer.py
projectlayer.py
+6
-5
No files found.
projectlayer.py
View file @
3b901d97
...
...
@@ -20,7 +20,7 @@ import zipfile
import
tempfile
import
shutil
import
svg.document
as
wxpsvgdocument
import
imghdr
class
dispframe
(
wx
.
Frame
):
def
__init__
(
self
,
parent
,
title
,
res
=
(
800
,
600
),
printer
=
None
):
...
...
@@ -62,7 +62,7 @@ class dispframe(wx.Frame):
gc
.
Translate
(
*
self
.
offset
)
gc
.
Scale
(
self
.
scale
,
self
.
scale
)
wxpsvgdocument
.
SVGDocument
(
image
)
.
render
(
gc
)
elif
self
.
slicer
==
'b
m
p'
:
elif
self
.
slicer
==
'b
itma
p'
:
dc
.
DrawBitmap
(
image
,
self
.
offset
[
0
],
-
self
.
offset
[
1
],
True
)
else
:
raise
Exception
(
self
.
slicer
+
" is an unknown method."
)
...
...
@@ -108,7 +108,7 @@ class dispframe(wx.Frame):
self
.
scale
=
scale
self
.
thickness
=
thickness
self
.
index
=
0
self
.
size
=
(
size
[
0
]
+
offset
[
0
],
size
[
1
]
+
offset
[
1
])
self
.
size
=
(
size
[
0
]
+
offset
[
0
],
size
[
1
]
+
offset
[
1
])
self
.
interval
=
interval
self
.
offset
=
offset
self
.
timer
=
wx
.
Timer
(
self
,
1
)
...
...
@@ -202,15 +202,16 @@ class setframe(wx.Frame):
def
parse3DLPzip
(
self
,
name
):
if
not
zipfile
.
is_zipfile
(
name
):
raise
Exception
(
name
+
" is not a zip file!"
)
acceptedImageTypes
=
[
'gif'
,
'tiff'
,
'jpg'
,
'jpeg'
,
'bmp'
,
'png'
]
zipFile
=
zipfile
.
ZipFile
(
name
,
'r'
)
self
.
image_dir
=
tempfile
.
mkdtemp
()
zipFile
.
extractall
(
self
.
image_dir
)
ol
=
[]
for
f
in
os
.
listdir
(
self
.
image_dir
):
path
=
os
.
path
.
join
(
self
.
image_dir
,
f
)
if
os
.
path
.
isfile
(
path
)
and
path
.
endswith
(
".bmp"
)
:
if
os
.
path
.
isfile
(
path
)
and
imghdr
.
what
(
path
)
in
acceptedImageTypes
:
ol
.
append
(
wx
.
Bitmap
(
path
))
return
ol
,
-
1
,
"b
m
p"
return
ol
,
-
1
,
"b
itma
p"
def
loadfile
(
self
,
event
):
dlg
=
wx
.
FileDialog
(
self
,
(
"Open file to print"
),
style
=
wx
.
FD_OPEN
|
wx
.
FD_FILE_MUST_EXIST
)
...
...
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