def picture_generator(self, host, user, key): try: shutil.rmtree(self.exportdir) # loesche altes exportDir except WindowsError: pass self.powerpoint.get_images_from_ppt(self.exportdir) imgstring = '' filelist = [os.path.join(self.exportdir, self.outfilename)] oslistdir = os.listdir(self.exportdir) sort_nicely(oslistdir) for f in oslistdir: imgstring += (" " * 50) + "{ url: '" + f + "'},\n" filelist.append(os.path.join(self.exportdir, f)) template = open(self.templatefile, 'r').read() template = template.replace('IMAGE_LIST', imgstring[:-2]) f = open(os.path.join(self.exportdir, self.outfilename), 'w+') f.write(template) f.close() fileupload = FileUpload(host, user, key) fileupload.multi_upload(filelist, self.remotepicturepath) fileupload.close()
def update(self): upload=FileUpload() upload.automatico=True upload.action=config.base_url+settings.app+"/admin/Archivo/None/action=save" upload.categorias=nuclear.VAR("categorias") upload.tipos=nuclear.VAR("tipos") upload.enlazar(self.biblioteca.nueva) self.tabsManger.appendToTab(0,upload) self.tabsManger.appendToTab(1,self.biblioteca) s(self.target).html(self._html.format(self.titulo,self.btn1,self.btn2,self.btn3)) s(self.target).addClass("hidden") s(self.target).find(".close").bind("click",self.close) s(s(self.target).find(".botonera").find(".btn")[1]).css(self.css_selected) s(self.target).find(".botonera").find(".btn").bind("click",self.clickTab) if self.tabsManger!=None: self.tabsManger.bind("subir",self.subir) s(self.target).find(".content").html(self.tabsManger.target) s(self.target).find(".elegir").bind("click",self.elegir)
def site_generator(self, host, user, key): content = self.dict_generator() with open('data.json', 'w') as f: json.dump(self.to_json(content), f) with open('index.html', 'w') as f: f.write(self.to_html(content)) with open('time', 'w') as f: f.write((time.time()).split(".")[0]) fileupload = FileUpload(host, user, key) fileupload.upload('index.html', "www") fileupload.upload('time', "www") fileupload.upload('data.json', "www") fileupload.close()
def __init__(self, url): FileUpload.__init__(self, url) self.url = url
from FileUpload import FileUpload import logging from time import sleep import RPi.GPIO as GPIO def generate_image_name(): return "{}.png".format(datetime.now().isoformat()) # logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG) display = Display() print("[0/2] Starting setup...") display.print("[0/2] Setup\n\rstarted") file_upload = FileUpload() snipe_it = SnipeIT() reader = Scanner() scale = Scale() print("[0/2] Taring the scale. Remove everything and press Enter.") _ = input() print("[0/2] Taring the scale...") scale.tare() print("[1/2] Scale taring complete.") # initialize the video stream and allow the camera sensor to warm up print("[1/2] Starting video stream...") camera = Camera() print("[2/2] Video stream started...") print("[2/2] Setup complete")