From 4406b45f7aa714514fee30065e92052a4a87638f Mon Sep 17 00:00:00 2001 From: Guillaume Dott Date: Sat, 4 Nov 2017 00:40:53 +0100 Subject: [PATCH] Add hand cursor on sleep mode --- clicker.png | Bin 0 -> 10148 bytes clicker.svg | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++ photoboite.py | 25 +++++++++++++------- 3 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 clicker.png create mode 100644 clicker.svg diff --git a/clicker.png b/clicker.png new file mode 100644 index 0000000000000000000000000000000000000000..4470c60c5e8077e877fe8ff91c6753eae18a746b GIT binary patch literal 10148 zcmc&)g;x~s*Po?9Bo|3ZX(c74L)aArmJ;dikdTxRkQAglUAj|1VnMo*mTm;;7J+y8 z{{Dz}&)KtQ=XvJ2ckbNy+z3;Bt?&?!3J(B)hcHDs1OPzT@4q-$;FXb-iI3n9hKmeL z0|)&0;FyJi|8boZbzA^|p!5C&%D-_{ceHSIH+D7$+}+)|tQ~A!OpTq) zxg4D>)Aq%v0DvBV$w_N?r0*?w`skU@N*wO`T2v3Fz)~$NV(SrK^8RF-Ky+0@mHG0Z z4-O*C-$9@lMJkNm$ey_H0r&MV=O{BjY#h9w#bx;B z`YUc?Y`sqARysfb#l^`Acj|6qz`4nA%9dCNeK>)OWn~+yBsGCV$MOfU$J(+gqLs~d9T^xR*|t6q5WuXdOEjo;$~6{6uNqU zK%=b+Ytt>G|~cEQyYW zfTtCfp4cny=<$;LRQi>DyJ~Vr;H^N4>oKE=-r5<>+|g4tdgHFmmc29jTwxgOiozwL zKW}RuZ&b%%q?)t>GhNEX{H9sEg;owqw{ZrTTvso+RB-!$MDrK7Gnb6rbx8XS-g&7A zyV4Mx^u^?D-8rLKt9&pw@oVlHrBQ)R+$9h152-Gy4+acZz@?YMm3D>yxGWOqaAc_2 z*|YlGz71iFbE`F6Jc!;?VI8^f!ch}LB7K5V`rb`cNQZif518?6rw%rq2R3KQLb2J| z>H6|TU$Y)6v}DQ#I^!KabDm{&{jww{F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Wt;y3*$Gw+Z*(hcwj(-ESnH{*O zs*`isRDM=)*nmEFR#xfMUiSC+-+}%S!MJBW(Z4BxCc1>T`T`%M;Vzp<7>x2BZVUMP zrSw`X%QOmU<|;n6q@NUu?yv(7s9brNnM4iGN_=20VacL~gAwX|Vm-eCM>x}7HRCuVOr%Z5$& zQqfRlE&zBxO_R2y_vmzJ?CD%=th1V?k8eSdih8FHl6nB5B9y43YIFO0XmZZ@(N z`+E8ymF`Y$s_?}UFtEmbst#5miaUQLj{VPaAw?7hYb@nR^hge9OYXH8H6MI-yi}`b zKi|;&2&Le76JfkQrK3*H@H?4Y%?fe^g%On<5ko+PLgNa-3@GOs(o_Qlh zu~r0kxx(V7W`s{F2Up7JW;9yi*kkJbs?YOulQ3|y;m?;G6?GrQ`V!f@s_G7Y2-^*{ zu=L~Sw(S--jb1RACmUjE0!wz}lvqSNxtDCwDcjEv%72S|F^=IG4|Zv_0}3_0xyI7% zI6MjByyU&>of1r5bfXqiP3`MLe6HCBr`B783Bl46YtCJ~JVSj%K%3m^kb7yM-FO?TuK3Qi{-=lBlaV4$!nwurid1F*v$5qgRD zfX?*VFQBq`#qEdmzK|nNJ06SYL1iWV>ldvd@NJAzdZ}nG>GO^ zLm(u`!v&Urj)VIr;rJU8TwUQI-em?dPD5NpR(1mo@ZCFmn!8+D8}bpi*tXY0yw|L^ z#vAj=eNP5w37uzQS0|{#yxp~qY{^NVVL#$mV!TGcioigrooAOHaU~AQj%NoF)SUUs v!-hzT3MCmfCh + + +image/svg+xml \ No newline at end of file diff --git a/photoboite.py b/photoboite.py index e3f925d..0e55741 100755 --- a/photoboite.py +++ b/photoboite.py @@ -81,10 +81,10 @@ class CaptureButton(Button): countdown = 3 def __init__(self, size, topleft, photoboite): - self.up_image = pygame.image.load('button-up.png').convert_alpha() + self.up_image = pygame.image.load(os.path.dirname(os.path.realpath(__file__)) + '/button-up.png').convert_alpha() self.up_image = pygame.transform.smoothscale(self.up_image, (size, size)) - self.down_image = pygame.image.load('button-down.png').convert_alpha() + self.down_image = pygame.image.load(os.path.dirname(os.path.realpath(__file__)) + '/button-down.png').convert_alpha() self.down_image = pygame.transform.smoothscale(self.down_image, (size, size)) rect = self.up_image.get_rect() @@ -103,7 +103,7 @@ class CaptureButton(Button): self.font = pygame.font.Font(None, 80) - self.photo_film = pygame.image.load('film.png').convert_alpha() + self.photo_film = pygame.image.load(os.path.dirname(os.path.realpath(__file__)) + '/film.png').convert_alpha() def draw_on(self, screen): if self.enabled: @@ -177,18 +177,24 @@ class Photo: self.uid = uid def take(self, camera): - self.name = "%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)) return self class SleepMode: - def __init__(self, seconds): + def __init__(self, seconds, screen): self.enabled = True self.drawn = False self.seconds = seconds + self.screen = screen + + self.clicker = pygame.image.load(os.path.dirname(os.path.realpath(__file__)) + '/clicker.png').convert_alpha() + self.clicker_rect = self.clicker.get_rect() + self.clicker_rect.topleft = ((self.screen.get_width() - self.clicker_rect.width) / 2, (self.screen.get_height() - self.clicker_rect.height) / 2) + def move(self): self.last_action = time.time() @@ -198,9 +204,10 @@ class SleepMode: self.move() self.enabled = False - def draw_on(self, screen): + def draw(self): if not self.drawn: - screen.fill((255,255,255)) + self.screen.fill((255,255,255)) + self.screen.blit(self.clicker, self.clicker_rect) pygame.display.flip() self.drawn = True @@ -228,7 +235,7 @@ class Photoboite: self.clock = pygame.time.Clock() - self.sleep = SleepMode(30) + self.sleep = SleepMode(30, self.screen) def screen(self): @@ -283,7 +290,7 @@ class Photoboite: while True: if self.sleep.enabled: self.sleep.event() - self.sleep.draw_on(self.screen) + self.sleep.draw() self.clock.tick(60) else: self.event()