[QGIS-Developer] Converting plugins to QGIS 3

C Hamilton adenaculture at gmail.com
Wed May 10 11:03:23 PDT 2017


I am wondering how important it is to import the modules separately. Such
as:

from qgis.core import QGis, QgsCoordinateTransform, QgsRectangle, QgsPoint,
QgsGeometry

Does it really make a difference? I am finding that you have to make sure
every part of your code is exercised so that nothing was missed. By doing
the above there is more of a chance to have a bug. Perhaps for PyQt4.QtGui
it makes sense, but there is less chance to have a python error if you keep.

from qgis.core import *
from PyQt4.QtGui import *
from qgis.gui import *

Thoughts?

Thanks,

Calvin



On Wed, May 10, 2017 at 12:00 PM, Luigi Pirelli <luipir at gmail.com> wrote:

> this is a slide about plugin porting I'll be presenting to the next
> spanish foss4g:
> http://slides.com/luigipirelli/desdarrolloplugindeqgis-xi-girona#/17
> sorry it's in spanish
>
> about
>
> from PyQt4 import QtGui
>
> or
>
> from PyQt4.QtGui import QDialog
>
> I would prefer the second so to avoid to postpone lib version errors
> at pyc time and not at runtime.
> it make it simpler to mock or alias a class globally if you need
>
> regards
> Luigi Pirelli
>
> ************************************************************
> **************************************
> * Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
> * LinkedIn: https://www.linkedin.com/in/luigipirelli
> * Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
> * GitHub: https://github.com/luipir
> * Mastering QGIS 2nd Edition:
> * https://www.packtpub.com/big-data-and-business-
> intelligence/mastering-qgis-second-edition
> ************************************************************
> **************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170510/e5814522/attachment.html>


More information about the QGIS-Developer mailing list