2010/12/12 michael biggs <span dir="ltr"><<a href="mailto:mjbiggs@hotmail.com" target="_blank">mjbiggs@hotmail.com</a>></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're welcome!<br><br>I don't know this command too, until seek for via console dir().<br><br>It makes possible get style settings directly from SLA file (there'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 'Start element:', name, attrs</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if name == 'STYLE':</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> styles[attrs[u'NAME']] = attrs</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if name == 'CHARSTYLE':</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> charstyles[attrs[u'CNAME']] = 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;"> '''Return a dictionary with paragraph style parameters.'''</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,'not in style sheet.'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> res = ''</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 = ''</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['LINESP'])</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 = ''</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['VOR'])</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 = ''</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['NACH'])</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;"> '''0=fixed, 1=proportional'''</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 = ''</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['LINESPMode'])</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('UTF-8')</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,'r')</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'Head 1')</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: "</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;">"
tratamento: "Prof. MS."</span><br style="font-family: Helvetica,Arial,sans-serif;">
<small style="font-family: Helvetica,Arial,sans-serif;">cargo: "<span style="font-weight: bold;">Coordenador do Curso de
Relações Públicas Multimídia</span>"<br>
ies: "CESNORS/Universidade Federal de Santa Maria"<br>
googletalk: email: MSN: <a href="mailto:joseantoniorocha@gmail.com" target="_blank">joseantoniorocha@gmail.com</a><br>
ICQ: 658222 Skype: "meiradarocha_jor"<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>