Пример #1
0
def insert_clef(request, page_id):
    if request.method == 'POST':
        data = json.loads(request.POST['data'])
        shape = str(data.get("shape")).upper()
        line = str(data.get("line"))
        before_id = str(data.get("beforeid"))

        try:
            ulx = str(data["ulx"])
            uly = str(data["uly"])
            lrx = str(data["lrx"])
            lry = str(data["lry"])
        except KeyError:
            ulx = uly = lrx = lry = None

        p = get_object_or_404(Page, pk=page_id)
        fname = p.get_job_path(j, 'mei')

        md = ModifyDocument(fname)
        result = md.insert_clef(line, shape, data["pitchInfo"], before_id, ulx, uly, lrx, lry)
        md.write_doc()

        return result
Пример #2
0
def insert_clef(request, page_id):
    if request.method == 'POST':
        data = json.loads(request.POST['data'])
        shape = str(data.get("shape")).upper()
        line = str(data.get("line"))
        before_id = str(data.get("beforeid"))

        try:
            ulx = str(data["ulx"])
            uly = str(data["uly"])
            lrx = str(data["lrx"])
            lry = str(data["lry"])
        except KeyError:
            ulx = uly = lrx = lry = None

        p = get_object_or_404(Page, pk=page_id)
        fname = p.get_job_path(j, 'mei')

        md = ModifyDocument(fname)
        result = md.insert_clef(line, shape, data["pitchInfo"], before_id, ulx,
                                uly, lrx, lry)
        md.write_doc()

        return result