summaryrefslogtreecommitdiff
path: root/lib/api/page_specs.py
blob: f7cec8c6c3b4fcb1d8afc4998966fc00ca20b4ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Authors: see git history
#
# Copyright (c) 2010 Authors
# Licensed under the GNU GPL version 3.0 or later.  See the file LICENSE for details.

from flask import Blueprint, g, jsonify

page_specs = Blueprint('page_specs', __name__)


@page_specs.route('')
def get_page_specs():

    metadata = g.extension.get_inkstitch_metadata()

    page_specs = {
        "width": metadata.document.get('width'),
        "height": metadata.document.get('height'),
        "pagecolor": metadata.document[1].get('pagecolor'),
        "deskcolor": metadata.document[1].get('inkscape:deskcolor')
    }

    return jsonify(page_specs)