Skip to content

Commit

Permalink
Improve code style
Browse files Browse the repository at this point in the history
  • Loading branch information
goosepirate committed Oct 9, 2023
1 parent 30dc05f commit 1980234
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion addin.xcu
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<prop oor:name="Description"><value xml:lang="en">Returns an image from a given source. Provided by Lox365.</value></prop>
<prop oor:name="Category"><value>Add-in</value></prop>
<node oor:name="Parameters">
<node oor:name="out_cell" oor:op="replace">
<node oor:name="outCell" oor:op="replace">
<prop oor:name="DisplayName"><value xml:lang="en">Location</value></prop>
<prop oor:name="Description"><value xml:lang="en">Reference to the cell where the image is to be placed.</value></prop>
</node>
Expand Down
9 changes: 4 additions & 5 deletions pythonpath/imagefn.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from com.sun.star.awt import Size

def IMAGE(doc, out_cell, url):
drawpages = doc.DrawPages[int(out_cell.RangeAddress.Sheet)]
def IMAGE(doc, outCell, url):
drawpages = doc.DrawPages[int(outCell.RangeAddress.Sheet)]
existing_images = []

def get_existing_images_at_position():
for item in drawpages:
if out_cell.Position != item.Position: continue
if outCell.Position != item.Position: continue
existing_images.append(item)
def remove_existing_images_at_position():
[item.dispose() for item in existing_images]
Expand All @@ -26,7 +25,7 @@ def remove_existing_images_at_position():
url = '/'.join(current_dir) + '/' + url

image = doc.createInstance('com.sun.star.drawing.GraphicObjectShape')
image.Position = out_cell.Position
image.Position = outCell.Position
image.GraphicURL = url
image.Name = f'Generated image'
try:
Expand Down

0 comments on commit 1980234

Please sign in to comment.