<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="en">
<head><meta http-equiv="Content-Type" content="text/html;">
<title>Scalix message content</title>
<style type="text/css">
<!--
.Normal {  text-align: left; text-indent:0pt; margin-top:0pt; margin-bottom:0pt; font-family: Arial; font-size: 12pt; }
.Default_Paragraph_Font {font-family: Arial; color: Black; background-color: white ; font-size: 12pt; font-weight: normal;  font-style: normal; font-variant: normal; vertical-align: normal; text-decoration: none;}
div.ltTOCtitle { font-family: Verdana; font-size: 8pt; font-weight: bold; text-align: center;}
div.ltTOCl1 { font-family: Verdana; font-size: 8pt; font-weight: bold; margin-left:32pt; text-indent:-32pt;}
div.ltTOCl2 { font-family: Verdana; font-size: 8pt; font-weight: bold; margin-left:40pt; text-indent:-32pt;}
div.ltTOCl3 {  font-family: Verdana; font-size: 8pt; font-weight: bold; margin-left:48pt; text-indent:-32pt;}
div.ltTOCl4 { font-family: Verdana; font-size: 8pt; font-weight: bold; margin-left:56pt; text-indent:-32pt;}
div.ltTOCl5 { font-family: Verdana; font-size: 8pt; font-weight: bold; margin-left:64pt; text-indent:-32pt;}
div.ltTOCl6 { font-family: Verdana; font-size: 8pt; font-weight: bold; margin-left:72pt; text-indent:-32pt;}
-->
</style>
</head>

<body>
<div class="Normal"><span style='font-size: 10pt; '>The python bindings for this
method was introduced with revision 14164. So you should try QGIS 1.6 I
guess.</span></div>
<br>
<div class="Normal"><span style='font-size: 10pt; '>regards</span><br><span style='font-size: 10pt; '>Stefan</span></div>
<br>
<div class="Normal"><span style='font-size: 10pt; '>> -----Ursprüngliche
Nachricht-----</span><br><span style='font-size: 10pt; '>> Von: Kris
Nackaerts
[mailto:knackaerts@gmx.net]</span><br><span style='font-size: 10pt; '>>
Gesendet am: Donnerstag, 3. Februar 2011
20:38</span><br><span style='font-size: 10pt; '>> An: Ziegler
Stefan</span><br><span style='font-size: 10pt; '>> Betreff: Re: AW:
[Qgis-user] How to get group index
?</span><br><span style='font-size: 10pt; '>>
</span><br><span style='font-size: 10pt; '>> I'm using version 1.4 on Ubuntu
10.x at the moment.</span><br><span style='font-size: 10pt; '>>
</span><br><span style='font-size: 10pt; '>> I did a
dir(iface.legendInterface()) and </span><br><span style='font-size: 10pt; '>>
groupLayerRelationship() is not </span><br><span style='font-size: 10pt; '>>
in it.</span><br><span style='font-size: 10pt; '>>
</span><br><span style='font-size: 10pt; '>> the indexOf() function returns
the index of the group in the </span><br><span style='font-size: 10pt; '>>
list of all </span><br><span style='font-size: 10pt; '>> groups, but that's
not the correct index for the
legend.</span><br><span style='font-size: 10pt; '>>
</span><br><span style='font-size: 10pt; '>> On which version do you use
it?</span><br><span style='font-size: 10pt; '>>
Kris</span><br><span style='font-size: 10pt; '>>
</span><br><span style='font-size: 10pt; '>>
</span><br><span style='font-size: 10pt; '>> On 03/02/2011 17:40, Ziegler
Stefan wrote:</span><br><span style='font-size: 10pt; '>> > Hi
Kris</span><br><span style='font-size: 10pt; '>>
></span><br><span style='font-size: 10pt; '>> > this solution should
still work (at least for me). Which
</span><br><span style='font-size: 10pt; '>> version of QGIS do you
use?</span><br><span style='font-size: 10pt; '>>
></span><br><span style='font-size: 10pt; '>> >
regards</span><br><span style='font-size: 10pt; '>> >
Stefan</span><br><span style='font-size: 10pt; '>>
></span><br><span style='font-size: 10pt; '>> > Mit freundlichem
Gruss</span><br><span style='font-size: 10pt; '>> > Stefan
Ziegler</span><br><span style='font-size: 10pt; '>> > Leiter amtliche
Vermessung</span><br><span style='font-size: 10pt; '>>
></span><br><span style='font-size: 10pt; '>> > Amt für
Geoinformation</span><br><span style='font-size: 10pt; '>> >
Rötistrasse 4</span><br><span style='font-size: 10pt; '>> > 4501
Solothurn</span><br><span style='font-size: 10pt; '>> > 032 627 75
96</span><br><span style='font-size: 10pt; '>>
></span><br><span style='font-size: 10pt; '>> > ----- Originalnachricht
-----</span><br><span style='font-size: 10pt; '>> > Von: "Kris
Nackaerts"<knackaerts@gmx.net></span><br><span style='font-size: 10pt; '>>
> Gesendet: Don, 3.2.2011
17:29</span><br><span style='font-size: 10pt; '>> > An:
qgis-user@lists.osgeo.org</span><br><span style='font-size: 10pt; '>> >
Betreff: [Qgis-user] How to get group index
?</span><br><span style='font-size: 10pt; '>>
></span><br><span style='font-size: 10pt; '>> >
Dear,</span><br><span style='font-size: 10pt; '>>
></span><br><span style='font-size: 10pt; '>> > I'm trying to get the
correct group index from python so I
</span><br><span style='font-size: 10pt; '>> can move layers into a
predefined group. I can get the list
</span><br><span style='font-size: 10pt; '>> of groups, but not the correct
index in the full legend tree. </span><br><span style='font-size: 10pt; '>>
Anyone who knows how to get this?</span><br><span style='font-size: 10pt; '>>
></span><br><span style='font-size: 10pt; '>> > I found one solution,
but this is not working anymore:</span><br><span style='font-size: 10pt; '>>
> </span><br><span style='font-size: 10pt; '>>
http://code.google.com/p/cataisrepository/source/browse/trunk/</span><br><span style='font-size: 10pt; '>qgis/plugins/soverify/tools/utils.py?spec=svn89&r=89</span><br><span style='font-size: 10pt; '>></span><br><span style='font-size: 10pt; '>>
It uses relationList =
iface.legendInterface().groupLayerRelationship()</span><br><span style='font-size: 10pt; '>>
, a function that doesn't
exist.</span><br><span style='font-size: 10pt; '>></span><br><span style='font-size: 10pt; '>></span><br><span style='font-size: 10pt; '>></span><br><span style='font-size: 10pt; '>>
my trial was:</span><br><span style='font-size: 10pt; '>>          if
'Templates' in legend.groups():</span><br><span style='font-size: 10pt; '>>  
g_templates =
legend.groups().indexOf('Templates')</span><br><span style='font-size: 10pt; '>>
else:</span><br><span style='font-size: 10pt; '>>             
g_templates=legend.addGroup('Templates')</span><br><span style='font-size: 10pt; '>>
legend.moveLayer(loadedLayer,g_templates)</span><br><span style='font-size: 10pt; '>></span><br><span style='font-size: 10pt; '>>
Any
hints?</span><br><span style='font-size: 10pt; '>></span><br><span style='font-size: 10pt; '>>
Kris</span></div>
<br>



</body>

</html>