def update_time(self, dt): """ Update the text of the label time of screen :param dt: :return: """ self.text = misc.get_time()
def notify_start_of_call(self): """ sends notification email informing user that ``self.call_id`` has been initiated """ e = self.email_info report_time = get_time() email_sub = "[SITREP from %s] Run %s - Starting %s at %s" % (self._hostname, self.run_id, self.call_id, report_time) email_body = "%s\n\n%s" % (email_sub, self.cmd_string) server_info = self.yargs.run_options.custom_smtp email_notification(e.email_from, e.email_to, email_sub, email_body, base64.b64decode(e.email_li), server_info)
def notify_start_of_call(self): """ sends notification email informing user that ``self.call_id`` has been initiated """ e = self.email_info report_time = get_time() email_sub = "[SITREP from %s] Run %s - Starting %s at %s" % ( self._hostname, self.run_id, self.call_id, report_time) email_body = "%s\n\n%s" % (email_sub, self.cmd_string) server_info = self.yargs.run_options.custom_smtp email_notification(e.email_from, e.email_to, email_sub, email_body, base64.b64decode(e.email_li), server_info)
def notify_end_of_call(self): """ sends notification email informing user that ``self.call_id`` has exited """ e = self.email_info report_time = get_time() email_sub = "[SITREP from %s] Run %s - Exited %s at %s" % (self._hostname, self.run_id, self.call_id, report_time) # repeat subject in body email_body = email_sub email_body += "\n\n ==> stderr <==\n\n%s" % self.stderr_msg server_info = self.yargs.run_options.custom_smtp email_notification(e.email_from, e.email_to, email_sub, email_body, base64.b64decode(e.email_li), server_info)
def notify_end_of_call(self): """ sends notification email informing user that ``self.call_id`` has exited """ e = self.email_info report_time = get_time() email_sub = "[SITREP from %s] Run %s - Exited %s at %s" % ( self._hostname, self.run_id, self.call_id, report_time) # repeat subject in body email_body = email_sub email_body += "\n\n ==> stderr <==\n\n%s" % self.stderr_msg server_info = self.yargs.run_options.custom_smtp email_notification(e.email_from, e.email_to, email_sub, email_body, base64.b64decode(e.email_li), server_info)
def run(c_id, name, surname, tc, printnum, x0, y0, z0, r0, brightness, color, archive): c_id = c_id.replace('"','') misc.log_("Selected Country",c_id) misc.log_("Name",name) misc.log_("Surname",surname) misc.log_("TC",tc) photo_id = get_pid(c_id) name = name.replace('"','') x1 = ast.literal_eval(x0) y1 = ast.literal_eval(y0) z1 = ast.literal_eval(z0) r1 = ast.literal_eval(r0) brightness = ast.literal_eval(brightness) color = ast.literal_eval(color) x1 = -x1 y1 = -y1 misc.log_t("Archive - REQUEST",archive); if (misc.is_test_mode): lImagePath = "cl\\test-stan.jpg" else: if (archive == "false"): lImagePath = lastImage.find() else: lImagePath = lastImage.g_base() + tc + ".jpg" # needs testing misc.log_t("Target File",lImagePath); if (os.path.isfile(lImagePath)): time = misc.get_time() misc.log_("IMG_","Loading : " + lImagePath) img_base = Image.open( lImagePath) # Load target image # resize image to fit head if(photo_id == 1): img_base = resizeZScale( img_base, 1 + z_offset_vs) # Resize based on app img_base = rotateImage( img_base , 270) # Rotate to fix camera rotation else: if(photo_id == 5): img_base = resizeZScale( img_base, z1 + z_offset_china) # Resize based on app img_base = rotateImage( img_base , 270 - int(r1)) # Rotate to fix camera rotation else: if(photo_id == 4): img_base = resizeZScale( img_base, (z1) + z_offset_USA) # Resize based on app img_base = rotateImage( img_base , 270 - int(r1)) # Rotate to fix camera rotation else: img_base = resizeZScale( img_base, z1 + z_offset) # Resize based on app img_base = rotateImage( img_base , 270 - int(r1)) # Rotate to fix camera rotation img_base = cropImage( img_base, transform( photo_id ,img_base , imgSize, x1, y1) ) img_base = cropImage( resizeToSmallSize(img_base) , s_icao) # don't touch breaks the rest # apply effects if(not brightness == 1): misc.log_t("Enhancer","Brightness " + str(brightness)) enhancer = ImageEnhance.Brightness(img_base) img_base = enhancer.enhance(brightness) if(not color == 1): misc.log_t("Enhancer","Color " + str(color)) enhancer = ImageEnhance.Color(img_base) img_base = enhancer.enhance(color) # 4x4 + draw text i_out = multiplexImage_WQR( Image.new("RGB", paper_size , "white") , img_base , (qr_base_url + tc + ".jpg")) i_out = drawInfo.draw( i_out, name, surname, tc, misc.timeString(time) , owner_name) if(photo_id == 3): cutlines = cl_schengen i_out.paste(cutlines, (0, 0), cutlines) else: if(photo_id == 4): cutlines = cl_usa # cl_usa i_out.paste(cutlines, (0, 0), cutlines) else: if(photo_id == 5): cutlines = cl_china # cl_china.png i_out.paste(cutlines, (0, 0), cutlines) else: if(photo_id == 6): cutlines = cl_icao_schengen i_out.paste(cutlines, (0, 0), cutlines) else: cutlines = cl i_out.paste(cutlines, (0, 0), cutlines) i_small = cropImage(i_out, small_img_size ) i_small.save(os.pardir + "\\output\\small\\" + tc + "-sm.jpg") file_name = os.pardir + "\\output\\" + tc + ".jpg" # + misc.timeStringShort(time) misc.log_("FILE", "TO '" + file_name + "'") i_out.save(file_name) print_image_x( i_out, int(printnum)) return "Print Request Done" else: return "File find error... Aborted."