<aname="L6"></a><ttclass="py-lineno"> 6</tt><ttclass="py-line"><ttclass="py-comment"></tt><ttclass="py-comment"># This program is free software; you can redistribute it and/or</tt></tt>
<aname="L7"></a><ttclass="py-lineno"> 7</tt><ttclass="py-line"><ttclass="py-comment"></tt><ttclass="py-comment"># modify it under the terms of the GNU General Public License</tt></tt>
<aname="L8"></a><ttclass="py-lineno"> 8</tt><ttclass="py-line"><ttclass="py-comment"></tt><ttclass="py-comment"># as published by the Free Software Foundation; either version 2 </tt></tt>
<aname="L9"></a><ttclass="py-lineno"> 9</tt><ttclass="py-line"><ttclass="py-comment"></tt><ttclass="py-comment"># of the License, or (at your option) any later version.</tt></tt>
<aname="L11"></a><ttclass="py-lineno"> 11</tt><ttclass="py-line"><ttclass="py-comment"></tt><ttclass="py-comment"># This program is distributed in the hope that it will be useful,</tt></tt>
<aname="L12"></a><ttclass="py-lineno"> 12</tt><ttclass="py-line"><ttclass="py-comment"></tt><ttclass="py-comment"># but WITHOUT ANY WARRANTY; without even the implied warranty of</tt></tt>
<aname="L13"></a><ttclass="py-lineno"> 13</tt><ttclass="py-line"><ttclass="py-comment"></tt><ttclass="py-comment"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</tt></tt>
<aname="L14"></a><ttclass="py-lineno"> 14</tt><ttclass="py-line"><ttclass="py-comment"></tt><ttclass="py-comment"># GNU General Public License for more details. </tt></tt>
<aname="L16"></a><ttclass="py-lineno"> 16</tt><ttclass="py-line"><ttclass="py-comment"></tt><ttclass="py-comment"># You should have received a copy of the GNU General Public License</tt></tt>
<aname="L17"></a><ttclass="py-lineno"> 17</tt><ttclass="py-line"><ttclass="py-comment"></tt><ttclass="py-comment"># along with this program; if not, write to the Free Software</tt></tt>
<aname="L18"></a><ttclass="py-lineno"> 18</tt><ttclass="py-line"><ttclass="py-comment"></tt><ttclass="py-comment"># Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</tt></tt>
<aname="L23"></a><ttclass="py-lineno"> 23</tt><ttclass="py-line"><ttclass="py-docstring">LyX only allows you to insert keys at the current cursor position.</tt></tt>
</div><divid="LyX.connect-collapsed"style="display:none;"pad="+++"indent="++++++++"></div><divid="LyX.connect-expanded"><aname="L42"></a><ttclass="py-lineno"> 42</tt><ttclass="py-line"><ttclass="py-docstring">"""Establish connection with LyX.</tt></tt>
<aname="L44"></a><ttclass="py-lineno"> 44</tt><ttclass="py-line"><ttclass="py-docstring"> Common failures are: nonexitent pipe, or LyX not running...</tt></tt>
<aname="L58"></a><ttclass="py-lineno"> 58</tt><ttclass="py-line"><ttclass="py-keyword">raise</tt><ttid="link-11"class="py-name"><atitle="Pyblio.Cite.WP.CommunicationError"class="py-name"href="#"onclick="return doclink('link-11', 'CommunicationError', 'link-3');">CommunicationError</a></tt><ttclass="py-op">(</tt><ttclass="py-name">_</tt><ttclass="py-op">(</tt><ttclass="py-string">"pipe %r is not connected to LyX"</tt><ttclass="py-op">)</tt><ttclass="py-op">%</tt><ttid="link-12"class="py-name"><atitle="Pyblio.Cite.WP.OpenOffice.f"class="py-name"href="#"onclick="return doclink('link-12', 'f', 'link-7');">f</a></tt><ttclass="py-op">)</tt></tt>
</div><divid="LyX.cite-collapsed"style="display:none;"pad="+++"indent="++++++++"></div><divid="LyX.cite-expanded"><aname="L81"></a><ttclass="py-lineno"> 81</tt><ttclass="py-line"><ttclass="py-docstring">""" Insert the keys in the actual wordprocessor document. Each</tt></tt>
<aname="L82"></a><ttclass="py-lineno"> 82</tt><ttclass="py-line"><ttclass="py-docstring"> key contains the actual key and a readable representation for</tt></tt>
<aname="L83"></a><ttclass="py-lineno"> 83</tt><ttclass="py-line"><ttclass="py-docstring"> the reference.</tt></tt>
<aname="L90"></a><ttclass="py-lineno"> 90</tt><ttclass="py-line"><ttclass="py-keyword">raise</tt><ttid="link-21"class="py-name"><atitle="Pyblio.Cite.WP.OperationError"class="py-name"href="#"onclick="return doclink('link-21', 'OperationError', 'link-4');">OperationError</a></tt><ttclass="py-op">(</tt><ttclass="py-name">_</tt><ttclass="py-op">(</tt><ttclass="py-string">"Cannot cite when not connected"</tt><ttclass="py-op">)</tt><ttclass="py-op">)</tt></tt>
<aname="L92"></a><ttclass="py-lineno"> 92</tt><ttclass="py-line"><ttclass="py-comment"># For bibtex databases, we use the actual bibtex key as the</tt></tt>
<aname="L93"></a><ttclass="py-lineno"> 93</tt><ttclass="py-line"><ttclass="py-comment"></tt><ttclass="py-comment"># citation key. This allows us to cite with pyblio and</tt></tt>
<aname="L94"></a><ttclass="py-lineno"> 94</tt><ttclass="py-line"><ttclass="py-comment"></tt><ttclass="py-comment"># generate the actual bibliography with bibtex. Once we are</tt></tt>
<aname="L95"></a><ttclass="py-lineno"> 95</tt><ttclass="py-line"><ttclass="py-comment"></tt><ttclass="py-comment"># able to superceed bibtex totally, we might adopt a more</tt></tt>
<aname="L96"></a><ttclass="py-lineno"> 96</tt><ttclass="py-line"><ttclass="py-comment"></tt><ttclass="py-comment"># general scheme.</tt></tt>
<aname="L98"></a><ttclass="py-lineno"> 98</tt><ttclass="py-line"><ttclass="py-keyword">raise</tt><ttid="link-23"class="py-name"><atitle="Pyblio.Cite.WP.OperationError"class="py-name"href="#"onclick="return doclink('link-23', 'OperationError', 'link-4');">OperationError</a></tt><ttclass="py-op">(</tt><ttclass="py-name">_</tt><ttclass="py-op">(</tt><ttclass="py-string">"LyX only allows citing from BibTeX"</tt><ttclass="py-op">)</tt><ttclass="py-op">)</tt></tt>
</div><divid="LyX._send-collapsed"style="display:none;"pad="+++"indent="++++++++"></div><divid="LyX._send-expanded"><aname="L122"></a><ttclass="py-lineno">122</tt><ttclass="py-line"><ttclass="py-docstring">"""Send a command 'msg' to the LyX process.</tt></tt>
<aname="L124"></a><ttclass="py-lineno">124</tt><ttclass="py-line"><ttclass="py-docstring"> Once a client has identified itself, it can issue commands in</tt></tt>
<aname="L125"></a><ttclass="py-lineno">125</tt><ttclass="py-line"><ttclass="py-docstring"> its own context 'base'.</tt></tt>
<aname="L155"></a><ttclass="py-lineno">155</tt><ttclass="py-line"><ttclass="py-comment"># if the answer is empty or starts with "ERROR", there is sth</tt></tt>
<aname="L159"></a><ttclass="py-lineno">159</tt><ttclass="py-line"><ttclass="py-keyword">raise</tt><ttid="link-39"class="py-name"><atitle="Pyblio.Cite.WP.CommunicationError"class="py-name"href="#"onclick="return doclink('link-39', 'CommunicationError', 'link-3');">CommunicationError</a></tt><ttclass="py-op">(</tt><ttclass="py-name">_</tt><ttclass="py-op">(</tt><ttclass="py-string">"LyX did not answer to our request"</tt><ttclass="py-op">)</tt><ttclass="py-op">)</tt></tt>