/usr/share/doc/python-pyqtgraph-doc/html/_modules/pyqtgraph/widgets/LayoutWidget.html is in python-pyqtgraph-doc 0.10.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pyqtgraph.widgets.LayoutWidget — pyqtgraph 0.10.0 documentation</title>
<link rel="stylesheet" href="../../../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '0.10.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="top" title="pyqtgraph 0.10.0 documentation" href="../../../index.html" />
<link rel="up" title="pyqtgraph" href="../../pyqtgraph.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">pyqtgraph 0.10.0 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> »</li>
<li class="nav-item nav-item-2"><a href="../../pyqtgraph.html" accesskey="U">pyqtgraph</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<h1>Source code for pyqtgraph.widgets.LayoutWidget</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span> <span class="nn">..Qt</span> <span class="k">import</span> <span class="n">QtGui</span><span class="p">,</span> <span class="n">QtCore</span>
<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'LayoutWidget'</span><span class="p">]</span>
<div class="viewcode-block" id="LayoutWidget"><a class="viewcode-back" href="../../../widgets/layoutwidget.html#pyqtgraph.LayoutWidget">[docs]</a><span class="k">class</span> <span class="nc">LayoutWidget</span><span class="p">(</span><span class="n">QtGui</span><span class="o">.</span><span class="n">QWidget</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Convenience class used for laying out QWidgets in a grid.</span>
<span class="sd"> (It's just a little less effort to use than QGridLayout)</span>
<span class="sd"> """</span>
<div class="viewcode-block" id="LayoutWidget.__init__"><a class="viewcode-back" href="../../../widgets/layoutwidget.html#pyqtgraph.LayoutWidget.__init__">[docs]</a> <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">parent</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="n">QtGui</span><span class="o">.</span><span class="n">QWidget</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">parent</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">layout</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QGridLayout</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">setLayout</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">layout</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">items</span> <span class="o">=</span> <span class="p">{}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="p">{}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">currentRow</span> <span class="o">=</span> <span class="mi">0</span>
<span class="bp">self</span><span class="o">.</span><span class="n">currentCol</span> <span class="o">=</span> <span class="mi">0</span></div>
<div class="viewcode-block" id="LayoutWidget.nextRow"><a class="viewcode-back" href="../../../widgets/layoutwidget.html#pyqtgraph.LayoutWidget.nextRow">[docs]</a> <span class="k">def</span> <span class="nf">nextRow</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">"""Advance to next row for automatic widget placement"""</span>
<span class="bp">self</span><span class="o">.</span><span class="n">currentRow</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="bp">self</span><span class="o">.</span><span class="n">currentCol</span> <span class="o">=</span> <span class="mi">0</span></div>
<div class="viewcode-block" id="LayoutWidget.nextColumn"><a class="viewcode-back" href="../../../widgets/layoutwidget.html#pyqtgraph.LayoutWidget.nextColumn">[docs]</a> <span class="k">def</span> <span class="nf">nextColumn</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">colspan</span><span class="o">=</span><span class="mi">1</span><span class="p">):</span>
<span class="sd">"""Advance to next column, while returning the current column number </span>
<span class="sd"> (generally only for internal use--called by addWidget)"""</span>
<span class="bp">self</span><span class="o">.</span><span class="n">currentCol</span> <span class="o">+=</span> <span class="n">colspan</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">currentCol</span><span class="o">-</span><span class="n">colspan</span></div>
<div class="viewcode-block" id="LayoutWidget.nextCol"><a class="viewcode-back" href="../../../widgets/layoutwidget.html#pyqtgraph.LayoutWidget.nextCol">[docs]</a> <span class="k">def</span> <span class="nf">nextCol</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kargs</span><span class="p">):</span>
<span class="sd">"""Alias of nextColumn"""</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">nextColumn</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kargs</span><span class="p">)</span></div>
<div class="viewcode-block" id="LayoutWidget.addLabel"><a class="viewcode-back" href="../../../widgets/layoutwidget.html#pyqtgraph.LayoutWidget.addLabel">[docs]</a> <span class="k">def</span> <span class="nf">addLabel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="s1">' '</span><span class="p">,</span> <span class="n">row</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">col</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">rowspan</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">colspan</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="o">**</span><span class="n">kargs</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Create a QLabel with *text* and place it in the next available cell (or in the cell specified)</span>
<span class="sd"> All extra keyword arguments are passed to QLabel().</span>
<span class="sd"> Returns the created widget.</span>
<span class="sd"> """</span>
<span class="n">text</span> <span class="o">=</span> <span class="n">QtGui</span><span class="o">.</span><span class="n">QLabel</span><span class="p">(</span><span class="n">text</span><span class="p">,</span> <span class="o">**</span><span class="n">kargs</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">addItem</span><span class="p">(</span><span class="n">text</span><span class="p">,</span> <span class="n">row</span><span class="p">,</span> <span class="n">col</span><span class="p">,</span> <span class="n">rowspan</span><span class="p">,</span> <span class="n">colspan</span><span class="p">)</span>
<span class="k">return</span> <span class="n">text</span></div>
<div class="viewcode-block" id="LayoutWidget.addLayout"><a class="viewcode-back" href="../../../widgets/layoutwidget.html#pyqtgraph.LayoutWidget.addLayout">[docs]</a> <span class="k">def</span> <span class="nf">addLayout</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">row</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">col</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">rowspan</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">colspan</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="o">**</span><span class="n">kargs</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Create an empty LayoutWidget and place it in the next available cell (or in the cell specified)</span>
<span class="sd"> All extra keyword arguments are passed to :func:`LayoutWidget.__init__ <pyqtgraph.LayoutWidget.__init__>`</span>
<span class="sd"> Returns the created widget.</span>
<span class="sd"> """</span>
<span class="n">layout</span> <span class="o">=</span> <span class="n">LayoutWidget</span><span class="p">(</span><span class="o">**</span><span class="n">kargs</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">addItem</span><span class="p">(</span><span class="n">layout</span><span class="p">,</span> <span class="n">row</span><span class="p">,</span> <span class="n">col</span><span class="p">,</span> <span class="n">rowspan</span><span class="p">,</span> <span class="n">colspan</span><span class="p">)</span>
<span class="k">return</span> <span class="n">layout</span></div>
<div class="viewcode-block" id="LayoutWidget.addWidget"><a class="viewcode-back" href="../../../widgets/layoutwidget.html#pyqtgraph.LayoutWidget.addWidget">[docs]</a> <span class="k">def</span> <span class="nf">addWidget</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="n">row</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">col</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">rowspan</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">colspan</span><span class="o">=</span><span class="mi">1</span><span class="p">):</span>
<span class="sd">"""</span>
<span class="sd"> Add a widget to the layout and place it in the next available cell (or in the cell specified).</span>
<span class="sd"> """</span>
<span class="k">if</span> <span class="n">row</span> <span class="o">==</span> <span class="s1">'next'</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">nextRow</span><span class="p">()</span>
<span class="n">row</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">currentRow</span>
<span class="k">elif</span> <span class="n">row</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">row</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">currentRow</span>
<span class="k">if</span> <span class="n">col</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">col</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nextCol</span><span class="p">(</span><span class="n">colspan</span><span class="p">)</span>
<span class="k">if</span> <span class="n">row</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">rows</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">rows</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">rows</span><span class="p">[</span><span class="n">row</span><span class="p">][</span><span class="n">col</span><span class="p">]</span> <span class="o">=</span> <span class="n">item</span>
<span class="bp">self</span><span class="o">.</span><span class="n">items</span><span class="p">[</span><span class="n">item</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="n">col</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">layout</span><span class="o">.</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">row</span><span class="p">,</span> <span class="n">col</span><span class="p">,</span> <span class="n">rowspan</span><span class="p">,</span> <span class="n">colspan</span><span class="p">)</span></div>
<div class="viewcode-block" id="LayoutWidget.getWidget"><a class="viewcode-back" href="../../../widgets/layoutwidget.html#pyqtgraph.LayoutWidget.getWidget">[docs]</a> <span class="k">def</span> <span class="nf">getWidget</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">row</span><span class="p">,</span> <span class="n">col</span><span class="p">):</span>
<span class="sd">"""Return the widget in (*row*, *col*)"""</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">row</span><span class="p">[</span><span class="n">row</span><span class="p">][</span><span class="n">col</span><span class="p">]</span></div></div>
<span class="c1">#def itemIndex(self, item):</span>
<span class="c1">#for i in range(self.layout.count()):</span>
<span class="c1">#if self.layout.itemAt(i).graphicsItem() is item:</span>
<span class="c1">#return i</span>
<span class="c1">#raise Exception("Could not determine index of item " + str(item))</span>
<span class="c1">#def removeItem(self, item):</span>
<span class="c1">#"""Remove *item* from the layout."""</span>
<span class="c1">#ind = self.itemIndex(item)</span>
<span class="c1">#self.layout.removeAt(ind)</span>
<span class="c1">#self.scene().removeItem(item)</span>
<span class="c1">#r,c = self.items[item]</span>
<span class="c1">#del self.items[item]</span>
<span class="c1">#del self.rows[r][c]</span>
<span class="c1">#self.update()</span>
<span class="c1">#def clear(self):</span>
<span class="c1">#items = []</span>
<span class="c1">#for i in list(self.items.keys()):</span>
<span class="c1">#self.removeItem(i)</span>
</pre></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../../../search.html" method="get">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">pyqtgraph 0.10.0 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> »</li>
<li class="nav-item nav-item-2"><a href="../../pyqtgraph.html" >pyqtgraph</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2016, Luke Campagnola.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.8.
</div>
</body>
</html>
|