[QGIS-Developer] Group stats plugin from 2to3

Sylvain POULAIN sylvain.poulain at giscan.com
Wed Feb 28 10:38:18 PST 2018


Thanks Chistophe and Etienne. Useful links. 

What I did is : 

- adding in groupstats.py : from PyQt5.QtWidgets import QAction,
QMessageBox
- Change QgsMapLayerRegistry to QgsProject
- adding in GroupStatsDialog.py : from PyQt5.QtWidgets import
QMainWindow, QTableView, QWidget

I could clic on icon now without vector loaded but stop on it : 

warstwy.sort(lambda x,y: cmp(x[0].lower(),y[0].lower()))
TypeError: must use keyword argument for key function 

I have to check python3 lambda and cmp usage ... But even with that,
variables in code are difficult to handle due to polish language. 

Le 2018-02-28 16:58, Etienne Trimaille a écrit :

> You can follow these steps: https://github.com/qgis/QGIS/wiki/Plugin-migration-to-QGIS-3 
> 
> Don't change from PyQt4 to PyQt5, you can switch to "from qgis.PyQt.QtWidgets import QMainWindow" or similar import. 
> 
> 2018-02-28 15:53 GMT+03:00 SIGéal <sigeal at sigeal.com>:
> 
> Hi,
> 
> A look at this might help :
> https://gis.stackexchange.com/questions/260125/make-qgis-python-plugin-for-both-versions-2-x-and-3-x [2]
> 
> -- 
> Christophe
> 
> Le 28/02/2018 à 12:31, Sylvain POULAIN a écrit : 
> 
> Hi, 
> 
> I tried to migrate from plugins in Qgis 2 to Qgis 3. 
> I took the usefull group stats plugin as my main example to make transition. 
> 
> Unfortunatelly, _Plugin home page_ and _tracker_ links for this plugins are dead ( http://plugins.qgis.org/plugins/GroupStats/ [3] ), my apologies if I'm not posting in right place. 
> 
> So I downloaded plugin and tried to converted it with changing Qt4 to Qt5 in py script, using 2to3, rebuilding with pyuic5 and pyrcc5 under linux. But now I'm stuck on a QMainWindow error. Where could I have help to solve and understand how to solve it ? 
> 
> Sincerely, 
> 
> Sylvain 
> 
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer [1]
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer [1]
> 
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer [1]
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer [1]

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

Links:
------
[1] https://lists.osgeo.org/mailman/listinfo/qgis-developer
[2]
https://gis.stackexchange.com/questions/260125/make-qgis-python-plugin-for-both-versions-2-x-and-3-x
[3] http://plugins.qgis.org/plugins/GroupStats/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180228/eccf3c2c/attachment.html>


More information about the QGIS-Developer mailing list