Example #1
0
def generate_preview(template, layout):
    if template not in templates.templates():
        return "Specified template does not exist.", 400
    if layout is None:
        layout = templates.templates()[template].layouts[0].__name__
    if layout not in layouts.layouts():
        return "Specified layout does not exist.", 400
    return send_file(pdf_builder.get_preview(template, layout), mimetype="image/jpeg")
Example #2
0
def generate_preview(template, layout):
    if template not in templates.templates():
        return "Specified template does not exist.", 400
    if layout is None:
        layout = templates.templates()[template].layouts[0].__name__
    if layout not in layouts.layouts():
        return "Specified layout does not exist.", 400
    return send_file(pdf_builder.get_preview(template, layout),
                     mimetype="image/jpeg")
Example #3
0
 def __init__(self, parent=None):
     QtCore.QThread.__init__(self, parent)
     self.exiting = False
     self.lib = common.common() 
     self.templates = templates.templates()
     self.query_db_getall = query_db_getall.queryDbGetAll()
     self.query_db_getdetail = query_db_getdetail.queryDbGetDetail()
 def set_values(self,curdir,configxml,dbpath):
     self.curdir = curdir
     self.configxml = configxml
     self.dbpath = dbpath
     self.lib = common.common() 
     self.templates = templates.templates()
     self.fields_to_show = configxml.find('fields_to_show').text.split(',')
Example #5
0
def build_flyer():
    if "layout" not in request.json or "template" not in request.json or "events" not in request.json:
        return "You have to specify template, a layout and a list of events.", 400
    template = request.json["template"]
    if template not in templates.templates():
        return "Specified template does not exist.", 400
    layout = request.json["layout"]
    if layout not in layouts.layouts():
        return "Specified layout does not exist.", 400
    with tempfile.NamedTemporaryFile(dir=tmpdir, delete=False) as event_pdf:
        pdf_builder.build_pdf(template, layout, request.json["events"], event_pdf.name)
        return json.jsonify(download=path.basename(event_pdf.name))
Example #6
0
def build_flyer():
    if "layout" not in request.json or "template" not in request.json or "events" not in request.json:
        return "You have to specify template, a layout and a list of events.", 400
    template = request.json["template"]
    if template not in templates.templates():
        return "Specified template does not exist.", 400
    layout = request.json["layout"]
    if layout not in layouts.layouts():
        return "Specified layout does not exist.", 400
    with tempfile.NamedTemporaryFile(dir=tmpdir, delete=False) as event_pdf:
        pdf_builder.build_pdf(template, layout, request.json["events"],
                              event_pdf.name)
        return json.jsonify(download=path.basename(event_pdf.name))
Example #7
0
 def __init__(self, parent = None):
     ''''Performance issues : 
             - showing progress bar increases scanning time
             - folders are scanned twice
             - dicts have different methods, 
               some are faster but block the gui.
             - signaling progress also slowsdown things
     '''
     QtCore.QThread.__init__(self, parent)
     self.exiting = False
     self.lib = common.common() 
     self.templates = templates.templates()
     self.get_data = get_metadata.getMetadata()
Example #8
0
 def __init__(self, parent = None):
     QtCore.QThread.__init__(self, parent)
     self.exiting = False
     self.lib = common.common() 
     self.templates = templates.templates()
Example #9
0
 def set_values(self,curdir,configxml,dbpath):
     self.curdir = curdir
     self.configxml = configxml
     self.dbpath = dbpath
     self.lib = common.common() 
     self.templates = templates.templates()
#!/usr/bin/env python3
# pregen_previews.py -- pregenerates all previews that don't yet exist.

import pdf_builder, templates

print("Generating previews...")
for template_name, template in templates.templates().items():
    for layout in template.layouts:
        print("- generated " + pdf_builder.get_preview(template_name, layout.__name__))