Improve display of photos after capture
parent
2288529133
commit
3c8093de25
|
@ -1,300 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
||||||
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
width="800"
|
|
||||||
height="480"
|
|
||||||
viewBox="0 0 211.66666 127"
|
|
||||||
version="1.1"
|
|
||||||
id="svg8"
|
|
||||||
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
|
|
||||||
sodipodi:docname="film.svg"
|
|
||||||
inkscape:export-filename="/home/gdott9/prog/photoboite/film.png"
|
|
||||||
inkscape:export-xdpi="96"
|
|
||||||
inkscape:export-ydpi="96">
|
|
||||||
<defs
|
|
||||||
id="defs2" />
|
|
||||||
<sodipodi:namedview
|
|
||||||
id="base"
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#666666"
|
|
||||||
borderopacity="1.0"
|
|
||||||
inkscape:pageopacity="0.0"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:zoom="0.7"
|
|
||||||
inkscape:cx="-27.035262"
|
|
||||||
inkscape:cy="235.80716"
|
|
||||||
inkscape:document-units="mm"
|
|
||||||
inkscape:current-layer="layer1"
|
|
||||||
showgrid="false"
|
|
||||||
units="px"
|
|
||||||
inkscape:window-width="1916"
|
|
||||||
inkscape:window-height="1041"
|
|
||||||
inkscape:window-x="1680"
|
|
||||||
inkscape:window-y="18"
|
|
||||||
inkscape:window-maximized="0"
|
|
||||||
showguides="true"
|
|
||||||
inkscape:guide-bbox="true" />
|
|
||||||
<metadata
|
|
||||||
id="metadata5">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
<dc:title />
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<g
|
|
||||||
inkscape:label="Layer 1"
|
|
||||||
inkscape:groupmode="layer"
|
|
||||||
id="layer1"
|
|
||||||
transform="translate(0,-169.99998)">
|
|
||||||
<path
|
|
||||||
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:46.70000076;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
d="M 0 0 L 0 480 L 800 480 L 800 0 L 0 0 z M 95.380859 34.939453 L 704.61914 34.939453 C 712.58576 34.939453 719 41.351744 719 49.318359 L 719 430.68164 C 719 438.64826 712.58576 445.06055 704.61914 445.06055 L 95.380859 445.06055 C 87.414244 445.06055 81 438.64826 81 430.68164 L 81 49.318359 C 81 41.351744 87.414244 34.939453 95.380859 34.939453 z "
|
|
||||||
transform="matrix(0.26458333,0,0,0.26458333,0,169.99998)"
|
|
||||||
id="rect815" />
|
|
||||||
<rect
|
|
||||||
ry="3.1763959"
|
|
||||||
y="68.898209"
|
|
||||||
x="21.609423"
|
|
||||||
height="107.36983"
|
|
||||||
width="168.80417"
|
|
||||||
id="rect825"
|
|
||||||
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:13.44665909;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
<g
|
|
||||||
id="g884"
|
|
||||||
transform="matrix(1.3669969,0,0,1.3669969,-1.1178441,-87.867666)">
|
|
||||||
<rect
|
|
||||||
ry="1.6657715"
|
|
||||||
y="168.17415"
|
|
||||||
x="3.0459228"
|
|
||||||
height="7.7397852"
|
|
||||||
width="11.091684"
|
|
||||||
id="rect840"
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
<rect
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect844"
|
|
||||||
width="11.091684"
|
|
||||||
height="7.7397852"
|
|
||||||
x="3.0459228"
|
|
||||||
y="178.68185"
|
|
||||||
ry="1.6657715" />
|
|
||||||
<rect
|
|
||||||
ry="1.6657715"
|
|
||||||
y="189.18956"
|
|
||||||
x="3.0459228"
|
|
||||||
height="7.7397852"
|
|
||||||
width="11.091684"
|
|
||||||
id="rect846"
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
<rect
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect848"
|
|
||||||
width="11.091684"
|
|
||||||
height="7.7397852"
|
|
||||||
x="3.0459228"
|
|
||||||
y="199.69727"
|
|
||||||
ry="1.6657715" />
|
|
||||||
<rect
|
|
||||||
ry="1.6657715"
|
|
||||||
y="210.20496"
|
|
||||||
x="3.0459228"
|
|
||||||
height="7.7397852"
|
|
||||||
width="11.091684"
|
|
||||||
id="rect850"
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
<rect
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect852"
|
|
||||||
width="11.091684"
|
|
||||||
height="7.7397852"
|
|
||||||
x="3.0459228"
|
|
||||||
y="220.71266"
|
|
||||||
ry="1.6657715" />
|
|
||||||
<rect
|
|
||||||
ry="1.6657715"
|
|
||||||
y="231.22035"
|
|
||||||
x="3.0459228"
|
|
||||||
height="7.7397852"
|
|
||||||
width="11.091684"
|
|
||||||
id="rect854"
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
<rect
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect856"
|
|
||||||
width="11.091684"
|
|
||||||
height="7.7397852"
|
|
||||||
x="3.0459228"
|
|
||||||
y="241.72806"
|
|
||||||
ry="1.6657715" />
|
|
||||||
<rect
|
|
||||||
ry="1.6657715"
|
|
||||||
y="252.23576"
|
|
||||||
x="3.0459228"
|
|
||||||
height="7.7397852"
|
|
||||||
width="11.091684"
|
|
||||||
id="rect858"
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
<rect
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect860"
|
|
||||||
width="11.091684"
|
|
||||||
height="7.7397852"
|
|
||||||
x="3.0459228"
|
|
||||||
y="262.74347"
|
|
||||||
ry="1.6657715" />
|
|
||||||
<rect
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect836"
|
|
||||||
width="11.091684"
|
|
||||||
height="7.7397852"
|
|
||||||
x="3.0459228"
|
|
||||||
y="273.25116"
|
|
||||||
ry="1.6657715" />
|
|
||||||
<rect
|
|
||||||
ry="1.6657715"
|
|
||||||
y="283.75888"
|
|
||||||
x="3.0459228"
|
|
||||||
height="7.7397852"
|
|
||||||
width="11.091684"
|
|
||||||
id="rect838"
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
<rect
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect841"
|
|
||||||
width="11.091684"
|
|
||||||
height="7.7397852"
|
|
||||||
x="3.0459228"
|
|
||||||
y="294.26657"
|
|
||||||
ry="1.6657715" />
|
|
||||||
</g>
|
|
||||||
<rect
|
|
||||||
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:13.44665909;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect905"
|
|
||||||
width="168.80417"
|
|
||||||
height="107.36983"
|
|
||||||
x="21.609423"
|
|
||||||
y="291.26645"
|
|
||||||
ry="3.1763959" />
|
|
||||||
<g
|
|
||||||
transform="matrix(1.3669969,0,0,1.3669969,189.38216,-87.867666)"
|
|
||||||
id="g4581">
|
|
||||||
<rect
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect4555"
|
|
||||||
width="11.091684"
|
|
||||||
height="7.7397852"
|
|
||||||
x="3.0459228"
|
|
||||||
y="168.17415"
|
|
||||||
ry="1.6657715" />
|
|
||||||
<rect
|
|
||||||
ry="1.6657715"
|
|
||||||
y="178.68185"
|
|
||||||
x="3.0459228"
|
|
||||||
height="7.7397852"
|
|
||||||
width="11.091684"
|
|
||||||
id="rect4557"
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
<rect
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect4559"
|
|
||||||
width="11.091684"
|
|
||||||
height="7.7397852"
|
|
||||||
x="3.0459228"
|
|
||||||
y="189.18956"
|
|
||||||
ry="1.6657715" />
|
|
||||||
<rect
|
|
||||||
ry="1.6657715"
|
|
||||||
y="199.69727"
|
|
||||||
x="3.0459228"
|
|
||||||
height="7.7397852"
|
|
||||||
width="11.091684"
|
|
||||||
id="rect4561"
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
<rect
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect4563"
|
|
||||||
width="11.091684"
|
|
||||||
height="7.7397852"
|
|
||||||
x="3.0459228"
|
|
||||||
y="210.20496"
|
|
||||||
ry="1.6657715" />
|
|
||||||
<rect
|
|
||||||
ry="1.6657715"
|
|
||||||
y="220.71266"
|
|
||||||
x="3.0459228"
|
|
||||||
height="7.7397852"
|
|
||||||
width="11.091684"
|
|
||||||
id="rect4565"
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
<rect
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect4567"
|
|
||||||
width="11.091684"
|
|
||||||
height="7.7397852"
|
|
||||||
x="3.0459228"
|
|
||||||
y="231.22035"
|
|
||||||
ry="1.6657715" />
|
|
||||||
<rect
|
|
||||||
ry="1.6657715"
|
|
||||||
y="241.72806"
|
|
||||||
x="3.0459228"
|
|
||||||
height="7.7397852"
|
|
||||||
width="11.091684"
|
|
||||||
id="rect4569"
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
<rect
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect4571"
|
|
||||||
width="11.091684"
|
|
||||||
height="7.7397852"
|
|
||||||
x="3.0459228"
|
|
||||||
y="252.23576"
|
|
||||||
ry="1.6657715" />
|
|
||||||
<rect
|
|
||||||
ry="1.6657715"
|
|
||||||
y="262.74347"
|
|
||||||
x="3.0459228"
|
|
||||||
height="7.7397852"
|
|
||||||
width="11.091684"
|
|
||||||
id="rect4573"
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
<rect
|
|
||||||
ry="1.6657715"
|
|
||||||
y="273.25116"
|
|
||||||
x="3.0459228"
|
|
||||||
height="7.7397852"
|
|
||||||
width="11.091684"
|
|
||||||
id="rect4575"
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
<rect
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
||||||
id="rect4577"
|
|
||||||
width="11.091684"
|
|
||||||
height="7.7397852"
|
|
||||||
x="3.0459228"
|
|
||||||
y="283.75888"
|
|
||||||
ry="1.6657715" />
|
|
||||||
<rect
|
|
||||||
ry="1.6657715"
|
|
||||||
y="294.26657"
|
|
||||||
x="3.0459228"
|
|
||||||
height="7.7397852"
|
|
||||||
width="11.091684"
|
|
||||||
id="rect4579"
|
|
||||||
style="opacity:1;fill:#fcffff;fill-opacity:1;stroke:none;stroke-width:9.07567692;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 12 KiB |
BIN
images/film.png
BIN
images/film.png
Binary file not shown.
Before Width: | Height: | Size: 9.2 KiB |
|
@ -1,4 +1,4 @@
|
||||||
import io, os, sys, time, pygame
|
import io, os, sys, time, pygame, random
|
||||||
import photoboite.screens, photoboite.buttons, photoboite.buttons.config
|
import photoboite.screens, photoboite.buttons, photoboite.buttons.config
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -70,7 +70,12 @@ class Photo:
|
||||||
|
|
||||||
def take(self, camera):
|
def take(self, camera):
|
||||||
self.name = "photos/%s-%04d-%04d" % (time.strftime('%Y%m%d-%H%M%S'), self.cid, self.uid)
|
self.name = "photos/%s-%04d-%04d" % (time.strftime('%Y%m%d-%H%M%S'), self.cid, self.uid)
|
||||||
self.capture = pygame.transform.smoothscale(pygame.image.load(camera.take(self.name)), (638, 480))
|
|
||||||
|
surface = pygame.Surface((646, 488))
|
||||||
|
surface.fill((255, 255, 255))
|
||||||
|
surface.blit(pygame.transform.smoothscale(pygame.image.load(camera.take(self.name)), (638, 480)), (4, 4))
|
||||||
|
|
||||||
|
self.capture = pygame.transform.rotate(surface.convert_alpha(), random.randrange(-20, 20, 4))
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
|
@ -150,8 +150,6 @@ class CaptureButton(Button):
|
||||||
|
|
||||||
self.font = pygame.font.Font(None, 80)
|
self.font = pygame.font.Font(None, 80)
|
||||||
|
|
||||||
self.photo_film = pygame.image.load(os.path.dirname(os.path.realpath(__file__)) + '/../../images/film.png').convert_alpha()
|
|
||||||
|
|
||||||
def draw_on(self, screen):
|
def draw_on(self, screen):
|
||||||
if self.enabled:
|
if self.enabled:
|
||||||
if self.pressed:
|
if self.pressed:
|
||||||
|
@ -194,9 +192,17 @@ class CaptureButton(Button):
|
||||||
capture.take(self.photoboite.camera)
|
capture.take(self.photoboite.camera)
|
||||||
pygame.time.wait(600)
|
pygame.time.wait(600)
|
||||||
|
|
||||||
|
self.photoboite.screen().fill((200,200,200))
|
||||||
|
|
||||||
|
width = self.photoboite.screen().get_width()
|
||||||
|
height = self.photoboite.screen().get_height()
|
||||||
|
|
||||||
for photo in capture.photos:
|
for photo in capture.photos:
|
||||||
self.photoboite.screen().blit(photo.capture, (81, 0))
|
photo_width = photo.capture.get_width()
|
||||||
self.photoboite.screen().blit(self.photo_film, (0, 0))
|
photo_height = photo.capture.get_height()
|
||||||
|
|
||||||
|
lefttop = ((width - photo_width) / 2, (height - photo_height) / 2)
|
||||||
|
self.photoboite.screen().blit(photo.capture, lefttop)
|
||||||
pygame.display.flip()
|
pygame.display.flip()
|
||||||
pygame.time.wait(800)
|
pygame.time.wait(800)
|
||||||
self.photoboite.event()
|
self.photoboite.event()
|
||||||
|
|
Loading…
Reference in New Issue