| Home | Trees | Indices | Help |
|---|
|
|
1 ###########################################################################
2 # #
3 # Copyright (C) 2016 Rafal Kobel <rafyco1@gmail.com> #
4 # #
5 # This program is free software: you can redistribute it and/or modify #
6 # it under the terms of the GNU General Public License as published by #
7 # the Free Software Foundation, either version 3 of the License, or #
8 # (at your option) any later version. #
9 # #
10 # This program is distributed in the hope that it will be useful, #
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
13 # GNU General Public License for more details. #
14 # #
15 # You should have received a copy of the GNU General Public License #
16 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
17 # #
18 ###########################################################################
19 """
20 Obiekt generujacy kontener stron.
21
22 Obiekt generuje kod obsugujacy strone agregujaca widoki.
23
24 Dostepne znaczniki
25 ==================
26
27 1. B{LAYOUT} - Opcja okreslajaca sposob agregacji stron.
28 - I{name} - Przyjmuje wartosc I{horizontal} lub I{vertical} (domyslnie).
29 2. B{VIEW} - widok agregujacy L{wiecej <ajango.generator.views>}.
30
31 Generowany obiekt
32 =================
33
34 L{ajango.site.sites.container}
35 """
36
37 from ajango.generator.views import ViewBase
38 from ajango.generator.views import view_factory
39 from ajango.generator.config_global import ConfigGlobal
40
42 """ Klasa widoku kontenerowego. """
44 self.views = []
45 self.layout = "vertical"
46 ViewBase.__init__(self, xmldoc, importRenderer, app)
48 """ Metoda inicjalizujaca. """
49 self.type = "container"
50 self.add_permited(["VIEW", "LAYOUT"])
52 """ Oczytanie nodow wewnetrznych. """
53 if ViewBase.check(self, name, xmldoc_elem):
54 return True
55 if name.upper() == "LAYOUT":
56 self.layout = xmldoc_elem.getAttribute('name')
57 if self.layout != 'horizontal' and self.layout != 'vertical':
58 raise ValueError("there are unknown layout %r" %
59 self.layout)
60 return True
61 if name.upper() == "VIEW":
62 view = view_factory({'xmldoc' : xmldoc_elem,
63 'imp_renderer' : self.renderer,
64 'app' : self.app})
65 self.views.append(view)
66 return True
67 return False
69 """ Budowanie kodu i wypelnianie renderera."""
70 for elem in self.views:
71 id_elem = ConfigGlobal().get('view_id_counter')
72 ConfigGlobal().set('view_id_counter', id_elem + 1)
73 elem.make_view_execute("view_%d" % id_elem)
74 self.add_line("%s.add_view(view_%d)" % (view_name, id_elem))
75 self.add_line("%s.set_container_layout(%r)" % (view_name, self.layout))
76
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Thu Oct 20 21:01:52 2016 | http://epydoc.sourceforge.net |