Use of QtWebKit in plugin

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Use of QtWebKit in plugin

kjoller
Hi all

I have been trying to fix a bug in the "Kortforsyningen" plugin for QGIS, which exists in Ubuntu 17.04 and Debian stretch (and probably other newer debian based systems), due to QtWebKit not being included in PyQt4

https://github.com/Kortforsyningen/Qgis_plugin_Kortforsyningen/issues/27

The basic trouble is:
ImportError: No module named QtWebKit.QWebView

I have narrowed it down to the the (rather complex) 'About' dialog, where

uic.loadUiType(
    os.path.join(os.path.dirname(__file__), 'aboutKortforsyningen.ui')
)

tries to run a piece of code ending with the line

from QtWebkit.QWebView import QWebView

where on my working (16.04) system, it ends with

from PyQt4 import QtWebKit

I can solve this problem, by putting qtwebkit.py from the PyQt4 source code into /usr/lib/python2.7/dist-packages/PyQt4/uic/widget-plugins.

My question boils down to:

What is the 'best' way of solving this in other peoples systems? I have looked at three scenarios:

* Switching to a simpler about dialog in case of QtWebkit-errors (a hacky try,except)
* Precompiling the UI on a working system before uploading(1)
* Begging to get the widget-plugin file included in the .deb-package on qgis.org
* ?

Thanks,
Niels

(1) When I try to use pyuic4 -o aboutKortforsyningen.py aboutKortforsyningen.ui -d on my working system, I get

ValueError: API 'QDate' has already been set to version 1

which I can solve buy adding sip.setapi(....) to the start of pyuic4, but is this can't be the way to do it, can it?

Reply | Threaded
Open this post in threaded view
|

Re: Use of QtWebKit in plugin

Jürgen E. Fischer
Hi Niels,

On Mon, 19. Jun 2017 at 04:48:07 -0700, kjoller wrote:
> I have been trying to fix a bug in the "Kortforsyningen" plugin for QGIS,
> which exists in Ubuntu 17.04 and Debian stretch (and probably other newer
> debian based systems), due to QtWebKit not being included in PyQt4

It should be included as internal bindings in python-qgis for unstable,
stretch, yakkety and zesty.

/usr/lib/python2.7/dist-packages/PyQt4/QtWebKit.(i386|x86_64)-linux-gnu.so


Jürgen

--
Jürgen E. Fischer           norBIT GmbH             Tel. +49-4931-918175-31
Dipl.-Inf. (FH)             Rheinstraße 13          Fax. +49-4931-918175-50
Software Engineer           D-26506 Norden             http://www.norbit.de
QGIS release manager (PSC)  Germany                    IRC: jef on FreeNode

_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

signature.asc (844 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Use of QtWebKit in plugin

kjoller
Hi Jürgen

2017-06-19 14:18 GMT+02:00 Jürgen E. Fischer <[hidden email]>:
Hi Niels,

On Mon, 19. Jun 2017 at 04:48:07 -0700, kjoller wrote:
> I have been trying to fix a bug in the "Kortforsyningen" plugin for QGIS,
> which exists in Ubuntu 17.04 and Debian stretch (and probably other newer
> debian based systems), due to QtWebKit not being included in PyQt4

It should be included as internal bindings in python-qgis for unstable,
stretch, yakkety and zesty.

/usr/lib/python2.7/dist-packages/PyQt4/QtWebKit.(i386|x86_64)-linux-gnu.so


You are correct that the QtWebkit itself is included, but as far as I can se, the "definition"-file for pyuic4 is not, as far as I can tell.

/usr/lib/python2.7/dist-packages/PyQt4/uic/widget-plugins/qtwebkit.py

It is a simple file, and stripped for comments it looks like this:

pluginType = MODULE
def moduleInformation():
    return "PyQt4.QtWebKit", ("QWebView", )


_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Use of QtWebKit in plugin

Jürgen E. Fischer
Hi Niels,

On Mon, 19. Jun 2017 at 14:29:52 +0200, Niels Kjøller Hansen wrote:
> /usr/lib/python2.7/dist-packages/PyQt4/uic/widget-plugins/qtwebkit.py
>
> It is a simple file, and stripped for comments it looks like this:
>
> pluginType = MODULE
> def moduleInformation():
>     return "PyQt4.QtWebKit", ("QWebView", )


Should be fixed in c39e4fcecd630655175ac996c617020357a0c065.


Jürgen

--
Jürgen E. Fischer           norBIT GmbH             Tel. +49-4931-918175-31
Dipl.-Inf. (FH)             Rheinstraße 13          Fax. +49-4931-918175-50
Software Engineer           D-26506 Norden             http://www.norbit.de
QGIS release manager (PSC)  Germany                    IRC: jef on FreeNode

_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

signature.asc (844 bytes) Download Attachment