Hi Duarte, <br><br>well, now I understand better your first question. Sorry for the confusion.<br><br>Regarding the 1 million dollars, I think I&#39;ll let anyone else to get them (which means: I don&#39;t know the answer :) ). <br>

<br>Regards, <br><br>Germán<br><br><div class="gmail_quote">2011/12/16 Duarte Carreira <span dir="ltr">&lt;<a href="mailto:DCarreira@edia.pt">DCarreira@edia.pt</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left:1px solid rgb(204,204,204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">


<div link="blue" vlink="purple" lang="PT"><div><p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)">Hi Germán.<u></u><u></u></span></p><p class="MsoNormal">

<span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US">Your tips are exactly what I was looking for!<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US">So I can now open a dialog:<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US">iface=qgis.utils.iface<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US">menu=iface.layerMenu()<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US">myActions=menu.actions()<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US">myAction=[ac for ac in myActions if ac.objectName()==&quot;mActionEmbedLayers&quot;][0]<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US">myAction.trigger()<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US">So now for the final 1 million dollar question: can I change the first textbox in the dialog?<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US">Thanks,<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US">Duarte<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US"><u></u> <u></u></span></p>

<div style="border-style:solid none none;border-color:rgb(181,196,223) -moz-use-text-color -moz-use-text-color;border-width:1pt medium medium;padding:3pt 0cm 0cm"><p class="MsoNormal"><b><span style="font-size:10pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">De:</span></b><span style="font-size:10pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Germán Carrillo [mailto:<a href="mailto:carrillo.german@gmail.com" target="_blank">carrillo.german@gmail.com</a>] <br>

<b>Enviada:</b> quinta-feira, 15 de Dezembro de 2011 13:26<br><b>Para:</b> Duarte Carreira; <a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a><div class="im"><br><b>Assunto:</b> Re: [Qgis-developer] quick noob python question<u></u><u></u></div>

</span></p></div><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal" style="margin-bottom:12pt">Hi Duarte, <br></p><div class="im"><br>if I understood well, you would like to simulate a click in QGIS buttons. For this you can use the slot trigger() of the available QAction&#39;s in the class QgisInteface [1]. For example, if you want to open the &quot;Open Project...&quot; dialog you can type this in the Python Console (inside QGIS):<u></u><u></u></div>

<div class="im"><p style="margin:0cm 0cm 0.0001pt">iface=qgis.utils.iface<u></u><u></u></p><p style="margin:0cm 0cm 0.0001pt">iface.actionOpenProject().trigger()<u></u><u></u></p><p class="MsoNormal"><br>Regarding Toolbars, you can also access them from the QgisInterface class. For example, to access the Layer menu do this: <br>

<br>iface=qgis.utils.iface<u></u><u></u></p><p style="margin:0cm 0cm 0.0001pt">m=iface.layerMenu()<u></u><u></u></p><p style="margin:0cm 0cm 0.0001pt"><u></u> <u></u></p><p style="margin:0cm 0cm 0.0001pt">Since a menu consists of a set of actions you could trigger any action of the menu: <u></u><u></u></p>

<p style="margin:0cm 0cm 0.0001pt"><u></u> <u></u></p><p style="margin:0cm 0cm 0.0001pt">iface=qgis.utils.iface<u></u><u></u></p></div><p style="margin:0cm 0cm 0.0001pt">for a in m.actions():<u></u><u></u></p><div><div></div>

<div class="h5"><p style="margin:0cm 0cm 0.0001pt">print a.text()<u></u><u></u></p><p style="margin:0cm 0cm 0.0001pt">m.actions()[2].trigger()<u></u><u></u></p><p class="MsoNormal" style="margin-bottom:12pt"><br>Hope this helps.<br>

<br>Regards, <br><br>Germán<br><br>-------------------------<br>[1] <a href="http://www.qgis.org/api/classQgisInterface.html" target="_blank">http://www.qgis.org/api/classQgisInterface.html</a> <u></u><u></u></p><div><p class="MsoNormal">

2011/12/15 Duarte Carreira &lt;<a href="mailto:DCarreira@edia.pt" target="_blank">DCarreira@edia.pt</a>&gt;<u></u><u></u></p><div><div><p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US">Just an additional question: generally speaking the gui is not accessible from python? We cannot simulate a toolbar button click, or menu item?</span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US">Duarte</span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US"> </span><u></u><u></u></p><div><div style="border-style:solid none none;border-color:-moz-use-text-color;border-width:1pt medium medium;padding:3pt 0cm 0cm">

<p class="MsoNormal"><b><span style="font-size:10pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">De:</span></b><span style="font-size:10pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Duarte Carreira [mailto:<a href="mailto:DCarreira@edia.pt" target="_blank">DCarreira@edia.pt</a>] <br>

<b>Enviada:</b> quarta-feira, 14 de Dezembro de 2011 17:05<br><b>Para:</b> Germán Carrillo; <a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a><br><b>Assunto:</b> RE: [Qgis-developer] quick noob python question</span><u></u><u></u></p>

</div></div><div><div><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US">Germán, thanks.</span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US">Maybe that’s what I’ll do, but it pains me to duplicate code…</span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US">Duarte</span><u></u><u></u></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:rgb(31,73,125)" lang="EN-US"> </span><u></u><u></u></p><div style="border-style:solid none none;border-color:-moz-use-text-color;border-width:1pt medium medium;padding:3pt 0cm 0cm">

<p class="MsoNormal"><b><span style="font-size:10pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">De:</span></b><span style="font-size:10pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Germán Carrillo [mailto:<a href="mailto:carrillo.german@gmail.com" target="_blank">carrillo.german@gmail.com</a>] <br>

<b>Enviada:</b> quarta-feira, 14 de Dezembro de 2011 12:30<br><b>Para:</b> <a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a>; Duarte Carreira<br><b>Assunto:</b> Re: [Qgis-developer] quick noob python question</span><u></u><u></u></p>

</div><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal" style="margin-bottom:12pt">Hi Duarte, <br><br>from my experience it is not possible. You can of course re-use the ui file and implement the whole functionality on your own based on the cpp file, basically a translation from C++ to Python. I&#39;ve done this before and it is not a complex process, but it requires time. <br>

<br>By the way, the folder app of QGIS source code contains QGIS-application-specific code, so I would say you won&#39;t find there functionality available in PyQGIS, for that you would have to have a look to the gui and core folders. <br>

<br>Perhaps there are other ways to set the project file programmatically from Python, but I don&#39;t know them, sorry.<br><br>Regards, <br><br>Germán<u></u><u></u></p><div><p class="MsoNormal">2011/12/14 Duarte Carreira &lt;<a href="mailto:DCarreira@edia.pt" target="_blank">DCarreira@edia.pt</a>&gt;<u></u><u></u></p>

<div><div><p class="MsoNormal"><span lang="EN-US">Using python is it possible to call QgsEmbedLayerDialog and set the project file programmatically (</span><span style="background:white none repeat scroll 0% 0%;font-size:9pt;font-family:&quot;Courier New&quot;;color:black" lang="EN-US">mProjectFileLineEdit</span><span lang="EN-US">)?</span><u></u><u></u></p>

<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p><p class="MsoNormal"><a href="https://github.com/qgis/Quantum-GIS/blob/release-1_8/src/app/qgsembedlayerdialog.cpp" target="_blank">https://github.com/qgis/Quantum-GIS/blob/release-1_8/src/app/qgsembedlayerdialog.cpp</a><u></u><u></u></p>

<p class="MsoNormal"><a href="https://github.com/qgis/Quantum-GIS/blob/release-1_8/src/ui/qgsembedlayerdialogbase.ui" target="_blank">https://github.com/qgis/Quantum-GIS/blob/release-1_8/src/ui/qgsembedlayerdialogbase.ui</a><u></u><u></u></p>

<p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Thanks,<br><span style="color:rgb(136,136,136)">Duarte Carreira</span><u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p></div></div><p class="MsoNormal" style="margin-bottom:12pt">

<br>_______________________________________________<br>Qgis-developer mailing list<br><a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><u></u><u></u></p>

</div><p class="MsoNormal">-- <br>-----------<br>  |\__  <br>(:&gt;__)(<br>  |/    <br><br>Soluciones Geoinformáticas Libres                            <br><a href="http://geotux.tuxfamily.org/" target="_blank">http://geotux.tuxfamily.org/</a><u></u><u></u></p>

</div></div></div></div></div><p class="MsoNormal"><br><br clear="all"><br>-- <br>-----------<br>  |\__  <br>(:&gt;__)(<br>  |/    <br><br>Soluciones Geoinformáticas Libres                            <br><a href="http://geotux.tuxfamily.org/" target="_blank">http://geotux.tuxfamily.org/</a><u></u><u></u></p>

</div></div></div></div></blockquote></div><br><br clear="all"><br>-- <br>-----------<br>  |\__  <br>(:&gt;__)(<br>  |/    <br><br>Soluciones Geoinformáticas Libres                            <br><a href="http://geotux.tuxfamily.org/">http://geotux.tuxfamily.org/</a><br>