diff options
Diffstat (limited to 'doc/html/using.html')
-rw-r--r-- | doc/html/using.html | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/doc/html/using.html b/doc/html/using.html index f58e316..ea519af 100644 --- a/doc/html/using.html +++ b/doc/html/using.html @@ -343,7 +343,7 @@ copy constructor when it can never be called from Python? The answer is to prevent the automatic generation of a public copy constructor.</p> <p>We now look at the <tt class="docutils literal"><span class="pre">configure.py</span></tt> script. This is a little different to the script in the previous examples for two related reasons.</p> -<p>Firstly, PyTQt includes a pure Python module called <tt class="docutils literal"><span class="pre">pyqtconfig</span></tt> that extends +<p>Firstly, PyTQt includes a pure Python module called <tt class="docutils literal"><span class="pre">pytqtconfig</span></tt> that extends the SIP build system for modules, like our example, that build on top of PyTQt. It deals with the details of which version of TQt is being used (i.e. it determines what the correct tags are) and where it is installed. This is @@ -355,23 +355,23 @@ life easier for them.</p> <p>Now we have two scripts. First the <tt class="docutils literal"><span class="pre">configure.py</span></tt> script:</p> <div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">os</span> <span class="kn">import</span> <span class="nn">sipconfig</span> -<span class="kn">from</span> <span class="nn">PyTQt4</span> <span class="kn">import</span> <span class="n">pyqtconfig</span> +<span class="kn">from</span> <span class="nn">PyTQt4</span> <span class="kn">import</span> <span class="n">pytqtconfig</span> <span class="c"># The name of the SIP build file generated by SIP and used by the build</span> <span class="c"># system.</span> <span class="n">build_file</span> <span class="o">=</span> <span class="s">"hello.sbf"</span> <span class="c"># Get the PyTQt configuration information.</span> -<span class="n">config</span> <span class="o">=</span> <span class="n">pyqtconfig</span><span class="o">.</span><span class="n">Configuration</span><span class="p">()</span> +<span class="n">config</span> <span class="o">=</span> <span class="n">pytqtconfig</span><span class="o">.</span><span class="n">Configuration</span><span class="p">()</span> <span class="c"># Get the extra SIP flags needed by the imported PyTQt modules. Note that</span> <span class="c"># this normally only includes those flags (-x and -t) that relate to SIP's</span> <span class="c"># versioning system.</span> -<span class="n">pyqt_sip_flags</span> <span class="o">=</span> <span class="n">config</span><span class="o">.</span><span class="n">pyqt_sip_flags</span> +<span class="n">pytqt_sip_flags</span> <span class="o">=</span> <span class="n">config</span><span class="o">.</span><span class="n">pytqt_sip_flags</span> -<span class="c"># Run SIP to generate the code. Note that we tell SIP where to find the qt</span> +<span class="c"># Run SIP to generate the code. Note that we tell SIP where to find the tqt</span> <span class="c"># module's specification files using the -I flag.</span> -<span class="n">os</span><span class="o">.</span><span class="n">system</span><span class="p">(</span><span class="s">" "</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">config</span><span class="o">.</span><span class="n">sip_bin</span><span class="p">,</span> <span class="s">"-c"</span><span class="p">,</span> <span class="s">"."</span><span class="p">,</span> <span class="s">"-b"</span><span class="p">,</span> <span class="n">build_file</span><span class="p">,</span> <span class="s">"-I"</span><span class="p">,</span> <span class="n">config</span><span class="o">.</span><span class="n">pyqt_sip_dir</span><span class="p">,</span> <span class="n">pyqt_sip_flags</span><span class="p">,</span> <span class="s">"hello.sip"</span><span class="p">]))</span> +<span class="n">os</span><span class="o">.</span><span class="n">system</span><span class="p">(</span><span class="s">" "</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">config</span><span class="o">.</span><span class="n">sip_bin</span><span class="p">,</span> <span class="s">"-c"</span><span class="p">,</span> <span class="s">"."</span><span class="p">,</span> <span class="s">"-b"</span><span class="p">,</span> <span class="n">build_file</span><span class="p">,</span> <span class="s">"-I"</span><span class="p">,</span> <span class="n">config</span><span class="o">.</span><span class="n">pytqt_sip_dir</span><span class="p">,</span> <span class="n">pytqt_sip_flags</span><span class="p">,</span> <span class="s">"hello.sip"</span><span class="p">]))</span> <span class="c"># We are going to install the SIP specification file for this module and</span> <span class="c"># its configuration module.</span> @@ -382,9 +382,9 @@ life easier for them.</p> <span class="n">installs</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">"helloconfig.py"</span><span class="p">,</span> <span class="n">config</span><span class="o">.</span><span class="n">default_mod_dir</span><span class="p">])</span> <span class="c"># Create the Makefile. The TQtGuiModuleMakefile class provided by the</span> -<span class="c"># pyqtconfig module takes care of all the extra preprocessor, compiler and</span> +<span class="c"># pytqtconfig module takes care of all the extra preprocessor, compiler and</span> <span class="c"># linker flags needed by the TQt library.</span> -<span class="n">makefile</span> <span class="o">=</span> <span class="n">pyqtconfig</span><span class="o">.</span><span class="n">TQtGuiModuleMakefile</span><span class="p">(</span> +<span class="n">makefile</span> <span class="o">=</span> <span class="n">pytqtconfig</span><span class="o">.</span><span class="n">TQtGuiModuleMakefile</span><span class="p">(</span> <span class="n">configuration</span><span class="o">=</span><span class="n">config</span><span class="p">,</span> <span class="n">build_file</span><span class="o">=</span><span class="n">build_file</span><span class="p">,</span> <span class="n">installs</span><span class="o">=</span><span class="n">installs</span> @@ -407,10 +407,10 @@ life easier for them.</p> <span class="s">"hello_sip_dir"</span><span class="p">:</span> <span class="n">config</span><span class="o">.</span><span class="n">default_sip_dir</span><span class="p">,</span> <span class="c"># Publish the set of SIP flags needed by this module. As these are the</span> - <span class="c"># same flags needed by the qt module we could leave it out, but this</span> + <span class="c"># same flags needed by the tqt module we could leave it out, but this</span> <span class="c"># allows us to change the flags at a later date without breaking</span> <span class="c"># scripts that import the configuration module.</span> - <span class="s">"hello_sip_flags"</span><span class="p">:</span> <span class="n">pyqt_sip_flags</span> + <span class="s">"hello_sip_flags"</span><span class="p">:</span> <span class="n">pytqt_sip_flags</span> <span class="p">}</span> <span class="c"># This creates the helloconfig.py module from the helloconfig.py.in</span> @@ -419,14 +419,14 @@ life easier for them.</p> </pre></div> </div> <p>Next we have the <tt class="docutils literal"><span class="pre">helloconfig.py.in</span></tt> template script:</p> -<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">PyTQt4</span> <span class="kn">import</span> <span class="n">pyqtconfig</span> +<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">PyTQt4</span> <span class="kn">import</span> <span class="n">pytqtconfig</span> <span class="c"># These are installation specific values created when Hello was configured.</span> <span class="c"># The following line will be replaced when this template is used to create</span> <span class="c"># the final configuration module.</span> <span class="c"># @SIP_CONFIGURATION@</span> -<span class="k">class</span> <span class="nc">Configuration</span><span class="p">(</span><span class="n">pyqtconfig</span><span class="o">.</span><span class="n">Configuration</span><span class="p">):</span> +<span class="k">class</span> <span class="nc">Configuration</span><span class="p">(</span><span class="n">pytqtconfig</span><span class="o">.</span><span class="n">Configuration</span><span class="p">):</span> <span class="sd">"""The class that represents Hello configuration values.</span> <span class="sd"> """</span> <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sub_cfg</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span> @@ -444,9 +444,9 @@ life easier for them.</p> <span class="n">cfg</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">_pkg_config</span><span class="p">)</span> - <span class="n">pyqtconfig</span><span class="o">.</span><span class="n">Configuration</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cfg</span><span class="p">)</span> + <span class="n">pytqtconfig</span><span class="o">.</span><span class="n">Configuration</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cfg</span><span class="p">)</span> -<span class="k">class</span> <span class="nc">HelloModuleMakefile</span><span class="p">(</span><span class="n">pyqtconfig</span><span class="o">.</span><span class="n">TQtGuiModuleMakefile</span><span class="p">):</span> +<span class="k">class</span> <span class="nc">HelloModuleMakefile</span><span class="p">(</span><span class="n">pytqtconfig</span><span class="o">.</span><span class="n">TQtGuiModuleMakefile</span><span class="p">):</span> <span class="sd">"""The Makefile class for modules that %Import hello.</span> <span class="sd"> """</span> <span class="k">def</span> <span class="nf">finalise</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> @@ -456,7 +456,7 @@ life easier for them.</p> <span class="bp">self</span><span class="o">.</span><span class="n">extra_libs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s">"hello"</span><span class="p">)</span> <span class="c"># Let the super-class do what it needs to.</span> - <span class="n">pyqtconfig</span><span class="o">.</span><span class="n">TQtGuiModuleMakefile</span><span class="o">.</span><span class="n">finalise</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> + <span class="n">pytqtconfig</span><span class="o">.</span><span class="n">TQtGuiModuleMakefile</span><span class="o">.</span><span class="n">finalise</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> </pre></div> </div> <p>Again, we hope that the scripts are self documenting.</p> |