Example #1
0
    def imageAdd(self, data):
        doc = data.Doc
        sheet = comun.get_sheet(doc, data.Sheet)
        properties = comun.to_dict(data.Properties)
        position, size = comun.get_pos_size(data.PosSize)
        draw_page = sheet.getDrawPage()

        if data.Type:
            type_shape = SHAPES.get(data.Type, SRV_DCS)
            image = doc.createInstance(type_shape)
            if type_shape == SRV_DCS:
                pv = comun.set_properties((('Type', data.Type),))
                comun.set_property(image, ('CustomShapeGeometry', pv))
        else:
            path = comun.path_to_url(data.Path)
            image = doc.createInstance(SRV_GOS)
            if data.Link:
                log.info(data.Link)
                image.GraphicURL = path
                log.info(path)
            else:
                gp = self._create_instance(SRV_GP)
                pv = comun.set_properties((('URL', path),))
                image.Graphic = gp.queryGraphic(pv)
        draw_page.add(image)

        if data.Name:
            image.Name = data.Name

        image.setPosition(position)
        image.setSize(size)
        for k, v in properties.items():
            if hasattr(image, k):
                setattr(image, k, v)
        return image
Example #2
0
    def imageAdd(self, data):
        doc = data.Doc
        sheet = comun.get_sheet(doc, data.Sheet)
        properties = comun.to_dict(data.Properties)
        position, size = comun.get_pos_size(data.PosSize)
        draw_page = sheet.getDrawPage()

        if data.Type:
            type_shape = SHAPES.get(data.Type, SRV_DCS)
            image = doc.createInstance(type_shape)
            if type_shape == SRV_DCS:
                pv = comun.set_properties((('Type', data.Type), ))
                comun.set_property(image, ('CustomShapeGeometry', pv))
        else:
            path = comun.path_to_url(data.Path)
            image = doc.createInstance(SRV_GOS)
            if data.Link:
                log.info(data.Link)
                image.GraphicURL = path
                log.info(path)
            else:
                gp = self._create_instance(SRV_GP)
                pv = comun.set_properties((('URL', path), ))
                image.Graphic = gp.queryGraphic(pv)
        draw_page.add(image)

        if data.Name:
            image.Name = data.Name

        image.setPosition(position)
        image.setSize(size)
        for k, v in properties.items():
            if hasattr(image, k):
                setattr(image, k, v)
        return image
Example #3
0
 def getCell(self, address):
     doc = self._get_doc(address.Doc)
     if address.Current:
         return doc.getCurrentSelection().getCellByPosition(0, 0)
     sheet = comun.get_sheet(doc, address.Sheet)
     if address.Name:
         cell = sheet.getCellRangeByName(address.Name.upper()).getCellByPosition(0, 0)
     else:
         cell = sheet.getCellByPosition(address.Col, address.Row)
     return cell
Example #4
0
 def getRange(self, address):
     doc = self._get_doc(address.Doc)
     if address.Current:
         return doc.getCurrentSelection()
     sheet = comun.get_sheet(doc, address.Sheet)
     if address.Name:
         rango = sheet.getCellRangeByName(address.Name.upper())
     else:
         rango = sheet.getCellRangeByPosition(
             address.Col, address.Row, address.EndCol, address.EndRow)
     return rango
Example #5
0
 def getCell(self, address):
     doc = self._get_doc(address.Doc)
     if address.Current:
         return doc.getCurrentSelection().getCellByPosition(0, 0)
     sheet = comun.get_sheet(doc, address.Sheet)
     if address.Name:
         cell = sheet.getCellRangeByName(
             address.Name.upper()).getCellByPosition(0, 0)
     else:
         cell = sheet.getCellByPosition(address.Col, address.Row)
     return cell
Example #6
0
 def getRange(self, address):
     doc = self._get_doc(address.Doc)
     if address.Current:
         return doc.getCurrentSelection()
     sheet = comun.get_sheet(doc, address.Sheet)
     if address.Name:
         rango = sheet.getCellRangeByName(address.Name.upper())
     else:
         rango = sheet.getCellRangeByPosition(address.Col, address.Row,
                                              address.EndCol,
                                              address.EndRow)
     return rango
Example #7
0
 def getSheet(self, address):
     doc = self._get_doc(address.Doc)
     return comun.get_sheet(doc, address.Sheet)
Example #8
0
 def getSheet(self, address):
     doc = self._get_doc(address.Doc)
     return comun.get_sheet(doc, address.Sheet)