2010/12/12 michael biggs <span dir="ltr">&lt;<a href="mailto:mjbiggs@hotmail.com" target="_blank">mjbiggs@hotmail.com</a>&gt;</span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<br>
Hello José<br>
<br>
that is an excellent solution - exactly what I was seeking.<br>
<br>
have tried it and it works.<br>
<br>
great to know about listing undocumented functions via Scripter Console too.<br>
<br>
thanks very much<br>
<br>
Mike<br></blockquote><br></div>You&#39;re welcome!<br><br>I don&#39;t know this command too, until seek for via console dir().<br><br>It makes possible get style settings directly from SLA file (there&#39;s no build-in command for that), using Python module <b><span style="font-family: courier new,monospace;">xml.parsers.expat</span></b> <br>


I need this to resize headline frames according headlines spaces above and below and linespaces : <br><br><span style="font-family: courier new,monospace;">import xml.parsers.expat</span><br style="font-family: courier new,monospace;">


<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">styles = {}</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">charstyles = {}</span><br style="font-family: courier new,monospace;">


<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">def start_element(name, attrs):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    #print &#39;Start element:&#39;, name, attrs</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    if name == &#39;STYLE&#39;:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        styles[attrs[u&#39;NAME&#39;]] = attrs</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    if name == &#39;CHARSTYLE&#39;:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        charstyles[attrs[u&#39;CNAME&#39;]] = attrs</span><br style="font-family: courier new,monospace;">


<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">def getParagraphStyle(styleName):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    &#39;&#39;&#39;Return a dictionary with paragraph style parameters.&#39;&#39;&#39;</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    try:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        res = styles[styleName]</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    except:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        print styleName,&#39;not in style sheet.&#39;</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">        res = &#39;&#39;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    return res</span><br style="font-family: courier new,monospace;">


<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">def getStyleLineSpacing(styleName):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    dic = getParagraphStyle(styleName)</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    if (dic == {}):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        res = &#39;&#39;</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        res = int(dic[&#39;LINESP&#39;])</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    return res</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">def getStyleSpaceAbove(styleName):</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    dic = getParagraphStyle(styleName)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    if dic == {}:</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">        res = &#39;&#39;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    else:</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">        res = int(dic[&#39;VOR&#39;])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    return res</span><br style="font-family: courier new,monospace;">


<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">def getStyleSpaceBelow(styleName):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    dic = getParagraphStyle(styleName)</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    if dic == {}:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        res = &#39;&#39;</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        res = int(dic[&#39;NACH&#39;])</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    return res</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">def getStyleLineSpaceMode(styleName):</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    &#39;&#39;&#39;0=fixed, 1=proportional&#39;&#39;&#39;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    dic = getParagraphStyle(styleName)</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    if dic == {}:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        res = &#39;&#39;</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        res = int(dic[&#39;LINESPMode&#39;])</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    return res</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">p = xml.parsers.expat.ParserCreate(&#39;UTF-8&#39;)</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">p.StartElementHandler = start_element</span><br style="font-family: courier new,monospace;"><b style="color: rgb(255, 0, 0);"><span style="font-family: courier new,monospace;">docName = scribus.getDocName()</span></b><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">file = open(docName,&#39;r&#39;)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">p.ParseFile(file)</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">file.close()</span><br style="font-family: courier new,monospace;"><br><span style="font-family: courier new,monospace;"># tests:</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">print styles</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">print charstyles</span><br><span style="font-family: courier new,monospace;">print getStyleLineSpacing(u&#39;Head 1&#39;)</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;"></span><br>-- <br>
<font style="font-family: Helvetica,Arial,sans-serif;" color="#888888"><hr>
<font size="1"><font size="2"><img style="width: 75px; min-height: 100px;" alt="Meira" src="http://lh4.ggpht.com/_75EesisxR5g/TENbAQVXMLI/AAAAAAAADHs/ChNQzn8eOT0/meira-75x100.jpg" align="left" hspace="8" vspace="6"></font></font></font><span style="font-family: Helvetica,Arial,sans-serif;">nome: &quot;</span><span style="font-weight: bold; font-family: Helvetica,Arial,sans-serif;">José Antonio Meira da Rocha</span><span style="font-family: Helvetica,Arial,sans-serif;">&quot; 
tratamento: &quot;Prof. MS.&quot;</span><br style="font-family: Helvetica,Arial,sans-serif;">

<small style="font-family: Helvetica,Arial,sans-serif;">cargo: &quot;<span style="font-weight: bold;">Coordenador do Curso de
Relações Públicas Multimídia</span>&quot;<br>
ies: &quot;CESNORS/Universidade Federal de Santa Maria&quot;<br>
googletalk: email: MSN: <a href="mailto:joseantoniorocha@gmail.com" target="_blank">joseantoniorocha@gmail.com</a><br>
ICQ: 658222 Skype: &quot;meiradarocha_jor&quot;<br>
veículo: [ <a href="http://meiradarocha.jor.br/" target="_blank">http://meiradarocha.jor.br</a>
] <br>fone: (55) 9651-0686<br></small>
<hr style="width: 100%; min-height: 2px; font-family: Helvetica,Arial,sans-serif;">
<br>