<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<p>Hi Seggie,</p>
<p>Just one line of code to add a folder to browser panel:</p>
<p>iface.browserModel().addFavoriteDirectory('/home/jgr/tmp')</p>
<p>Regards,</p>
<p>Jorge<br>
</p>
<div class="moz-cite-prefix">On 22/05/20 14:37, Seggie, Graeme
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:320CBD6D2C3B0C48B55EBA312C85CE0C8B1776@SEPA-APP-EXC03.sepanet.sepa.org.uk">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Hello,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am struggling to get something to work,
which would seem to be an easy thing to do, but cannot quite
make my understanding of the python docs work in practice.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">What I would like to do, is run some python
to add some folders to the favorites area in the browser
within QGIS. This is to get round an environemental constraint
of not being able to save a profile i.e. quickly add a python
script to setup the favorites each time log on. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">This is what I have tried thus far:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">url = "U:\Tyres"<o:p></o:p></p>
<p class="MsoNormal">qgis.gui.QgsBrowserDockWidget(addFavoriteDirectory,
uri)
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-family:Wingdings">à</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Traceback (most recent call last):<o:p></o:p></p>
<p class="MsoNormal"> File
"C:\OSGEO4~1\apps\Python37\lib\code.py", line 90, in runcode<o:p></o:p></p>
<p class="MsoNormal"> exec(code, self.locals)<o:p></o:p></p>
<p class="MsoNormal"> File "<input>", line 1, in
<module><o:p></o:p></p>
<p class="MsoNormal"> File "<string>", line 3, in
<module><o:p></o:p></p>
<p class="MsoNormal">NameError: name 'addFavoriteDirectory' is
not defined<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">AND<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">url = "U:\Tyres"<o:p></o:p></p>
<p class="MsoNormal">qgis.gui.QgsBrowserDockWidget(addFavorite,
uri)
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-family:Wingdings">à</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Traceback (most recent call last):<o:p></o:p></p>
<p class="MsoNormal"> File
"C:\OSGEO4~1\apps\Python37\lib\code.py", line 90, in runcode<o:p></o:p></p>
<p class="MsoNormal"> exec(code, self.locals)<o:p></o:p></p>
<p class="MsoNormal"> File "<input>", line 1, in
<module><o:p></o:p></p>
<p class="MsoNormal"> File "<string>", line 3, in
<module><o:p></o:p></p>
<p class="MsoNormal">NameError: name 'addFavorite' is not
defined<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Should I be calling the addFavorite code
differently? This is within the Python console and script area
of same.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Graeme<span
style="font-size:9.0pt;color:#3B3838;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></pre>
</blockquote>
<div class="moz-signature">-- <br>
<title>Email Signature</title>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<table style="width: 525px; font-size: 11pt; font-family: Arial,
sans-serif;" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="text-align:center; font-size: 10pt; font-family:
Arial, sans-serif; border-right: 1px solid;
border-right-color: #fb6303; width: 125px; padding-right:
10px; vertical-align: top;" rowspan="6" width="125"
valign="top"> <a href="https://www.geomaster.pt"
target="_blank"><img alt="Logo" style="width:105px;
height:auto; border:0;"
src="https://geomaster.pt/wp-content/uploads/2017/02/cropped-geomaster300x300-1.png"
width="85" border="0"></a> </td>
<td style="padding-left:10px">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="font-size: 10pt; color:#0079ac;
font-family: Arial, sans-serif; width: 400px;
padding-bottom: 5px; padding-left: 10px;
vertical-align: top;" valign="top"> <strong><span
style="font-size: 14pt; font-family: Arial,
sans-serif; color:#fb6303;">Geomaster</span></strong><br>
<strong><span style="font-size: 11pt; font-family:
Arial, sans-serif; color:black;">Jorge Gustavo
Rocha</span></strong> <span
style="font-family: Arial, sans-serif;
font-size:11pt; color:#000000;"><span
style="padding-right: 5px; padding-left: 5px;">
| </span>Software Engineer</span> </td>
</tr>
<tr>
<td style="font-size: 10pt; color:#444444;
font-family: Arial, sans-serif; padding-bottom:
5px; padding-top: 5px; padding-left: 10px;
vertical-align: top; line-height:17px;"
valign="top"> <span><span style="color: #fb6303;"><strong>e:</strong></span><span
style="font-size: 10pt; font-family: Arial,
sans-serif; color:#000000;"> <a class="moz-txt-link-abbreviated" href="mailto:jgr@geomaster.pt">jgr@geomaster.pt</a></span></span>
<span><span style="padding-left:
5px;padding-right: 5px;"> | </span><span
style="color: #fb6303;"><strong>m:</strong></span><span
style="font-size: 10pt; font-family: Arial,
sans-serif; color:#000000;"> +351 910 333 888<br>
</span></span> <span><span style="color:
#fb6303;"><strong>g:</strong></span><span
style="font-size: 10pt; font-family: Arial,
sans-serif; color:#000000;"> 41.54094,-8.40490</span></span>
<span><span style="padding-left:
7px;padding-right: 5px;"> | </span><span
style="color: #fb6303;"><strong>v: </strong></span><span
style="font-size: 10pt; font-family: Arial,
sans-serif; color:#000000; padding-left: 7px;">
510 906 109<br>
</span></span> <span> <span style="color:
#fb6303;"><strong>a: </strong></span> </span>
<span> <span style="font-size: 10pt; font-family:
Arial, sans-serif; color: #000000;"><span> </span>Rua
António Cândido Pinto, 67, 4715-400 Braga<br>
</span></span> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>