Add image in cell
This commit is contained in:
parent
b8d37ed834
commit
b0ecdad5fe
|
@ -6234,6 +6234,14 @@ class Paths(object):
|
|||
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def image(cls, path):
|
||||
gp = create_instance('com.sun.star.graphic.GraphicProvider')
|
||||
image = gp.queryGraphic((
|
||||
PropertyValue(Name='URL', Value=cls.to_url(path)),
|
||||
))
|
||||
return image
|
||||
|
||||
@classmethod
|
||||
def copy(cls, source, target='', name=''):
|
||||
p, f, n, e = _P(source).info
|
||||
|
|
Binary file not shown.
|
@ -5,21 +5,45 @@
|
|||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 31.999582 4.9999995"
|
||||
viewBox="0 0 24 24"
|
||||
xml:space="preserve"
|
||||
width="31.999582"
|
||||
height="4.9999995"><metadata
|
||||
width="24"
|
||||
height="24"
|
||||
sodipodi:docname="delete.svg"
|
||||
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1006"
|
||||
id="namedview23"
|
||||
showgrid="false"
|
||||
inkscape:zoom="37.189883"
|
||||
inkscape:cx="12.986066"
|
||||
inkscape:cy="9.5133673"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="37"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1"
|
||||
inkscape:document-rotation="0" /><metadata
|
||||
id="metadata43"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs41" />
|
||||
<g
|
||||
id="g6"
|
||||
transform="matrix(0.0650398,0,0,0.0650398,0,-13.499791)">
|
||||
transform="matrix(0.03658537,0,0,0.0650398,3.0335128,-4.2925925)">
|
||||
<g
|
||||
id="g4">
|
||||
<path
|
||||
|
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.7 KiB |
|
@ -4768,7 +4768,8 @@ class UnoGrid(UnoBaseObject):
|
|||
row = data
|
||||
if self.formats:
|
||||
for i, f in enumerate(formats):
|
||||
row[i] = f.format(data[i])
|
||||
if f:
|
||||
row[i] = f.format(data[i])
|
||||
return row
|
||||
|
||||
def add_row(self, data):
|
||||
|
@ -6233,6 +6234,14 @@ class Paths(object):
|
|||
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def image(cls, path):
|
||||
gp = create_instance('com.sun.star.graphic.GraphicProvider')
|
||||
image = gp.queryGraphic((
|
||||
PropertyValue(Name='URL', Value=cls.to_url(path)),
|
||||
))
|
||||
return image
|
||||
|
||||
@classmethod
|
||||
def copy(cls, source, target='', name=''):
|
||||
p, f, n, e = _P(source).info
|
||||
|
|
|
@ -27,10 +27,11 @@ class Controllers(object):
|
|||
|
||||
self.paths.append(path)
|
||||
p = app.paths(path)
|
||||
self.d.grid.add_row((p.file_name, 'delete.svg', p.path))
|
||||
path = app.paths.join(self.d.path, 'images/delete.svg')
|
||||
image = app.paths.image(path)
|
||||
self.d.grid.add_row((p.file_name, image, p.path))
|
||||
# ~ self.d.grid.set_cell_tooltip(0, self.d.grid.rows-1, p)
|
||||
# ~ self.d.grid.sort(0)
|
||||
app.debug(path)
|
||||
return
|
||||
|
||||
def button_save_action(self, event):
|
||||
|
@ -137,7 +138,7 @@ def _create_dialog():
|
|||
|
||||
columns = (
|
||||
{'Title': _('File Name'), 'MaxWidth': 120},
|
||||
{'Title': 'X', 'HorizontalAlign': 1, 'Resizeable': False, 'ColumnWidth': 10},
|
||||
{'Title': '-', 'HorizontalAlign': 1, 'Resizeable': False, 'ColumnWidth': 10},
|
||||
{'Title': '', 'Resizeable': False, 'ColumnWidth': 0},
|
||||
)
|
||||
args = {
|
||||
|
|
Loading…
Reference in New Issue