[QGIS-Developer] native:package processing alg code

2024-10-14 Thread PIERRE Sylvain via QGIS-Developer
I devs,

I don't find native:package processing alg code in my qgis install.

Where Is it located ?

Thanks


[cid:image001.jpg@01DB1E29.C6517080]
Sylvain PIERRE
Chef de projet système d'information
Direction des Systèmes d'Information et du Développement Numérique
Service Projets et Ingénierie Numérique
Collectivité européenne d'Alsace
Tél : 03 88 76 68 88
sylvain.pie...@alsace.eu
www.alsace.eu
[facebook] [twitter] 
  [insta] 


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


[QGIS-Developer] lack of conflation tools

2024-05-30 Thread PIERRE Sylvain via QGIS-Developer
Hi devs and  qgis power users,

After investigating I can arg that there's a lack of conflation tools in QGIS 
like such existing for Esri  :

https://proceedings.esri.com/library/userconf/proc17/tech-workshops/tw_513-105.pdf


Is there some plan or something I miss for doing such task in QGIS ?

Thanks


[cid:image001.jpg@01DAB287.134C7D80]
Sylvain PIERRE
Chef de projet système d'information
Direction des Systèmes d'Information et du Développement Numérique
Service Projets et Ingénierie Numérique
Collectivité européenne d'Alsace
Tél : 03 88 76 68 88
sylvain.pie...@alsace.eu
www.alsace.eu
[facebook] [twitter] 
  [insta] 


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


[QGIS-Developer] wrong VRT layer extent

2023-11-23 Thread PIERRE Sylvain via QGIS-Developer
Hi,

Trying to simply export VRT layer , getting a wrong extent and exporting only 
extent of first raster part of VRT with this code :

  list_dalles = []

features = layer.selectedFeatures()
for f in features:
file_name = f['NOM_DALLE']+'.tif'
dir_name = f['repertoire']
full_file_name = os.path.join( dir_name, file_name)

if os.path.isfile(full_file_name):
list_dalles.append(full_file_name)

parameters = { 'ADD_ALPHA' : False,
'ASSIGN_CRS' : None,
'EXTRA' : '',
'INPUT' : list_dalles,
'OUTPUT' : outVRTfile,
'PROJ_DIFFERENCE' : False,
'RESAMPLING' : 0,
'RESOLUTION' : 0,
'SEPARATE' : False,
'SRC_NODATA' : '' }

#processing.runAndLoadResults("gdal:buildvirtualraster", parameters)
processing.run("gdal:buildvirtualraster", parameters)

vrtLayer = QgsRasterLayer(full_file_name, "bidon")

QgsProject.instance().addMapLayer(vrtLayer, True)

file_writer = QgsRasterFileWriter(outfile)
provider = vrtLayer.dataProvider()
pipe = QgsRasterPipe()

if not pipe.set(provider.clone()):
print ("Cannot set pipe provider")

print(str(provider.extent()))
file_writer.writeRaster(
pipe,
provider.xSize(),
provider.ySize(),
provider.extent(),
provider.crs())

I don't find anything about that, any idea ?

Thanks

[cid:image001.jpg@01DA1E31.806E1620]
Sylvain PIERRE
Chef de projet système d'information
Direction des Systèmes d'Information et du Développement Numérique
Service Projets et Ingénierie Numérique
Collectivité européenne d'Alsace
Tél : 03 88 76 68 88
sylvain.pie...@alsace.eu
www.alsace.eu
[facebook] [twitter] 
  [insta] 


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


Re: [QGIS-Developer] Pyqgis how to append existing gpkg layer

2023-04-20 Thread PIERRE Sylvain via QGIS-Developer
Hi Germán,

options.actionOnExistingFile = QgsVectorFileWriter.AppendToLayerNoNewFields

Was the key. Thanks !



[cid:image001.jpg@01D97369.4FF99FA0]
Sylvain PIERRE
Chef de projet système d’information
Direction des Systèmes d’Information et du Développement Numérique
Service Projets et Ingénierie Numérique
Collectivité européenne d’Alsace
Tél : 03 88 76 68 88
sylvain.pie...@alsace.eu<mailto:sylvain.pie...@alsace.eu>
www.alsace.eu<http://www.alsace.eu>
[facebook]<http://www.facebook.com/toutelalsace> [twitter] 
<http://www.twitter.com/toutelalsace>  [insta] 
<http://www.instagram.com/toutelalsace>

De : Germán Carrillo 
Envoyé : mercredi 19 avril 2023 17:16
À : PIERRE Sylvain 
Cc : qgis-u...@lists.osgeo.org; qgis-developer@lists.osgeo.org
Objet : Re: [QGIS-Developer] Pyqgis how to append existing gpkg layer

Soyez vigilant : ce courriel provient d'une organisation externe à la CeA.
• Assurez-vous d’abord qu’il ne s’agit pas d’un email malveillant avant de 
cliquer sur tout lien ou pièce jointe.
Apprendre à reconnaître un email de 
phishing.<https://intranet.alsace.eu/actualites/apprenez-a-reconnaitre-un-email-phishing/>
Bonjour Sylvain,

J'espère que vous allez bien.


If you want to append features from a source layer to another layer that 
already exists in a GPKG file, you can do this:

-
options = QgsVectorFileWriter.SaveVectorOptions()
options.driverName = "GPKG"
options.layerName = "my_existing_layer_name"  # Write here the existing layer 
name in the GPKG
options.actionOnExistingFile = QgsVectorFileWriter.AppendToLayerNoNewFields
options.onlySelectedFeatures = True

path = "/tmp/existing_gpkg_file_path.gpkg"
layer = QgsVectorLayer("/tmp/my_source_layer.shp", "my source layer name", 
"ogr")

result = QgsVectorFileWriter.writeAsVectorFormatV3(
layer,
path,  # Existing GPKG file path
layer.transformContext(),
options)
-


If on the contrary, you want to append a whole layer (with its own field 
structure, crs, etc.) to an existing GPKG database, you can follow this 
solution:

https://gis.stackexchange.com/a/417950


As you can see, the key is to define the options.actionOnExistingFile property, 
whose possible values are well documented here:

https://api.qgis.org/api/3.28/classQgsVectorFileWriter.html#afda86eff21ac1da7dc42cbdde424acb1


Note: SInce we're using writeAsVectorFormatV3(), you need at least QGIS v3.20 
for this solution to work.


Regards,

Germán



El mié, 19 abr 2023 a las 3:55, PIERRE Sylvain via QGIS-Developer 
(mailto:qgis-developer@lists.osgeo.org>>) 
escribió:
Hi dev and users

I don’t understand how to append an existing gpkg layer with pyqgis.
I’ve tried many QgsVectorFileWriter options

self.options.actionOnExistingFile = QgsVectorFileWriter.CreateOrOverwriteLayer

reset final layer

And
self.options.EditionCapability = QgsVectorFileWriter.CanAppendToExistingLayer

does not change anything

So what’s the good way to do this ?

This is my code (I’m iterating over several other data sources)
self.options = QgsVectorFileWriter.SaveVectorOptions()
self.options.driverName = 'GPKG'
self.options.onlySelectedFeatures = True
self.options.layerName = 'parcelles'

for dir in dirs:
print(dir)

if os.path.isdir(dir):
db_GPKG = os.path.join(dir, 'MAEC2023.gpkg')
if os.path.exists(db_GPKG):
gpkg_layer = db_GPKG + "|layername=parcelles"
RPG_layer = QgsVectorLayer(gpkg_layer, "RPG", "ogr")

expr = (' "fk_mesure" is not null ')
#expr = ('"fk_mesure" = \'{}\'').format('MAEC Papillons')

RPG_layer.selectByExpression(expr)
selected_feature = RPG_layer.selectedFeatures()
print(len(selected_feature))
if os.path.exists(self.db_GPKG): # if the ouput file 
already exist
self.options.actionOnExistingFile = 
QgsVectorFileWriter.CreateOrOverwriteLayer
#self.options.actionOnExistingFile = 
QgsVectorFileWriter.AppendToLayerNoNewFields
#self.options.actionOnExistingFile = 
QgsVectorFileWriter.AppendToLayerAddFields
self.options.EditionCapability = 
QgsVectorFileWriter.CanAppendToExistingLayer
else:
self.options.actionOnExistingFile = 
QgsVectorFileWriter.CreateOrOverwriteFile

write_result, error_message = 
QgsVectorFileWriter.writeAsVectorFormatV2(RPG_

[QGIS-Developer] Pyqgis how to append existing gpkg layer

2023-04-19 Thread PIERRE Sylvain via QGIS-Developer
Hi dev and users

I don't understand how to append an existing gpkg layer with pyqgis.
I've tried many QgsVectorFileWriter options

self.options.actionOnExistingFile = QgsVectorFileWriter.CreateOrOverwriteLayer

reset final layer

And
self.options.EditionCapability = QgsVectorFileWriter.CanAppendToExistingLayer

does not change anything

So what's the good way to do this ?

This is my code (I'm iterating over several other data sources)
self.options = QgsVectorFileWriter.SaveVectorOptions()
self.options.driverName = 'GPKG'
self.options.onlySelectedFeatures = True
self.options.layerName = 'parcelles'

for dir in dirs:
print(dir)

if os.path.isdir(dir):
db_GPKG = os.path.join(dir, 'MAEC2023.gpkg')
if os.path.exists(db_GPKG):
gpkg_layer = db_GPKG + "|layername=parcelles"
RPG_layer = QgsVectorLayer(gpkg_layer, "RPG", "ogr")

expr = (' "fk_mesure" is not null ')
#expr = ('"fk_mesure" = \'{}\'').format('MAEC Papillons')

RPG_layer.selectByExpression(expr)
selected_feature = RPG_layer.selectedFeatures()
print(len(selected_feature))
if os.path.exists(self.db_GPKG): # if the ouput file 
already exist
self.options.actionOnExistingFile = 
QgsVectorFileWriter.CreateOrOverwriteLayer
#self.options.actionOnExistingFile = 
QgsVectorFileWriter.AppendToLayerNoNewFields
#self.options.actionOnExistingFile = 
QgsVectorFileWriter.AppendToLayerAddFields
self.options.EditionCapability = 
QgsVectorFileWriter.CanAppendToExistingLayer
else:
self.options.actionOnExistingFile = 
QgsVectorFileWriter.CreateOrOverwriteFile

write_result, error_message = 
QgsVectorFileWriter.writeAsVectorFormatV2(RPG_layer, self.db_GPKG , 
self.context, self.options)



Thanks


[cid:image001.jpg@01D972AD.7D49D680]
Sylvain PIERRE
Chef de projet système d'information
Direction des Systèmes d'Information et du Développement Numérique
Service Projets et Ingénierie Numérique
Collectivité européenne d'Alsace
Tél : 03 88 76 68 88
sylvain.pie...@alsace.eu
www.alsace.eu
[facebook] [twitter] 
  [insta] 


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


Re: [QGIS-Developer] Pyqgis Close init form

2022-12-20 Thread PIERRE Sylvain via QGIS-Developer
When adding a new feature (polygon) I would like to close form when centroid 
does not intersect a polygon from an other layer
Here is my full python init form dialog function:

# -*- coding: utf8 -*-
from qgis.core import QgsVectorLayer, QgsFeatureRequest, QgsRectangle, 
QgsGeometry, QgsProject, QgsPointXY
import qgis.utils
from PyQt5.QtWidgets  import QDialogButtonBox, QLineEdit, QComboBox
from PyQt5.QtCore import QObject
import os.path
import getpass

def dealWithPoly(dialog, layerid, featureid):

global editMode
global iface

iface = qgis.utils.iface

geom = featureid.geometry()
if geom:
editMode = 'insert'

layers = QgsProject.instance().mapLayers().values()
canvas = iface.mapCanvas()

geo_point = geom.centroid()

canvas_crs_txt = canvas.mapSettings().destinationCrs().authid()
canvas_crs = canvas_crs_txt.split(':')[1]

layerNameRPG = 'MAEC2023 parcelles'
testlayerRPG = QgsProject().instance().mapLayersByName(layerNameRPG)

if testlayerRPG: 
bv = testlayerRPG[0]

layer_crs_txt = bv.crs().authid()
layer_crs = layer_crs_txt.split(':')[1]

if canvas_crs != layer_crs:
xform = 
QgsCoordinateTransform(QgsCoordinateReferenceSystem('EPSG:'+canvas_crs), 
QgsCoordinateReferenceSystem('EPSG:'+layer_crs), QgsProject.instance())
geo_point.transform(xform)

find_parcelle = False

polygon = [feature for feature in bv.getFeatures()]
for pol in polygon:
geo_pol = pol.geometry()
if geo_pol.contains(geo_point):
pacageVal = pol['Pacage']
numIlot = str(pol['Num_ilot'])
find_parcelle = True
break

if not find_parcelle:
txt = u"Saisie en dehors des limites du RPG"
iface.messageBar().pushMessage(txt, level=Qgis.Warning)
#dialog.parent().reject()
dialog.close()

#print(dialog.parent())
else:
linedit_pacage = dialog.findChild(QLineEdit,"PACAGE")
linedit_pacage.setText(pacageVal)

linedit_numilot = dialog.findChild(QLineEdit,"NUM_ILOT")
linedit_numilot.setText(numIlot)








  

-Message d'origine-
De : QGIS-Developer  De la part de 
Richard Duivenvoorde via QGIS-Developer
Envoyé : mardi 20 décembre 2022 09:44
À : qgis-developer@lists.osgeo.org
Objet : Re: [QGIS-Developer] Pyqgis Close init form

Soyez vigilant : ce courriel provient d'une organisation externe à la CeA.
• Assurez-vous d’abord qu’il ne s’agit pas d’un email malveillant avant de 
cliquer sur tout lien ou pièce jointe.
Apprendre à reconnaître un email de 
phishing.<https://intranet.alsace.eu/actualites/apprenez-a-reconnaitre-un-email-phishing/>


Can you provide a little more code?

And more info where exactly it is called (in the startup.py or in some form 
init code?

Is 'dialog' available in the code part in which you try to close it?

Regards,

Richard Duivenvoorde

On 12/20/22 09:24, PIERRE Sylvain via QGIS-Developer wrote:
> Hi all,
>
> I can not achieve closing a form in init pyqgis fonction. I try :
>
>  dialog.close()
>
> But form stay without any widgets
>
> I try
>
>  dialog.parent().close()
>
> Does nothing
>
>  dialog.parent().reject()
>
> Qgis crash
>
> Any hints ?
>
> Thanks
>
> **
>
>
>
> Sylvain PIERRE**
>
> Chef de projet système d’information
>
> Direction des Systèmes d’Information et du Développement Numérique
>
> Service Projets et Ingénierie Numérique
>
> *Collectivité européenne d’Alsace*
>
> Tél : 03 88 76 68 88
>
> sylvain.pie...@alsace.eu <mailto:sylvain.pie...@alsace.eu>
>
> www.alsace.eu <http://www.alsace.eu>
>
> facebook <http://www.facebook.com/toutelalsace>twitter 
> <http://www.twitter.com/toutelalsace>insta 
> <http://www.instagram.com/toutelalsace>
>
>
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

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


[QGIS-Developer] Pyqgis Close init form

2022-12-20 Thread PIERRE Sylvain via QGIS-Developer
Hi all,

I can not achieve closing a form in init pyqgis fonction. I try :
dialog.close()
But form stay without any widgets
I try
dialog.parent().close()
Does nothing
dialog.parent().reject()
Qgis crash

Any hints ?

Thanks

[cid:image001.jpg@01D91454.D88F5220]
Sylvain PIERRE
Chef de projet système d'information
Direction des Systèmes d'Information et du Développement Numérique
Service Projets et Ingénierie Numérique
Collectivité européenne d'Alsace
Tél : 03 88 76 68 88
sylvain.pie...@alsace.eu
www.alsace.eu
[facebook] [twitter] 
  [insta] 


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


[QGIS-Developer] PyQgis Standalone app from 3.4 to 3.16

2022-10-03 Thread PIERRE Sylvain via QGIS-Developer
Hi devs,

I'm porting a PyQgis standalone app from 3.4 to 3.16 api.
I get an error with the new 3.16 app
QSqlDatabase: QPSQL driver not loaded
QSqlDatabase: available drivers: 

The most visible change I noticed is python 3.7 to 3.9. Is there any impact on 
PyQt5 bindings ?  With python 3.7 there was a C:\Program Files\QGIS 
3.4\apps\Python37\sip directory which is missing with python 3.9.

Here is my app env variables
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = r'C:\Program Files\QGIS 
3.16.16\apps\Qt5\plugins'
os.environ['PATH'] += r';C:\Program Files\QGIS 3.16.16\apps\qgis-ltr;C:\Program 
Files\QGIS 3.16.16\apps\qgis\bin;C:\Program Files\QGIS 3.16.16\apps\Qt5\bin'
os.environ['QGIS_PREFIX_PATH'] = r'C:\Program Files\QGIS 3.16.16\apps\qgis-ltr'
os.environ['GDAL_DATA'] = r'C:\Program Files\QGIS 3.16.16\share\gdal'
os.environ['PROJ_LIB'] = r'C:\Program Files\QGIS 3.16.16\share\proj'

os.environ['GDAL_DRIVER_PATH'] = r'C:\Program Files\QGIS 
3.16.16\bin\gdalplugins'
os.environ['QT_PLUGIN_PATH'] = r'C:\Program Files\QGIS 
3.16.16\apps\qgis\qtplugins;C:\Program Files\QGIS 3.16.16\apps\qt5\plugins'

Did I miss something ?

Thanks

[cid:image002.jpg@01D8D739.62F6AA70]
Sylvain PIERRE
Chef de projet système d'information
Direction des Systèmes d'Information et du Développement Numérique
Service Projets et Ingénierie Numérique
Collectivité européenne d'Alsace
Tél : 03 88 76 68 88
sylvain.pie...@alsace.eu
www.alsace.eu
[facebook] [twitter] 
  [insta] 


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


Re: [QGIS-Developer] action get measure

2022-06-23 Thread PIERRE Sylvain via QGIS-Developer
Hi Andreas,

I want an interactive solution . Close to measurement tool except I can catch 
the length and update a field in the layer table.

De : Andreas Neumann 
Envoyé : jeudi 23 juin 2022 15:29
À : PIERRE Sylvain 
Cc : qgis-developer@lists.osgeo.org
Objet : Re: [QGIS-Developer] action get measure

Soyez vigilant : ce courriel provient d'une organisation externe à la CeA.
• Assurez-vous d’abord qu’il ne s’agit pas d’un email malveillant avant de 
cliquer sur tout lien ou pièce jointe.
Apprendre à reconnaître un email de 
phishing.<https://intranet.alsace.eu/actualites/apprenez-a-reconnaitre-un-email-phishing/>

Hi Sylvain,

Do you want an interactive solution where the user should interactively draw a 
second point - or is the second point already in your data table?

Andreas

On 2022-06-23 14:42, PIERRE Sylvain via QGIS-Developer wrote:

Hi ,

I want to build an action on a point layer, wich draw a line from a point and 
store the lenght inside a field layer.

Is ther any way to do that ?



Thanks



Sylvain



[cid:image001.jpg@01D88716.6296A620]

Sylvain PIERRE

Chef de projet système d’information

Direction des Systèmes d’Information et du Développement Numérique

Service Projets et Ingénierie Numérique

Collectivité européenne d’Alsace

Tél : 03 88 76 68 88

sylvain.pie...@alsace.eu<mailto:sylvain.pie...@alsace.eu>

www.alsace.eu<http://www.alsace.eu>

[facebook]<http://www.facebook.com/toutelalsace> [twitter] 
<http://www.twitter.com/toutelalsace>  [insta] 
<http://www.instagram.com/toutelalsace>



___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org<mailto:QGIS-Developer@lists.osgeo.org>
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


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


[QGIS-Developer] action get measure

2022-06-23 Thread PIERRE Sylvain via QGIS-Developer
Hi ,
I want to build an action on a point layer, wich draw a line from a point and 
store the lenght inside a field layer.
Is ther any way to do that ?

Thanks

Sylvain

[cid:image001.jpg@01D8870F.73668F30]
Sylvain PIERRE
Chef de projet système d'information
Direction des Systèmes d'Information et du Développement Numérique
Service Projets et Ingénierie Numérique
Collectivité européenne d'Alsace
Tél : 03 88 76 68 88
sylvain.pie...@alsace.eu
www.alsace.eu
[facebook] [twitter] 
  [insta] 


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


Re: [QGIS-Developer] Drag and drop form function QdateEdit Widget init

2022-03-25 Thread PIERRE Sylvain via QGIS-Developer
Hi Andeas,

Good tip !
I have to keep init script for good reason ;-). But I was not aware (not enough 
yet) of such possibilities. So for setting current date it’s pretty cool.
QGIS will still be amazing !

Thanks again

[cid:image009.jpg@01D8402E.DD9E9320]
Sylvain PIERRE
Chef de projet système d’information
Direction des Systèmes d’Information et du Développement Numérique
Service Projets et Ingénierie Numérique
Collectivité européenne d’Alsace
Tél : 03 88 76 68 88
sylvain.pie...@alsace.eu<mailto:sylvain.pie...@alsace.eu>
www.alsace.eu<http://www.alsace.eu>
[facebook]<http://www.facebook.com/toutelalsace> [twitter] 
<http://www.twitter.com/toutelalsace>  [insta] 
<http://www.instagram.com/toutelalsace>

De : Andreas Neumann 
Envoyé : vendredi 25 mars 2022 09:28
À : Denis Rouzaud 
Cc : PIERRE Sylvain ; qgis-developer@lists.osgeo.org
Objet : Re: [QGIS-Developer] Drag and drop form function QdateEdit Widget init

Soyez vigilant : ce courriel provient d'une organisation externe à la CeA.
• Assurez-vous d’abord qu’il ne s’agit pas d’un email malveillant avant de 
cliquer sur tout lien ou pièce jointe.
Apprendre à reconnaître un email de 
phishing.<https://intranet.alsace.eu/actualites/apprenez-a-reconnaitre-un-email-phishing/>

Hi Pierre,

Not sure if you are aware that recent QGIS releases also have very good 
"default" value support without having to use Python. You can simply set 
default values with QGIS expressions. No need for Python code (unless you do 
something really special).

You can even set date values dependent on other widgets without having to use 
Python scripting - and do updates whenever something changes on the record, 
without having to fall back to Python scripting.

Just wanted to make sure you are aware of this alternative mechanism. There 
might still be good reasons for using Python scripting though - but theses 
cases are now rarer.

Greetings,

Andreas

On 2022-03-25 09:17, Denis Rouzaud via QGIS-Developer wrote:
QgsDateTimeEdit implements setDateTime, which is not virtual in QDateTimeEdit.
It's probably that you have to find a QDateTimeEdit rather than the Qt native 
one.

Not 100% sure this is the issue though, but it won't hurt.

Le ven. 25 mars 2022 à 09:11, PIERRE Sylvain via QGIS-Developer 
mailto:qgis-developer@lists.osgeo.org>> a écrit 
:

Thanks for tip Richard, but I've tried with
today = QtCore.QDateTime.currentDateTime()
But it's not working




-Message d'origine-
De : Richard Duivenvoorde mailto:rdmaili...@duif.net>>
Envoyé : vendredi 25 mars 2022 08:50
À : PIERRE Sylvain mailto:sylvain.pie...@alsace.eu>>; 
qgis-developer@lists.osgeo.org<mailto:qgis-developer@lists.osgeo.org>
Objet : Re: [QGIS-Developer] Drag and drop form function QdateEdit Widget init

Soyez vigilant : ce courriel provient d'une organisation externe à la CeA.
• Assurez-vous d'abord qu'il ne s'agit pas d'un email malveillant avant de 
cliquer sur tout lien ou pièce jointe.
==

On 3/25/22 08:33, PIERRE Sylvain via QGIS-Developer wrote:

> But this is not working with QDateEdit widget :
>
> today=date.today()
>
> control=dialog.findChild(QDateEdit,"date_insert")
>
> control.setDateTime(today)
>
> What is the right syntax to init the date widget ? It's impossible to debug 
> init script (or may be I'm missing something...)

Hi,

Which module is 'date.today()' from, not Qt is it?

You probably have to use the QDatetime: 
https://doc.qt.io/qt-5/qdatetime.html#currentDateTime

>>> QDateTime.currentDateTime()
PyQt5.QtCore.QDateTime(2022, 3, 25, 8, 44, 19, 963)

And set THAT with the widget?

See: https://doc.qt.io/qt-5/qdatetimeedit.html#dateTime-prop

(it always a little hassle to juggle with date/time etc in Python/Qt)

Regards,

Richard Duivenvoorde
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org<mailto:QGIS-Developer@lists.osgeo.org>
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org<mailto:QGIS-Developer@lists.osgeo.org>
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


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


Re: [QGIS-Developer] Drag and drop form function QdateEdit Widget init

2022-03-25 Thread PIERRE Sylvain via QGIS-Developer

Thanks for tip Richard, but I've tried with 
today = QtCore.QDateTime.currentDateTime()
But it's not working


  

-Message d'origine-
De : Richard Duivenvoorde  
Envoyé : vendredi 25 mars 2022 08:50
À : PIERRE Sylvain ; qgis-developer@lists.osgeo.org
Objet : Re: [QGIS-Developer] Drag and drop form function QdateEdit Widget init

Soyez vigilant : ce courriel provient d'une organisation externe à la CeA.
• Assurez-vous d’abord qu’il ne s’agit pas d’un email malveillant avant de 
cliquer sur tout lien ou pièce jointe.
==

On 3/25/22 08:33, PIERRE Sylvain via QGIS-Developer wrote:

> But this is not working with QDateEdit widget :
> 
> today=date.today()
> 
> control=dialog.findChild(QDateEdit,"date_insert")
> 
> control.setDateTime(today)
> 
> What is the right syntax to init the date widget ? It’s impossible to debug 
> init script (or may be I’m missing something…)

Hi,

Which module is 'date.today()' from, not Qt is it?

You probably have to use the QDatetime: 
https://doc.qt.io/qt-5/qdatetime.html#currentDateTime

>>> QDateTime.currentDateTime()
PyQt5.QtCore.QDateTime(2022, 3, 25, 8, 44, 19, 963)

And set THAT with the widget?

See: https://doc.qt.io/qt-5/qdatetimeedit.html#dateTime-prop

(it always a little hassle to juggle with date/time etc in Python/Qt)

Regards,

Richard Duivenvoorde
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


[QGIS-Developer] Drag and drop form function QdateEdit Widget init

2022-03-25 Thread PIERRE Sylvain via QGIS-Developer
Hi,
I build a form for a layer with drag and drop mode, and I use an init function 
to init some value for some widdget. I have no problem to do that with 
Qcombobox an QLineEdit widget :


linedit_imat = dialog.findChild(QLineEdit,"code_eqpt")
linedit_imat.setText(imatEqpt)

linedit_com = dialog.findChild(QLineEdit,"fk_commune")
linedit_com.setText(find_comtxt)

But this is not working with QDateEdit widget :
today = date.today()
control = dialog.findChild(QDateEdit,"date_insert")
control.setDateTime(today)

What is the right syntax to init the date widget ? It's impossible to debug 
init script (or may be I'm missing something...)

Thanks

[cid:image002.jpg@01D84022.F648C6E0]
Sylvain PIERRE
Chef de projet système d'information
Direction des Systèmes d'Information et du Développement Numérique
Service Projets et Ingénierie Numérique
Collectivité européenne d'Alsace
Tél : 03 88 76 68 88
sylvain.pie...@alsace.eu
www.alsace.eu
[facebook] [twitter] 
  [insta] 


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


[QGIS-Developer] donuts charts

2022-03-18 Thread PIERRE Sylvain via QGIS-Developer
Hi all,

Is there something already exists or planed to make a map with donuts charts 
instead of pie charts ?
I do not find anything yet.
Il I look at plotly, it seems realy simple : 
https://support.sisense.com/kb/en/article/donut-charts-%E2%80%94-plotly
Do you think it should be difficult to manage a new « hole » parameter in Qgis 
charts ?

Thanks

[cid:image002.jpg@01D83AA8.E5138C90]
Sylvain PIERRE
Chef de projet système d'information
Direction des Systèmes d'Information et du Développement Numérique
Service Projets et Ingénierie Numérique
Collectivité européenne d'Alsace
Tél : 03 88 76 68 88
sylvain.pie...@alsace.eu
www.alsace.eu
[facebook] [twitter] 
  [insta] 


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