[QGIS-Developer] Plugin Manager looks for icon in http://

Borys Jurgiel lists at borysjurgiel.pl
Fri Sep 13 03:02:10 PDT 2019


Initially, the manager was only supporting http:// repositories. Then we added 
support for local ones, and we apparently missed the fact the icon protocol is 
hardcoded instead of following the "main" protocol. See:

https://github.com/qgis/QGIS/blob/master/python/pyplugin_installer/
installer_data.py#L411

Would you mind to fix it by yourself and make a pull request? Otherwise I can 
do it but probably not in the upcoming days or weeks.

From what I tested so far, it seems for the file:// protocol rather than 
adding the protocol prefix, the icon variable should stay as it was (just the 
path). I didn't succeeded to make it working with the prefix. So maybe the 
prefix should be only added to the http and https protocols. Something like:

if icon and not icon.startswith("http"):
    if QUrl(self.mRepositories[reposName]["url"]).scheme() == 'http':
        icon = "http://{}/{}".format(
			QUrl(self.mRepositories[reposName]["url"]).host(), icon)
    elif QUrl(self.mRepositories[reposName]["url"]).scheme() == 'https':
       icon = "https://{}/{}".format(
          QUrl(self.mRepositories[reposName]["url"]).host(), icon)


It's been tested on Linux, but needs a test on Windows, as there is usually a 
difference in the number of expected slashes at the beginning of the path ;)

Btw. if you want to see the plugin metadata sent from the installer (Python 
backend) to the manager (C++ GUI), you can catch it here:

https://github.com/qgis/QGIS/blob/master/python/pyplugin_installer/
installer.py#L197

Regards,
Borys


Dnia piątek, 13 września 2019 10:53:47 CEST VOLPES-EXT, Jacky pisze:
> Dear all,
> 
> I have a local repository for my plugins, with the icon path for each plugin
> in the corresponding tag of the xml.
> 
> Example :
> 
> <?xml version='1.0' encoding='UTF-8'?>
> <?xml-stylesheet  type="text/xsl" href="./plugins.xsl" ?>
> <plugins>
>   <pyqgis_plugin name="my great plugin" version="1.2">
>     [...]
>     <icon>icons/my_great_plugin/icon.png</icon>
>     [...]
>   </pyqgis_plugin>
> </plugins>
> 
> The problem is that the Plugin Manager is looking for the path
> http://icons/my_great_plugin/icon.png when the plugin is not yet installed.
> I can force my deployment script to write an absolute path in the <icon>
> tag, with the file:// protocol, but then the Plugin Manager looks for
> http://file://C:/my_abs_path/icons/my_great_plugin/icon.png<http://file:/C:
> /my_abs_path/icons/my_great_plugin/icon.png>
> 
> When the plugin is installed, everything works good.
> Any idea ?
> 
> Thanks a lot,
> Best regards
> 
> Jacky Volpes
> HR Team pour la Société du Canal de Provence | 2SI - QGIS
> Le Tholonet, CS70064
> jacky.volpes-ext at canal-de-provence.com<mailto:jacky.volpes-ext at canal-de-prov
> ence.com>






More information about the QGIS-Developer mailing list