<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Lateral Opinion (rst2qhc)</title><link>http://ralsina.com.ar</link><description></description><language>en</language><lastBuildDate>Mon, 10 Mar 2014 12:31:00 GMT</lastBuildDate><generator>http://getnikola.com/</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Using assistant from PyQt</title><link>http://ralsina.com.ar/weblog/posts/BB780.html</link><description>&lt;div&gt;&lt;p&gt;The uRSSus doc is slow­ly grow­ing, so I hooked as­sis­tant to the UI. Not dif­fi­cult, but I have not seen it else­where.&lt;/p&gt; 
 &lt;p&gt;Here's how:&lt;/p&gt; 
 &lt;p&gt;As­sume the "Hand­book ac­tion" is called ac­tion_Hand­book.
Set win­dow.as­sis­tant to None in __init__.&lt;/p&gt; 
 &lt;pre class="code python literal-block"&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;on_action_Handbook_triggered&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;assistant&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; \
       &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;assistant&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;poll&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

        &lt;span class="n"&gt;helpcoll&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;abspath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dirname&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__file__&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;\
                              &lt;span class="s"&gt;'help'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;\
                              &lt;span class="s"&gt;'out'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;\
                              &lt;span class="s"&gt;'collection.qhc'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"assistant -enableRemoteControl -collectionFile &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;helpcoll&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;assistant&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Popen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                        &lt;span class="n"&gt;shell&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                        &lt;span class="n"&gt;stdin&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;PIPE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;assistant&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stdin&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"SetSource qthelp://urssus/doc/handbook.html&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;And that's it. Now I ned to fig­ure out con­text help.&lt;/p&gt;&lt;/div&gt;</description><category>python</category><category>qt</category><category>rst2qhc</category><category>urssus</category><guid>http://ralsina.com.ar/weblog/posts/BB780.html</guid><pubDate>Sun, 01 Mar 2009 10:43:00 GMT</pubDate></item><item><title>rst2qhc 0.2: the insomnia release</title><link>http://ralsina.com.ar/weblog/posts/BB778.html</link><description>&lt;div&gt;&lt;p&gt;To­day I woke up at 6AM. I had noth­ing to do un­til 9, but I woke up and could­n't sleep again.&lt;/p&gt; 
 &lt;p&gt;So, what can I do? I hacked  &lt;a class="reference external" href="http://rst2qhc.googlecode.com"&gt;rst2qhc&lt;/a&gt;  a bit more :-D&lt;/p&gt; 
 &lt;p&gt;Since this is a small pro­jec­t, it is quick­ly ap­proach­ing fea­ture com­plete sta­tus (there is re­al­ly on­ly so much this thing can do).&lt;/p&gt; 
 &lt;p&gt;So, what's new?&lt;/p&gt; 
 &lt;ul class="simple"&gt;
&lt;li&gt;Pass­ing op­tions to rst2htm­l, so you can do things like set stylesheet­s.&lt;/li&gt; 
 &lt;li&gt;Sup­port for a man­i­fest file, so you can list what files should be em­bed­ded in the help­file.&lt;/li&gt; 
 &lt;li&gt;Fixed project sup­port. Now you can  &lt;em&gt;op­tion­al­ly&lt;/em&gt;  ask rst2qhc to cre­ate a qhcp file that will build your doc­u­men­t.&lt;/li&gt; 
 &lt;li&gt;Bet­ter, more com­plete ex­am­ple that dis­plays most fea­tures.&lt;/li&gt; 
 &lt;/ul&gt;
&lt;p&gt;I have on­ly one thing left in my TODO, which is call­ing the HTML writ­er via API in­stead of via  &lt;cite&gt;sys­tem()&lt;/cite&gt;  be­cause that way there is no need to de­fine the key­word role in the doc­u­men­t, and I can add syn­tax high­light­ing via pyg­ments.&lt;/p&gt; 
 &lt;p&gt;Since I now  &lt;em&gt;do&lt;/em&gt;  have work to do, I will just re­lease 0.2 now ;-)&lt;/p&gt; 
 &lt;p&gt;You can get it from the usu­al place:  &lt;a class="reference external" href="http://rst2qhc.googlecode.com"&gt;http://rst2qhc.­google­code.­com&lt;/a&gt;&lt;/p&gt; 
 &lt;p&gt;And here's a sam­ple of the in­put/out­put:&lt;/p&gt; 
 &lt;a href="http://www.flickr.com/photos/ralsina/3302832917/" title="rst2qhc by ralsina_2000, on Flickr"&gt;&lt;img src="http://farm4.staticflickr.com/3584/3302832917_cdc5e0063f.jpg" width="500" height="313" alt="rst2qhc"&gt;&lt;/a&gt;&lt;/div&gt;</description><category>programming</category><category>python</category><category>rst2qhc</category><guid>http://ralsina.com.ar/weblog/posts/BB778.html</guid><pubDate>Mon, 23 Feb 2009 11:22:00 GMT</pubDate></item><item><title>Now you, too can create Qt Help Files painlessly</title><link>http://ralsina.com.ar/weblog/posts/BB777.html</link><description>&lt;div&gt;&lt;p&gt;I de­cid­ed to add a man­u­al for  &lt;a class="reference external" href="http://urssus.googlecode.com"&gt;uRSSus&lt;/a&gt;. Since it's a Qt ap­p, I checked how to do one of those neat help files, like the ones that come with Qt app­s.&lt;/p&gt; 
 &lt;p&gt;It turns out it's  &lt;a class="reference external" href="http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/qthelp.html#creating-a-qt-help-collection"&gt;not so sim­ple&lt;/a&gt;  to cre­ate one of those.&lt;/p&gt; 
 &lt;p&gt;You need to cre­ate your help in one or more HTML files, then cre­ate a XML file that de­scribes what each file is, ref­er­ences for each sec­tion, and ref­er­ences for each key­word you want in the in­dex.&lt;/p&gt; 
 &lt;p&gt;For any re­al-life-­size doc­u­men­t, that's go­ing to be in­cred­i­bly an­noy­ing.&lt;/p&gt; 
 &lt;p&gt;So, I took my usu­al es­cape route when I don't want to do grunt work on doc­s:  &lt;a class="reference external" href="http://docutils.sf.net"&gt;Do­cu­tils&lt;/a&gt;.&lt;/p&gt; 
 &lt;p&gt;Specif­i­cal­ly, I wrote  &lt;a class="reference external" href="http://rst2qhc.googlecode.com"&gt;rst2qhc&lt;/a&gt;  which takes one (or more) re­struc­tured text files, and cre­ates a nice and clean Qt Help Project file from them, in­clud­ing sec­tion ti­tles, ref­er­ences and key­word­s, which you mark on the text us­ing the 'key­word' role.&lt;/p&gt; 
 &lt;p&gt;What does this mean? Let me be graph­i­cal:&lt;/p&gt; 
 &lt;a href="http://www.flickr.com/photos/ralsina/3298711851/" title="rst2qhc2 by ralsina_2000, on Flickr"&gt;&lt;img src="http://farm4.staticflickr.com/3332/3298711851_2c530309a0.jpg" width="500" height="313" alt="rst2qhc2"&gt;&lt;/a&gt;&lt;p&gt;The one on the right is nice to read. The one on the left is nice to write. The ar­row in the mid­dle is  &lt;a class="reference external" href="http://rst2qhc.googlecode.com"&gt;rst2qhc&lt;/a&gt;  :-)&lt;/p&gt; 
 &lt;p&gt;And here's how the gen­er­at­ed qhp file looks for a triv­ial out­line of a man­u­al (and the rea­son why I don't want to do this man­u­al­ly ;-):&lt;/p&gt; 
 &lt;pre class="code xml literal-block"&gt;
&lt;span class="cp"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;QtHelpProject&lt;/span&gt; &lt;span class="na"&gt;version=&lt;/span&gt;&lt;span class="s"&gt;"1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;namespace&amp;gt;&lt;/span&gt;urssus&lt;span class="nt"&gt;&amp;lt;/namespace&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;virtualFolder&amp;gt;&lt;/span&gt;doc&lt;span class="nt"&gt;&amp;lt;/virtualFolder&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;customFilter&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"Unknown"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;filterAttribute&amp;gt;&amp;lt;/filterAttribute&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/customFilter&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;filterSection&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;filterAttribute&amp;gt;&amp;lt;/filterAttribute&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;toc&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;title=&lt;/span&gt;&lt;span class="s"&gt;"The uRSSus Handbook"&lt;/span&gt; &lt;span class="na"&gt;ref=&lt;/span&gt;&lt;span class="s"&gt;"manual.html"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;title=&lt;/span&gt;&lt;span class="s"&gt;"Introduction"&lt;/span&gt; &lt;span class="na"&gt;ref=&lt;/span&gt;&lt;span class="s"&gt;"manual.html#introduction"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;title=&lt;/span&gt;&lt;span class="s"&gt;"Quick Start"&lt;/span&gt; &lt;span class="na"&gt;ref=&lt;/span&gt;&lt;span class="s"&gt;"manual.html#quick-start"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;title=&lt;/span&gt;&lt;span class="s"&gt;"Configuration"&lt;/span&gt; &lt;span class="na"&gt;ref=&lt;/span&gt;&lt;span class="s"&gt;"manual.html#configuration"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;title=&lt;/span&gt;&lt;span class="s"&gt;"Credits and License"&lt;/span&gt; &lt;span class="na"&gt;ref=&lt;/span&gt;&lt;span class="s"&gt;"manual.html#credits-and-license"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/toc&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;keywords&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;keyword&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"what can you"&lt;/span&gt; &lt;span class="na"&gt;ref=&lt;/span&gt;&lt;span class="s"&gt;"manual.html#what-can-you-do-using-urssus"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;keyword&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"quick"&lt;/span&gt; &lt;span class="na"&gt;ref=&lt;/span&gt;&lt;span class="s"&gt;"manual.html#quick-start"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;keyword&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"main window"&lt;/span&gt; &lt;span class="na"&gt;ref=&lt;/span&gt;&lt;span class="s"&gt;"manual.html#the-main-window"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/keywords&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;files&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;file&amp;gt;&lt;/span&gt;manual.html&lt;span class="nt"&gt;&amp;lt;/file&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/files&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/filterSection&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/QtHelpProject&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;Al­so, as a bonus, you can cre­ate PDF, La­TeX, HTML and ODT files from the same source (heck, you can cre­ate freak­ing man pages).&lt;/p&gt;&lt;/div&gt;</description><category>programming</category><category>python</category><category>qt</category><category>rst2qhc</category><category>urssus</category><guid>http://ralsina.com.ar/weblog/posts/BB777.html</guid><pubDate>Sun, 22 Feb 2009 03:18:00 GMT</pubDate></item></channel></rss>