Bug #4883
replacement in label
| Status: | Closed | Start Date: | 01/25/2012 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | - | % Done: | 0% |
|
| Category: | - | Spent time: | - | |
| Target version: | - | |||
| Patch supplied: | No |
Description
does not work for us, with a simple postgis layer (table department, field: nom_departement)
in the composer: $FIELD
Traceback (most recent call last):
File ".qgis/python/plugins/atlas/atlasdialog.py", line 189, in renderMap
self.setLabelReplacementInfos()
File ".qgis/python/plugins/atlas/atlasdialog.py", line 135, in setLabelReplacementInfos
*[lri['fields'] for lri in self.labelReplacementInfos]))
TypeError: union() takes exactly one argument (0 given)
Version de Python :
2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]
Version de QGIS :
1.7.3-Wroclaw Wroclaw, 00624b3
Thanks
History
Updated by Vincent Picavet over 1 year ago
Could you try to reproduce with latest version ?
This should be fixed in 0.1.7
Updated by Xavier Culos over 1 year ago
the problem persists (same error) in 0.1.7 and is solved by a more traditional list management ...
but my Python skills are limited
#selectFieldNames = list(set.union(*[lri['fields'] for lri in self.labelReplacementInfos]))
selectFieldNames = []
for lri in self.labelReplacementInfos:
for name in lri['fields']:
selectFieldNames.append(name)
Updated by Vincent Picavet over 1 year ago
Your patch is not equivalent, since union removes duplicates (that's why it's used there)
Could you post your composer template and a coverage layer, taken down to the minimum to reproduce the error ?
Thanks
Updated by Hien TRAN-QUANG over 1 year ago
Seems that if composer only has only one $FIELD , the instruction should be
selectFieldNames = list(set(*[lri['fields'] for lri in self.labelReplacementInfos]))
(no .union call)
But if there's more than 1, the set.union is required.
Here's a patch :
# get global field list for feature select method
if self.labelReplacementInfos:
if len (self.labelReplacementInfos) == 1:
selectFieldNames = list(set(*[lri['fields'] for lri in self.labelReplacementInfos]))
else:
selectFieldNames = list(set.union(\
*[lri['fields'] for lri in self.labelReplacementInfos]))
else:
selectFieldNames = []
Updated by Vincent Picavet over 1 year ago
- Status changed from New to Closed
Patch applied in 0.1.9.
Thanks !