/usr/share/doc/python-gtkmvc-doc/userman/mvc.html is in python-gtkmvc-doc 1.99.1-1build1.
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 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | <!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>Implementation of the MVC pattern — Model-View-Controller and Observer patterns for PyGTK 1.99.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '1.99.1',
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="top" title="Model-View-Controller and Observer patterns for PyGTK 1.99.1 documentation" href="index.html" />
<link rel="up" title="MVC-O Infrastructure" href="mvco.html" />
<link rel="next" title="Implementation of the Observer pattern" href="obs.html" />
<link rel="prev" title="MVC-O Infrastructure" href="mvco.html" />
</head>
<body>
<div class="related">
<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="obs.html" title="Implementation of the Observer pattern"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="mvco.html" title="MVC-O Infrastructure"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Model-View-Controller and Observer patterns for PyGTK 1.99.1 documentation</a> »</li>
<li><a href="mvco.html" accesskey="U">MVC-O Infrastructure</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="implementation-of-the-mvc-pattern">
<h1>Implementation of the MVC pattern<a class="headerlink" href="#implementation-of-the-mvc-pattern" title="Permalink to this headline">¶</a></h1>
<p>The implementation of the <em>MVC</em> pattern provided by <em>gtkmvc</em> is a dialect
version of the “official” pattern generally described by Software
Engineering Theory <a class="footnote-reference" href="#theory" id="id1">[1]</a>.</p>
<div class="figure align-center" id="mvc-f">
<img alt="_images/mvc.png" src="_images/mvc.png" style="width: 8cm;" />
<p class="caption">Simplified Model-View-Controller Pattern</p>
</div>
<p>The implementation is different as the view side cannot see the model
part. The reasons behind this difference will be explained later, but
we can anticipate here that this is due to the relationship between
the view and the controller, that is stronger in <em>gtkmvc</em> than in the
classic <em>MVC</em> pattern. To a certin extend, in <em>gtkmvc</em> the view and the
controller parts are separate but could be considered as a unique
entity. However, a view can have multiple controllers (or a single
controller decomposed into many sub-controllers for the sake of
semplicity).</p>
<p>Figure <a class="reference internal" href="#mvc-f"><em>Simplified Model-View-Controller Pattern</em></a> shows three interconnected parts:</p>
<dl class="docutils">
<dt>Model</dt>
<dd><p class="first">Contains the <em>state</em> (the <em>logic</em>) of the
application. Also it provides support to access and modify the
state, and knows how to handle dependencies between different parts
in the state. For example the application logic could require that
changing a variable, causes a changing of another. It is not
required the model user to be aware about this dependency, because
model autonomously handles it.</p>
<p class="last">Zero, one or more <em>Controllers</em> can be connected to one Model
(see <em>Controller</em>, below). Furthermore, one or more
<em>Views</em> can be associated with parts of the state; for example
a numerical variable could be visualized as a number, as well as a
graphic bar. It is important to remark that <em>a Model does not
know that a set of Views is possibly connected to its state
through a set of Controllers</em>.</p>
</dd>
<dt>View</dt>
<dd><p class="first">Shows parts of the Model state, and interactively
exchanges information with the User, via input/output devices.
A view can be dcomposed into sub-views to simplify the design and
the reuse.</p>
<p>A View collects a set of widget trees built from a <em>Glade</em> or
<em>gtk.Builder</em> file, and/or constructed by hand. Since a Widget
contains a <em>state</em>, this implementation differs from the standard
<em>MVC</em> pattern, where generally the View side is completely
<em>stateless</em>.</p>
<p>The View also interacts with zero, one or more <em>Controllers</em>
(see below), sending to it signals, and receiving information to
visualize.</p>
<p class="last">A View does not know the semantics concerning what it visualizes,
and neither knows that it is possibly connected to a set of
controllers.</p>
</dd>
<dt>Controller</dt>
<dd><p class="first">Realizes the connection between Models and Views.
A Controller contains the <em>GUI</em> logic: for example, it stores the
information about what happens when a button is clicked (e.g.
handlers of signal are located inside a Controller.)</p>
<p class="last">A Controller perfectly knows the interfaces of the connected Model
and View, and knows both the state and presentation (<em>GUI</em>)
semantics. A Controller is associated to one Model (<em>use a</em>
relationship), and in the current implementation is associated
only to one View (<em>has a</em> relationship). A Controller may
grow in size, thus it is important to avoid including into the
Controller code and information that should resize into the
Model. Also Controller can be simplified by decomposing them into
sub-controllers, each controlling a subset of the View.</p>
</dd>
</dl>
<p>Two particular mechanisms make the isolation between Model and
Controller, and between View and Controller. To support the former,
the <em>Observer</em> pattern is provided (see <a class="reference internal" href="obs.html"><em>Implementation of the Observer pattern</em></a>), whereas latter mechanism is
provided by the <em>MVC</em> pattern, and that is explained in <a class="reference internal" href="#vr"><em>View Registration</em></a>.</p>
<div class="section" id="view-registration">
<span id="vr"></span><h2>View Registration<a class="headerlink" href="#view-registration" title="Permalink to this headline">¶</a></h2>
<p>Current implementation allows a N-1 relationship between Controller
and View. More clearly, one view can have multiple controllers
associated to it, meaning that a View can be shared among several
Controllers. A typical design for large views and controllers makes a
View be split into sets (not necessarily partitions) and each set is
controller by a sub-controller.</p>
<p>After a model and a view have been instantiated (model and view are
<em>independent</em>, a controller can be constructed by passing them.</p>
<p>From there on, the Controller can access the model, and teh view state
(the set of contained widgets). When the view registers itself with a
Controller, all signals are also automatically connected to the
corresponding methods inside the Controller. Connection in this case
is performed by means of an implicit syntax rule, which binds a signal
name to a corresponding method name.</p>
<p>In sections <a class="reference internal" href="impl.html#vr-d"><em>View registration</em></a> and <a class="reference internal" href="impl.html#vr-ex"><em>An example about View Registration</em></a> more details and an example are
presented, to show how the View registration mechanism can be
exploited by controllers to connect signals and handle the creation of
particular widgets like for example TreeViews, TreeColumns,
CellRenderers, etc.</p>
<table class="docutils footnote" frame="void" id="theory" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>For example, see <a class="reference external" href="http://www.mimuw.edu.pl/~sl/teaching/00_01/Delfin_EC/Overviews/MVC.htm">http://www.mimuw.edu.pl/~sl/teaching/00_01/Delfin_EC/Overviews/MVC.htm</a></td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Implementation of the MVC pattern</a><ul>
<li><a class="reference internal" href="#view-registration">View Registration</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="mvco.html"
title="previous chapter">MVC-O Infrastructure</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="obs.html"
title="next chapter">Implementation of the Observer pattern</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/mvc.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<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="obs.html" title="Implementation of the Observer pattern"
>next</a> |</li>
<li class="right" >
<a href="mvco.html" title="MVC-O Infrastructure"
>previous</a> |</li>
<li><a href="index.html">Model-View-Controller and Observer patterns for PyGTK 1.99.1 documentation</a> »</li>
<li><a href="mvco.html" >MVC-O Infrastructure</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2010, Roberto Cavada.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>
|