Package ajango :: Package site :: Package sites :: Module container
[hide private]
[frames] | no frames]

Source Code for Module ajango.site.sites.container

 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  """ Modul generujacy kontener stron. 
20   
21  Obiekt pozwala na wyswietlenie kilku widokow jednoczenie na jednej stronie. 
22   
23  Obiekt Generujacy 
24  ================= 
25   
26  L{ajango.generator.views.container} 
27  """ 
28   
29   
30  from ajango.site.sites           import SiteBase 
31  from ajango.generator.views      import ViewBase 
32   
33 -class Site(SiteBase):
34 """ Klasa agregujaca strony. """
35 - def __init__(self, obj):
36 self.views = [] 37 self.container_layout = "" 38 SiteBase.__init__(self, obj)
39 - def init(self):
40 """ Inicjalizacja obiektu. """ 41 self.type = "container"
42 - def set_container_layout(self, layout):
43 """ 44 Ustawienie layoutu kontenera. 45 46 @param self: Instancja obiektu strony. 47 @param layout: Sposob wyswietlania strony I{horizontal} lub I{vertical} 48 """ 49 if layout != 'horizontal' and layout != 'vertical': 50 raise ValueError("there are unknown layout %r" % layout) 51 self.container_layout = layout
52 - def add_view(self, view):
53 """ Dodanie widoku do wyswietlenia w kontenerze. """ 54 if isinstance(view, ViewBase): 55 raise ValueError("view argument must be ViewBase type.") 56 self.views.append(view)
57 - def content(self):
58 """ Wykonanie zadan obiektu. """ 59 self.data['layout'] = self.container_layout 60 views_tab_data = [] 61 for view in self.views: 62 views_tab_data.append(view.make_content_and_get_data()) 63 self.data['views'] = views_tab_data
64