Skip to content

Images without all the options #1

@sanguinariojoe

Description

@sanguinariojoe

Sometimes the images inside the SNB files does not contains some fields (like bottom), I suggest to replace the class imagePoss by:

class imagePoss:
    def __init__(self, style):
        self.style = style
        self.options = {'left':0.0,
                        'bottom':0.0,
                        'width':595.27,
                        'height':841.89}
        self.compute()

    def compute(self):
        fields = self.style.split(';')
        for f in fields:
            name, value = f.split(':')
            if name in self.options.keys():
                self.options[name] = float(value.replace('pt', ''))

Such that to insert the image the following command can be used:

        canvas.drawInlineImage(img,
                               style.options['left'],
                               style.options['bottom'],
                               style.options['width'],
                               style.options['height'])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions