Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG paths #75

Open
drnextgis opened this issue May 16, 2019 · 5 comments
Open

SVG paths #75

drnextgis opened this issue May 16, 2019 · 5 comments

Comments

@drnextgis
Copy link
Member

drnextgis commented May 16, 2019

It seems like looking up of SVG icons in custom paths doesn't work in nextgisqgis. I've discovered it while working with nextgisweb. Here we add paths to list of paths where QGIS should be able to search SVGs https://github.com/nextgis/nextgisweb_qgis/blob/ffce27d0055f5344907f29681021597f313e1405/nextgisweb_qgis/__init__.py#L81-L89. It works in official QGIS but not in nextgisqgis. The one way I was able to overcome this issue is to create /ngw/management/env/share/ngqgis/svg/ directory and put icons there.

@BishopGIS
Copy link
Member

On MacOS not reproduced.

>>> from qgis.core import QgsApplication
>>> qgis = QgsApplication([], False)
>>> qgis.svgPaths()
[u'/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Applications/qgis-ng.app/Contents/Resources/svg/', u'/Users/Bishop/.qgis2//svg/']
>>> qgis.setDefaultSvgPaths(qgis.svgPaths() + ['/svgpaths'])
>>> qgis.svgPaths()
[u'/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Applications/qgis-ng.app/Contents/Resources/svg/', u'/Users/Bishop/.qgis2//svg/', u'/svgpaths']
>>> from qgis.PyQt.QtCore import QSettings
>>> QSettings().value( 'svg/searchPathsForSVG' )
>>> QSettings().setValue( 'svg/searchPathsForSVG', '/svgpaths2' )
>>> qgis.svgPaths()
[u'/svgpaths2', u'/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Applications/qgis-ng.app/Contents/Resources/svg/', u'/Users/Bishop/.qgis2//svg/', u'/svgpaths']
>>>

Let me test on ubuntu.

@BishopGIS
Copy link
Member

On ubuntu:

>>> from qgis.core import QgsApplication
>>> qgis = QgsApplication([], False)
>>> qgis.svgPaths()
[u'/usr/share/ngqgis/svg/', u'/opt/ngw/.qgis2//svg/']
>>> qgis.setDefaultSvgPaths(qgis.svgPaths() + ['/svgpaths'])
>>> qgis.svgPaths()
[u'/usr/share/ngqgis/svg/', u'/opt/ngw/.qgis2//svg/', u'/svgpaths']
>>> from qgis.PyQt.QtCore import QSettings
>>> QSettings().value( 'svg/searchPathsForSVG' )
>>> QSettings().setValue( 'svg/searchPathsForSVG', '/svgpaths2' )
>>> qgis.svgPaths()
[u'/svgpaths2', u'/usr/share/ngqgis/svg/', u'/opt/ngw/.qgis2//svg/', u'/svgpaths']
>>>
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.2 LTS
Release:	18.04
Codename:	bionic

@drnextgis
Copy link
Member Author

drnextgis commented May 16, 2019

I can confirm, that this list populates as expected but QGIS doesn't take into account some of these paths. @BishopGIS try to render an image programmatically using custom SVGs.

@BishopGIS
Copy link
Member

BishopGIS commented May 16, 2019

Can you check the second case to set custom svg path:

>>> QSettings().setValue( 'svg/searchPathsForSVG', '/svgpaths2' )
>>> qgis.svgPaths()
[u'/svgpaths2', u'/usr/share/ngqgis/svg/', u'/opt/ngw/.qgis2//svg/', u'/svgpaths']

It this not working too?

For first case I think I found out the root of problem.

@BishopGIS
Copy link
Member

Default svg icons path /usr/share/ngqgis/svg/ also works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants