Replace icons png for svg

This commit is contained in:
Mauricio Baeza 2020-11-17 22:54:10 -06:00
parent 0099908afc
commit 0804c922f1
16 changed files with 748 additions and 35 deletions

3
.gitignore vendored
View File

@ -3,8 +3,7 @@ __pycache__/
*.po~
*.log
images/
/images
docs/
# Virtualenv

View File

@ -85,6 +85,7 @@ from com.sun.star.lang import XEventListener
from com.sun.star.awt import XMouseListener
from com.sun.star.awt import XMouseMotionListener
from com.sun.star.awt import XFocusListener
from com.sun.star.awt import XKeyListener
# ~ https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1awt_1_1FontUnderline.html
from com.sun.star.awt import FontUnderline
@ -184,6 +185,11 @@ DIR = {
'locales': 'locales',
}
DEFAULT_MIME_TYPE = 'png'
KEY = {
'enter': 1280,
}
MODIFIERS = {
'shift': KeyModifier.SHIFT,
'ctrl': KeyModifier.MOD1,
@ -1153,6 +1159,64 @@ class LODocument(object):
return
class LOCellStyle(LOBaseObject):
def __init__(self, obj):
super().__init__(obj)
@property
def name(self):
return self.obj.Name
@property
def properties(self):
properties = self.obj.PropertySetInfo.Properties
data = {p.Name: getattr(self.obj, p.Name) for p in properties}
return data
@properties.setter
def properties(self, values):
_set_properties(self.obj, values)
class LOCellStyles(object):
def __init__(self, obj, doc):
self._obj = obj
self._doc = doc
def __len__(self):
return len(self.obj)
def __getitem__(self, index):
return LOCellStyle(self.obj[index])
def __setitem__(self, key, value):
self.obj[key] = value
def __delitem__(self, key):
if not isinstance(key, str):
key = key.Name
del self.obj[key]
def __contains__(self, item):
return item in self.obj
@property
def obj(self):
return self._obj
@property
def names(self):
return self.obj.ElementNames
def new(self, name: str=''):
obj = self._doc.create_instance('com.sun.star.style.CellStyle')
if name:
self.obj[name] = obj
obj = LOCellStyle(obj)
return obj
class LOCalc(LODocument):
def __init__(self, obj):
@ -1208,6 +1272,14 @@ class LOCalc(LODocument):
def tabs(self, value):
self._cc.SheetTabs = value
@property
def cs(self):
return self.cell_styles
@property
def cell_styles(self):
obj = self.obj.StyleFamilies['CellStyles']
return LOCellStyles(obj, self)
@property
def db_ranges(self):
# ~ return LOCalcDataBaseRanges(self.obj.DataBaseRanges)
@ -2121,6 +2193,18 @@ class LOWriterTextRange(object):
self._is_paragraph = self.obj.ImplementationName == 'SwXParagraph'
self._is_table = self.obj.ImplementationName == 'SwXTextTable'
def __iter__(self):
self._index = 0
return self
def __next__(self):
for i, p in enumerate(self.obj):
if i == self._index:
obj = LOWriterTextRange(p, self._doc)
self._index += 1
return obj
raise StopIteration
@property
def obj(self):
return self._obj
@ -2142,7 +2226,7 @@ class LOWriterTextRange(object):
@property
def text(self):
return self.obj.getText()
return self.obj.Text
@property
def cursor(self):
@ -2152,6 +2236,10 @@ class LOWriterTextRange(object):
def dp(self):
return self._doc.dp
@property
def is_table(self):
return self._is_table
def offset(self):
cursor = self.cursor.getEnd()
return LOWriterTextRange(cursor, self._doc)
@ -2181,7 +2269,23 @@ class LOWriterTextRanges(object):
self._doc = doc
def __getitem__(self, index):
return LOWriterTextRange(self.obj[index], self._doc)
for i, p in enumerate(self.obj):
if i == index:
obj = LOWriterTextRange(p, self._doc)
break
return obj
def __iter__(self):
self._index = 0
return self
def __next__(self):
for i, p in enumerate(self.obj):
if i == self._index:
obj = LOWriterTextRange(p, self._doc)
self._index += 1
return obj
raise StopIteration
@property
def obj(self):
@ -2194,6 +2298,14 @@ class LOWriter(LODocument):
super().__init__(obj)
self._type = WRITER
@property
def text(self):
return LOWriterTextRange(self.obj.Text, self)
@property
def paragraphs(self):
return LOWriterTextRanges(self.obj.Text, self)
@property
def selection(self):
sel = self.obj.CurrentSelection
@ -2841,7 +2953,7 @@ def _add_listeners(events, control, name=''):
'addMouseListener': EventsMouse,
'addFocusListener': EventsFocus,
# ~ 'addItemListener': EventsItem,
# ~ 'addKeyListener': EventsKey,
'addKeyListener': EventsKey,
# ~ 'addTabListener': EventsTab,
}
if hasattr(control, 'obj'):
@ -2984,6 +3096,27 @@ class EventsFocus(EventsListenerBase, XFocusListener):
return
class EventsKey(EventsListenerBase, XKeyListener):
"""
event.KeyChar
event.KeyCode
event.KeyFunc
event.Modifiers
"""
def __init__(self, controller, name):
super().__init__(controller, name)
def keyPressed(self, event):
pass
def keyReleased(self, event):
event_name = '{}_key_released'.format(self._name)
if hasattr(self._controller, event_name):
getattr(self._controller, event_name)(event)
return
# ~ BorderColor = ?
# ~ FontStyleName = ?
# ~ HelpURL = ?

BIN
files/ZAZPip_v0.6.0.oxt Normal file

Binary file not shown.

52
source/images/close.svg Normal file
View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
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"
viewBox="0 0 32 32"
version="1.1"
x="0px"
y="0px"
id="svg18"
width="32"
height="32">
<metadata
id="metadata24">
<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>9.4</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs22" />
<title
id="title2">9.4</title>
<desc
id="desc4">Created with Sketch.</desc>
<g
stroke="none"
stroke-width="1"
fill="none"
fill-rule="evenodd"
id="g12"
transform="scale(0.66666667)">
<g
fill-rule="nonzero"
fill="#000000"
id="g10">
<g
id="g8">
<path
d="m 26.828427,24 6.366079,6.366079 c 0.779879,0.779879 0.784376,2.039815 -0.0021,2.826309 -0.781048,0.781049 -2.047059,0.781368 -2.826309,0.0021 L 24,26.828427 17.633921,33.194506 c -0.779879,0.779879 -2.039815,0.784376 -2.826309,-0.0021 -0.781049,-0.781048 -0.781368,-2.047059 -0.0021,-2.826309 L 21.171573,24 14.805494,17.633921 c -0.779879,-0.779879 -0.784376,-2.039815 0.0021,-2.826309 0.781048,-0.781049 2.047059,-0.781368 2.826309,-0.0021 L 24,21.171573 30.366079,14.805494 c 0.779879,-0.779879 2.039815,-0.784376 2.826309,0.0021 0.781049,0.781048 0.781368,2.047059 0.0021,2.826309 z M 24,48 C 10.745166,48 0,37.254834 0,24 0,10.745166 10.745166,0 24,0 37.254834,0 48,10.745166 48,24 48,37.254834 37.254834,48 24,48 Z m 0,-4 C 35.045695,44 44,35.045695 44,24 44,12.954305 35.045695,4 24,4 12.954305,4 4,12.954305 4,24 4,35.045695 12.954305,44 24,44 Z"
id="path6" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

37
source/images/home.svg Normal file
View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
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"
xml:space="preserve"
version="1.1"
style="image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
viewBox="0 0 31.999998 31.999998"
x="0px"
y="0px"
fill-rule="evenodd"
clip-rule="evenodd"
id="svg16"
width="31.999998"
height="31.999998"><metadata
id="metadata20"><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
id="defs4"><style
type="text/css"
id="style2">
.fil0 {fill:black}
</style></defs><g
id="g25"
transform="scale(0.09968847)"><g
id="g10"><path
class="fil0"
d="M 230,80 V 37 h 20 v 60 z m -93,91 h 47 v -38 h -47 z m 0,15 h 47 v 78 h 46 V 151 h 20 V 284 H 72 V 151 h 20 v 113 h 45 z M 161,62 42,162 29,147 161,37 292,147 279,162 Z"
id="path6" /><path
class="fil0"
d="m 82,0 c 52,0 104,0 156,0 46,0 83,37 83,82 0,52 0,104 0,156 0,46 -37,83 -83,83 -52,0 -104,0 -156,0 C 37,321 0,284 0,238 0,186 0,134 0,82 0,37 37,0 82,0 Z m 0,16 c 52,0 104,0 156,0 37,0 66,30 66,66 0,52 0,104 0,156 0,37 -29,66 -66,66 -52,0 -104,0 -156,0 C 46,304 16,275 16,238 16,186 16,134 16,82 16,46 46,16 82,16 Z"
id="path8" /></g></g></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
source/images/icon_16.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

62
source/images/install.svg Normal file
View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
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"
xml:space="preserve"
version="1.1"
style="image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
viewBox="0 0 31.999998 31.999998"
x="0px"
y="0px"
fill-rule="evenodd"
clip-rule="evenodd"
id="svg16"
width="31.999998"
height="31.999998"
sodipodi:docname="install.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="1280"
inkscape:window-height="1006"
id="namedview10"
showgrid="false"
inkscape:zoom="18.185904"
inkscape:cx="27.610641"
inkscape:cy="13.076849"
inkscape:window-x="0"
inkscape:window-y="37"
inkscape:window-maximized="0"
inkscape:current-layer="svg16" /><metadata
id="metadata20"><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
id="defs4"><style
type="text/css"
id="style2">
.fil0 {fill:black}
</style></defs><g
id="g49"><path
class="fil0"
d="m 8.1744545,0 c 5.1838005,0 10.3676005,0 15.5514015,0 4.585669,0 8.274143,3.6884734 8.274143,8.1744545 0,5.1838005 0,10.3676005 0,15.5514015 0,4.585669 -3.688474,8.274143 -8.274143,8.274143 -5.183801,0 -10.367601,0 -15.5514015,0 C 3.6884734,31.999999 0,28.311525 0,23.725856 0,18.542055 0,13.358255 0,8.1744545 0,3.6884734 3.6884734,0 8.1744545,0 Z m 0,1.5950155 c 5.1838005,0 10.3676005,0 15.5514015,0 3.688473,0 6.579439,2.9906541 6.579439,6.579439 0,5.1838005 0,10.3676005 0,15.5514015 0,3.688473 -2.890966,6.579439 -6.579439,6.579439 -5.183801,0 -10.367601,0 -15.5514015,0 -3.5887849,0 -6.579439,-2.890966 -6.579439,-6.579439 0,-5.183801 0,-10.367601 0,-15.5514015 0,-3.5887849 2.9906541,-6.579439 6.579439,-6.579439 z"
id="path8"
style="stroke-width:0.0996885" /><g
id="g6"
transform="matrix(0.31518698,0,0,0.29534593,1.9554552,2.2893253)"><path
d="M 59.309998,55.640045 45,69.070038 30.690002,55.640045 H 10.090027 V 77.029999 H 79.909973 V 55.640045 Z m -40.77002,13.599976 c -1.599976,0 -2.899963,-1.299988 -2.899963,-2.910034 0,-1.599976 1.299987,-2.899964 2.899963,-2.899964 1.610046,0 2.910034,1.299988 2.910034,2.899964 0,1.610046 -1.299988,2.910034 -2.910034,2.910034 z m 9.110046,0 c -1.600036,0 -2.900024,-1.299988 -2.900024,-2.910034 0,-1.599976 1.299988,-2.899964 2.900024,-2.899964 1.599976,0 2.899964,1.299988 2.899964,2.899964 0,1.610046 -1.299988,2.910034 -2.899964,2.910034 z"
id="path2" /><polygon
points="45,63.070038 59.640015,49.329987 59.640015,40.320038 49.619995,49.730011 49.619995,12.970001 40.380005,12.970001 40.380005,49.730011 30.359985,40.320038 30.359985,49.329987 "
id="polygon4" /></g></g></svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

50
source/images/ok.svg Normal file
View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
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.0"
x="0px"
y="0px"
viewBox="0 0 24 24"
enable-background="new 0 0 100 100"
xml:space="preserve"
id="svg10"
width="24"
height="24"
sodipodi:docname="ok.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="namedview8"
showgrid="false"
inkscape:zoom="25.71875"
inkscape:cx="9.0330528"
inkscape:cy="13.975581"
inkscape:window-x="0"
inkscape:window-y="37"
inkscape:window-maximized="1"
inkscape:current-layer="svg10"
inkscape:document-rotation="0" /><metadata
id="metadata16"><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 /></cc:Work></rdf:RDF></metadata><defs
id="defs14" /><g
id="g20"
transform="matrix(0.26666667,0,0,0.26666667,-1.3333334,-1.3333334)"><path
d="M 50,5 C 25.2,5 5,25.2 5,50 5,74.8 25.2,95 50,95 74.8,95 95,74.8 95,50 95,25.2 74.8,5 50,5 Z m 0,80 C 30.7,85 15,69.3 15,50 15,30.7 30.7,15 50,15 69.3,15 85,30.7 85,50 85,69.3 69.3,85 50,85 Z"
id="path2" /><polygon
points="45,67.1 72.1,40 65,32.9 45,52.9 35,42.9 27.9,50 "
id="polygon4" /></g></svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

57
source/images/python.svg Normal file
View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
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.0"
x="0px"
y="0px"
viewBox="0 0 32 32"
enable-background="new 0 0 100 100"
xml:space="preserve"
id="svg12"
sodipodi:docname="python.svg"
width="32"
height="32"
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="namedview9"
showgrid="false"
inkscape:showpageshadow="false"
inkscape:zoom="4.655591"
inkscape:cx="-28.841168"
inkscape:cy="23.577791"
inkscape:window-x="0"
inkscape:window-y="37"
inkscape:window-maximized="1"
inkscape:current-layer="svg12"
inkscape:document-rotation="0" /><metadata
id="metadata18"><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 /></cc:Work></rdf:RDF></metadata><defs
id="defs16" /><g
id="g23"
transform="matrix(0.39999852,0,0,0.39999286,-3.9998495,-3.999893)"><path
d="M 86.674,33.332 H 66.66 V 13.327 c -11.106,-4.604 -23.04,-4.265 -33.334,0 v 20.005 h -20 c -4.603,11.107 -4.264,23.039 0,33.336 h 20 v 20.007 c 11.107,4.603 23.041,4.264 33.334,0 V 66.668 h 20.014 c 4.602,-11.11 4.264,-23.043 0,-33.336 z M 33.326,56.668 v 3.333 H 18.053 c -1.863,-6.563 -1.863,-13.445 0,-20.002 h 31.94 v -6.667 h -10 V 18.055 c 3.255,-0.922 6.614,-1.389 10.02,-1.389 3.391,0 6.732,0.466 9.98,1.387 v 25.28 c 0,1.841 -1.494,3.333 -3.333,3.333 H 43.327 c -5.521,0.001 -10.001,4.478 -10.001,10.002 z m 48.62,3.333 H 49.994 v 6.667 h 10 v 15.279 c -3.255,0.921 -6.611,1.387 -10.019,1.387 -3.389,0 -6.732,-0.466 -9.98,-1.387 V 56.668 c 0,-1.844 1.493,-3.334 3.333,-3.334 H 56.66 c 5.521,0 10,-4.476 10,-10 v -3.335 h 15.286 c 1.863,6.561 1.863,13.442 0,20.002 z"
id="path2" /><circle
cx="48.326"
cy="25"
r="3.3329999"
id="circle4" /><circle
cx="51.659"
cy="75"
r="3.3329999"
id="circle6" /></g></svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
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"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 24 24"
xml:space="preserve"
id="svg12"
width="24"
height="24"><metadata
id="metadata18"><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
id="defs16" /><g
id="g23"
transform="matrix(0.24590164,0,0,0.24590164,-0.3442623,-0.19672131)"><path
d="m 50.2,22.7 c -8,0 -14.6,6.5 -14.6,14.6 0,2.1 1.7,3.7 3.7,3.7 2,0 3.7,-1.7 3.7,-3.7 0,-3.9 3.2,-7.1 7.1,-7.1 4.1,0 7.1,2.9 7.1,6.8 0,0 0,0.1 0,0.3 0,2.2 -0.6,7.4 -7.7,8.5 -1.8,0.3 -3.2,1.8 -3.2,3.7 v 10.1 c 0,2.1 1.7,3.7 3.7,3.7 2,0 3.7,-1.7 3.7,-3.7 V 52.5 C 63.1,49.6 64.6,41.5 64.6,37 64.8,29 58.2,22.7 50.2,22.7 Z"
id="path2" /><path
d="m 50.2,67.8 c -2.7,0 -4.8,2.2 -4.8,4.8 0,2.6 2.2,4.8 4.8,4.8 2.6,0 4.8,-2.2 4.8,-4.8 0,-2.6 -2.2,-4.8 -4.8,-4.8 z"
id="path4" /><path
d="M 50.2,0.8 C 23.3,0.8 1.4,22.7 1.4,49.6 1.4,76.5 23.3,98.4 50.2,98.4 77.1,98.4 99,76.5 99,49.6 99,22.7 77.1,0.8 50.2,0.8 Z m 0,90.2 C 27.4,91 8.8,72.4 8.8,49.6 8.8,26.8 27.4,8.2 50.2,8.2 73,8.2 91.6,26.8 91.6,49.6 91.5,72.4 73,91 50.2,91 Z"
id="path6" /></g></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

41
source/images/search.svg Normal file
View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
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"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 32 32"
xml:space="preserve"
id="svg18"
width="32"
height="32"><metadata
id="metadata24"><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
id="defs22" /><style
type="text/css"
id="style2">
.st0{fill:none;}
</style><g
id="g31"
transform="matrix(1.0666667,0,0,1.0666667,-1.0666667,-1.0666667)"><path
class="st0"
d="m 18.1,13.3 c -0.8,-0.8 -1.8,-1.2 -2.8,-1.2 -1,0 -2,0.4 -2.8,1.2 -0.8,0.8 -1.2,1.8 -1.2,2.8 0,1 0.4,2.1 1.2,2.8 1.5,1.5 4.1,1.5 5.7,0 1.5,-1.5 1.5,-4 -0.1,-5.6 z"
id="path4" /><rect
x="3"
y="3"
class="st0"
width="26"
height="2"
id="rect6" /><path
class="st0"
d="M 3,7 V 29 H 29 V 7 Z M 24.1,26.3 18.8,21 c -1,0.7 -2.2,1.1 -3.5,1.1 -1.6,0 -3.1,-0.6 -4.2,-1.8 -1.1,-1.1 -1.8,-2.6 -1.8,-4.2 0,-1.6 0.6,-3.1 1.8,-4.2 2.3,-2.3 6.1,-2.3 8.5,0 2.1,2.1 2.3,5.4 0.6,7.7 l 5.3,5.3 z"
id="path8" /><path
d="M 1,1 V 31 H 31 V 1 Z M 29,3 V 5 H 3 V 3 Z M 3,29 V 7 h 26 v 22 z"
id="path10" /><path
d="M 19.5,11.9 C 17.2,9.6 13.4,9.6 11,11.9 9.9,13 9.2,14.5 9.2,16.1 c 0,1.6 0.6,3.1 1.8,4.2 1.1,1.1 2.6,1.8 4.2,1.8 1.3,0 2.5,-0.4 3.5,-1.1 l 5.3,5.3 1.4,-1.4 -5.3,-5.3 c 1.7,-2.3 1.5,-5.6 -0.6,-7.7 z m -7,7.1 c -0.8,-0.8 -1.2,-1.8 -1.2,-2.8 0,-1 0.4,-2.1 1.2,-2.8 0.8,-0.8 1.8,-1.2 2.8,-1.2 1,0 2,0.4 2.8,1.2 1.6,1.6 1.6,4.1 0,5.7 -1.5,1.4 -4.1,1.4 -5.6,-0.1 z"
id="path12" /></g></svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

48
source/images/shell.svg Normal file
View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
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"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 32 32"
enable-background="new 0 0 100 100"
xml:space="preserve"
id="svg14"
width="32"
height="32"><metadata
id="metadata20"><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
id="defs18"><rect
x="394.24149"
y="162.41183"
width="82.899773"
height="54.685486"
id="rect30" /></defs><g
id="g45"
transform="matrix(0.41720991,0,0,0.41720991,-124.39114,-55.888818)"><g
id="g26"
transform="translate(285.95002,122.75851)"><path
fill-rule="evenodd"
clip-rule="evenodd"
d="m 28.7,60.4 c -0.7,-0.7 -0.7,-2 0,-2.7 l 8.6,-8.6 c 0.7,-0.7 2,-0.7 2.7,0 0.7,0.7 0.7,2 0,2.7 l -8.6,8.6 c -0.7,0.7 -2,0.7 -2.7,0 z"
id="path2" /><path
fill-rule="evenodd"
clip-rule="evenodd"
d="m 37.3,51.8 -8.6,-8.6 c -0.7,-0.7 -0.7,-2 0,-2.7 0.7,-0.7 2,-0.7 2.7,0 l 8.6,8.6 c 0.7,0.7 0.7,2 0,2.7 -0.7,0.7 -2,0.7 -2.7,0 z"
id="path4" /><path
fill-rule="evenodd"
clip-rule="evenodd"
d="m 47.3,59.1 c 0,-1.1 0.9,-1.9 1.9,-1.9 h 12.1 c 1.1,0 1.9,0.9 1.9,1.9 0,1 -0.8,1.9 -1.8,1.9 H 49.2 c -1,0 -1.9,-0.9 -1.9,-1.9 z"
id="path6" /><path
fill-rule="evenodd"
clip-rule="evenodd"
d="M 85.6,11.2 H 15.4 c -1.8,0 -3.2,1.4 -3.2,3.2 v 70.3 c 0,1.8 1.4,3.2 3.2,3.2 h 70.3 c 1.8,0 3.2,-1.4 3.2,-3.2 V 14.4 c -0.1,-1.8 -1.5,-3.2 -3.3,-3.2 z m -63.8,6.4 c 1.8,0 3.2,1.4 3.2,3.2 0,1.8 -1.4,3.2 -3.2,3.2 -1.8,0 -3.2,-1.4 -3.2,-3.2 0,-1.8 1.4,-3.2 3.2,-3.2 z m 60.6,62.2 c 0,0.9 -0.7,1.6 -1.6,1.6 H 20.2 c -0.9,0 -1.6,-0.7 -1.6,-1.6 V 31.9 c 0,-0.9 0.7,-1.6 1.6,-1.6 h 60.7 c 0.9,0 1.6,0.7 1.6,1.6 v 47.9 z"
id="path8" /></g><text
xml:space="preserve"
id="text28"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;white-space:pre;shape-inside:url(#rect30);fill:#000000;fill-opacity:1;stroke:none;" /></g></svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
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"
xml:space="preserve"
version="1.1"
style="image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
viewBox="0 0 31.999998 31.999998"
x="0px"
y="0px"
fill-rule="evenodd"
clip-rule="evenodd"
id="svg16"
width="31.999998"
height="31.999998"
sodipodi:docname="uninstall.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="1280"
inkscape:window-height="1006"
id="namedview10"
showgrid="false"
inkscape:zoom="18.185904"
inkscape:cx="27.610641"
inkscape:cy="13.076849"
inkscape:window-x="0"
inkscape:window-y="37"
inkscape:window-maximized="0"
inkscape:current-layer="svg16" /><metadata
id="metadata20"><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
id="defs4"><style
type="text/css"
id="style2">
.fil0 {fill:black}
</style></defs><g
id="g60"><path
class="fil0"
d="m 8.1744545,0 c 5.1838005,0 10.3676005,0 15.5514015,0 4.585669,0 8.274143,3.6884734 8.274143,8.1744545 0,5.1838005 0,10.3676005 0,15.5514015 0,4.585669 -3.688474,8.274143 -8.274143,8.274143 -5.183801,0 -10.367601,0 -15.5514015,0 C 3.6884734,31.999999 0,28.311525 0,23.725856 0,18.542055 0,13.358255 0,8.1744545 0,3.6884734 3.6884734,0 8.1744545,0 Z m 0,1.5950155 c 5.1838005,0 10.3676005,0 15.5514015,0 3.688473,0 6.579439,2.9906541 6.579439,6.579439 0,5.1838005 0,10.3676005 0,15.5514015 0,3.688473 -2.890966,6.579439 -6.579439,6.579439 -5.183801,0 -10.367601,0 -15.5514015,0 -3.5887849,0 -6.579439,-2.890966 -6.579439,-6.579439 0,-5.183801 0,-10.367601 0,-15.5514015 0,-3.5887849 2.9906541,-6.579439 6.579439,-6.579439 z"
id="path8"
style="stroke-width:0.0996885" /><path
d="m 20.649194,18.722386 -4.364368,-0.02503 -4.656282,0.02503 H 5.1357003 v 6.317436 H 27.142038 V 18.722386 Z M 7.7990149,22.739084 c -0.5042916,0 -0.9140306,-0.383946 -0.9140306,-0.859467 0,-0.472546 0.409739,-0.856493 0.9140306,-0.856493 0.5074655,0 0.9172048,0.383947 0.9172048,0.856493 0,0.475521 -0.4097393,0.859467 -0.9172048,0.859467 z m 2.8713681,0 c -0.504311,0 -0.91405,-0.383946 -0.91405,-0.859467 0,-0.472546 0.409739,-0.856493 0.91405,-0.856493 0.504291,0 0.914031,0.383947 0.914031,0.856493 0,0.475521 -0.40974,0.859467 -0.914031,0.859467 z"
id="path2"
style="stroke-width:0.305105"
sodipodi:nodetypes="ccccccccssssssssss" /><polygon
points="49.619995,12.970001 40.380005,12.970001 40.380005,49.730011 30.359985,40.320038 30.359985,49.329987 45,63.070038 59.640015,49.329987 59.640015,40.320038 49.619995,49.730011 "
id="polygon4"
transform="matrix(-0.31518698,0,0,-0.27401538,30.322283,21.402123)" /></g></svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
source/images/zazpip.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -85,6 +85,7 @@ from com.sun.star.lang import XEventListener
from com.sun.star.awt import XMouseListener
from com.sun.star.awt import XMouseMotionListener
from com.sun.star.awt import XFocusListener
from com.sun.star.awt import XKeyListener
# ~ https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1awt_1_1FontUnderline.html
from com.sun.star.awt import FontUnderline
@ -184,6 +185,11 @@ DIR = {
'locales': 'locales',
}
DEFAULT_MIME_TYPE = 'png'
KEY = {
'enter': 1280,
}
MODIFIERS = {
'shift': KeyModifier.SHIFT,
'ctrl': KeyModifier.MOD1,
@ -556,8 +562,7 @@ def popen(command):
yield line.decode().rstrip()
except Exception as e:
error(e)
msg = f'Error No: {e.errno} - {e.strerror}'
yield msg
yield (e.errno, e.strerror)
def sleep(seconds):
@ -1154,6 +1159,64 @@ class LODocument(object):
return
class LOCellStyle(LOBaseObject):
def __init__(self, obj):
super().__init__(obj)
@property
def name(self):
return self.obj.Name
@property
def properties(self):
properties = self.obj.PropertySetInfo.Properties
data = {p.Name: getattr(self.obj, p.Name) for p in properties}
return data
@properties.setter
def properties(self, values):
_set_properties(self.obj, values)
class LOCellStyles(object):
def __init__(self, obj, doc):
self._obj = obj
self._doc = doc
def __len__(self):
return len(self.obj)
def __getitem__(self, index):
return LOCellStyle(self.obj[index])
def __setitem__(self, key, value):
self.obj[key] = value
def __delitem__(self, key):
if not isinstance(key, str):
key = key.Name
del self.obj[key]
def __contains__(self, item):
return item in self.obj
@property
def obj(self):
return self._obj
@property
def names(self):
return self.obj.ElementNames
def new(self, name: str=''):
obj = self._doc.create_instance('com.sun.star.style.CellStyle')
if name:
self.obj[name] = obj
obj = LOCellStyle(obj)
return obj
class LOCalc(LODocument):
def __init__(self, obj):
@ -1209,6 +1272,14 @@ class LOCalc(LODocument):
def tabs(self, value):
self._cc.SheetTabs = value
@property
def cs(self):
return self.cell_styles
@property
def cell_styles(self):
obj = self.obj.StyleFamilies['CellStyles']
return LOCellStyles(obj, self)
@property
def db_ranges(self):
# ~ return LOCalcDataBaseRanges(self.obj.DataBaseRanges)
@ -2122,6 +2193,18 @@ class LOWriterTextRange(object):
self._is_paragraph = self.obj.ImplementationName == 'SwXParagraph'
self._is_table = self.obj.ImplementationName == 'SwXTextTable'
def __iter__(self):
self._index = 0
return self
def __next__(self):
for i, p in enumerate(self.obj):
if i == self._index:
obj = LOWriterTextRange(p, self._doc)
self._index += 1
return obj
raise StopIteration
@property
def obj(self):
return self._obj
@ -2143,7 +2226,7 @@ class LOWriterTextRange(object):
@property
def text(self):
return self.obj.getText()
return self.obj.Text
@property
def cursor(self):
@ -2153,6 +2236,10 @@ class LOWriterTextRange(object):
def dp(self):
return self._doc.dp
@property
def is_table(self):
return self._is_table
def offset(self):
cursor = self.cursor.getEnd()
return LOWriterTextRange(cursor, self._doc)
@ -2182,7 +2269,23 @@ class LOWriterTextRanges(object):
self._doc = doc
def __getitem__(self, index):
return LOWriterTextRange(self.obj[index], self._doc)
for i, p in enumerate(self.obj):
if i == index:
obj = LOWriterTextRange(p, self._doc)
break
return obj
def __iter__(self):
self._index = 0
return self
def __next__(self):
for i, p in enumerate(self.obj):
if i == self._index:
obj = LOWriterTextRange(p, self._doc)
self._index += 1
return obj
raise StopIteration
@property
def obj(self):
@ -2195,6 +2298,14 @@ class LOWriter(LODocument):
super().__init__(obj)
self._type = WRITER
@property
def text(self):
return LOWriterTextRange(self.obj.Text, self)
@property
def paragraphs(self):
return LOWriterTextRanges(self.obj.Text, self)
@property
def selection(self):
sel = self.obj.CurrentSelection
@ -2842,7 +2953,7 @@ def _add_listeners(events, control, name=''):
'addMouseListener': EventsMouse,
'addFocusListener': EventsFocus,
# ~ 'addItemListener': EventsItem,
# ~ 'addKeyListener': EventsKey,
'addKeyListener': EventsKey,
# ~ 'addTabListener': EventsTab,
}
if hasattr(control, 'obj'):
@ -2985,6 +3096,27 @@ class EventsFocus(EventsListenerBase, XFocusListener):
return
class EventsKey(EventsListenerBase, XKeyListener):
"""
event.KeyChar
event.KeyCode
event.KeyFunc
event.Modifiers
"""
def __init__(self, controller, name):
super().__init__(controller, name)
def keyPressed(self, event):
pass
def keyReleased(self, event):
event_name = '{}_key_released'.format(self._name)
if hasattr(self._controller, event_name):
getattr(self._controller, event_name)(event)
return
# ~ BorderColor = ?
# ~ FontStyleName = ?
# ~ HelpURL = ?

View File

@ -11,20 +11,21 @@ TITLE = 'ZAZ-PIP'
URL_PIP = 'https://bootstrap.pypa.io/get-pip.py'
PIP = 'pip'
URL_GIT = 'https://git.elmau.net/elmau'
ICON_OK = 'ok.svg'
ICON_QUESTION = 'question.svg'
PACKAGES = {
'cffi': 'ok.png',
'cryptography': 'ok.png',
'httpx': 'ok.png',
'lxml': 'ok.png',
'numpy': 'ok.png',
'pandas': 'ok.png',
'psycopg2-binary': 'ok.png',
'peewee': 'ok.png',
'pillow': 'ok.png',
'pytesseract': 'ok.png',
'sounddevice': 'ok.png',
'cffi': ICON_OK,
'cryptography': ICON_OK,
'httpx': ICON_OK,
'lxml': ICON_OK,
'numpy': ICON_OK,
'pandas': ICON_OK,
'psycopg2-binary': ICON_OK,
'peewee': ICON_OK,
'pillow': ICON_OK,
'pytesseract': ICON_OK,
'sounddevice': ICON_OK,
}
@ -75,7 +76,6 @@ class Controllers(object):
path_pip = app.paths.tmp()
self.d.lst_log.insert(_('Download PIP...'))
data, h, err = app.url_open(URL_PIP, verify=False)
app.msgbox(path_pip)
if err:
msg = _('Do you have internet connection?')
app.errorbox('{}\n\n{}'.format(msg, err))
@ -155,7 +155,7 @@ class Controllers(object):
for p in packages:
t = '{} - ({})'.format(p['name'], p['version'])
self.d.lst_package.insert(t, 'ok.png')
self.d.lst_package.insert(t, ICON_OK)
self.d.lst_package.select()
self.d.txt_search.set_focus()
return
@ -173,7 +173,7 @@ class Controllers(object):
parts = name.split('(')
name_verify = parts[0].strip()
package = '{} {}'.format(name, description)
image = PACKAGES.get(name_verify, 'question.png')
image = PACKAGES.get(name_verify, ICON_QUESTION)
self.d.lst_package.insert(package, image)
if line:
@ -191,6 +191,21 @@ class Controllers(object):
self._search(search)
return
def cmd_install_action(self, event):
name = self.d.txt_search.value.strip()
if not name:
msg = _('Enter package name to install')
app.warning(msg)
self.d.txt_search.set_focus()
return
msg = _(f'Install package: {name} ?')
if not app.question(msg):
return
self._install(name)
return
@app.run_in_thread
def _install(self, value):
self._set_state('install')
@ -301,7 +316,6 @@ def _create_dialog():
path_python = app.paths.python
cmd = '"{}" -V'.format(path_python)
app.msgbox(cmd)
label = app.run(cmd, True)
args = {
@ -320,9 +334,7 @@ def _create_dialog():
dialog.center(dialog.lbl_python, y=25)
cmd = '"{}" -m pip -V'.format(path_python)
app.msgbox(cmd)
label = app.run(cmd, True)
app.msgbox(label)
exists_pip = True
if not label:
exists_pip = False
@ -349,7 +361,7 @@ def _create_dialog():
'Width': 70,
'Height': BUTTON_WH,
'Step': 10,
'ImageURL': 'python.png',
'ImageURL': 'python.svg',
'ImagePosition': 1,
}
dialog.add_control(args)
@ -432,7 +444,7 @@ def _create_dialog():
'Width': 70,
'Height': BUTTON_WH,
'Step': 1,
'ImageURL': 'close.png',
'ImageURL': 'close.svg',
'ImagePosition': 1,
# ~ 'PushButtonType': 2,
}
@ -445,7 +457,7 @@ def _create_dialog():
'Width': BUTTON_WH,
'Height': BUTTON_WH,
'Step': 1,
'ImageURL': 'home.png',
'ImageURL': 'home.svg',
'FocusOnClick': False,
'Y': 2,
}
@ -457,7 +469,7 @@ def _create_dialog():
'Width': BUTTON_WH,
'Height': BUTTON_WH,
'Step': 1,
'ImageURL': 'search.png',
'ImageURL': 'search.svg',
'FocusOnClick': False,
'Y': 2,
}
@ -469,7 +481,7 @@ def _create_dialog():
'Width': BUTTON_WH,
'Height': BUTTON_WH,
'Step': 1,
'ImageURL': 'uninstall.png',
'ImageURL': 'uninstall.svg',
'FocusOnClick': False,
'Y': 2,
}
@ -481,7 +493,7 @@ def _create_dialog():
'Width': BUTTON_WH,
'Height': BUTTON_WH,
'Step': 1,
'ImageURL': 'install.png',
'ImageURL': 'install.svg',
'FocusOnClick': False,
'Y': 2,
}
@ -493,7 +505,7 @@ def _create_dialog():
'Width': BUTTON_WH,
'Height': BUTTON_WH,
'Step': 1,
'ImageURL': 'shell.png',
'ImageURL': 'shell.svg',
'FocusOnClick': False,
'Y': 2,
}