def reporte(evt): # elejir nombre de archivo: result = gui.save_file(title='Guardar', filename="facturas-reporte.html", wildcard='|'.join(["Archivos HTML (*.html)|*.html"])) if result: filename = result[0] f = open(filename, "w") f.write("<HTML><BODY><TABLE>\n") f.write("<TR>\n") for col in listado: f.write("<TH>%s</TH>\n" % col.text) f.write("</TR>\n") for it in listado.items: f.write("<TR>") for col in listado: if it[col.name] is None: v = "" elif callable(col.represent): v = col.represent(it[col.name]) elif col.represent: v = col.represent % it[col.name] else: v = it[col.name] if isinstance(v, unicode): v = v.encode("latin1", "ignore") f.write("<TD>%s</TD>" % v) f.write("</TR>\n") f.write("</TR></TABLE></BODY></HTML>\n") f.close()
def reporte(evt): # elejir nombre de archivo: result = gui.save_file(title='Guardar', filename="facturas-reporte.html", wildcard='|'.join(["Archivos HTML (*.html)|*.html" ])) if result: filename = result[0] f = open(filename, "w") f.write("<HTML><BODY><TABLE>\n") f.write("<TR>\n") for col in listado: f.write("<TH>%s</TH>\n" % col.text) f.write("</TR>\n") for it in listado.items: f.write("<TR>") for col in listado: if it[col.name] is None: v = "" elif callable(col.represent): v = col.represent(it[col.name]) elif col.represent: v = col.represent % it[col.name] else: v = it[col.name] if isinstance(v, unicode): v = v.encode("latin1", "ignore") f.write("<TD>%s</TD>" % v) f.write("</TR>\n") f.write("</TR></TABLE></BODY></HTML>\n") f.close()
def save_2(self, dt=0): self.busy = False path = gui.save_file(default_name="Level_.yaml") graphics.main_window.set_fullscreen(True) if path == None: return level.save(path) pyglet.clock.schedule_once(self.save_3, 0.5) self.busy = True
def save_2(self, dt=0, img=None): self.busy = False path = gui.save_file(default_name="My Picture.png") if path == None: self.dialog_fail() img.save(path) if not settings.settings['fullscreen']: self.save_3(0,img,path) return graphics.main_window.set_fullscreen(settings.settings['fullscreen']) pyglet.clock.schedule_once(self.save_3, 0.5, img, path) self.busy = True
def exportar(evt): from pyafipws.formatos.formato_csv import desaplanar, aplanar, escribir # adapto los datos al formato de pyrece: items = [item.copy() for item in listado.items] for item in items: item['cbt_numero'] = item['cbte_nro'] item['fecha_cbte'] = item['fecha_cbte'].strftime("%Y%m%d") if not 'tributos' in items: item['tributos'] = [] if not 'ivas' in items: item['ivas'] = [] filas1 = aplanar(items) print filas1 # elejir nombre de archivo: result = gui.save_file(title='Guardar', filename="facturas-exportar.csv", wildcard='|'.join(["Archivos CSV (*.csv)|*.csv"])) if result: filename = result[0] escribir(filas1, filename)
def on_menu_archivo_guardar_click(self, event): filename = entrada wildcard = [ "Archivos CSV (*.csv)|*.csv", "Archivos XML (*.xml)|*.xml", "Archivos TXT (*.txt)|*.txt", "Archivos DBF (*.dbf)|*.dbf", "Archivos JSON (*.json)|*.json", "Planillas Excel (*.xlsx)|*.xlsx", ] if entrada.endswith("xml"): wildcard.sort(reverse=True) if self.paths: path = self.paths[0] else: path = salida result = gui.save_file(title='Guardar', filename=path, wildcard='|'.join(wildcard)) if not result: return fn = result[0] self.grabar(fn)
def save(self): path = gui.save_file(default_name="Level_.yaml") if path == None: return level.save(path)