Package ajango :: Package database :: Package columns :: Module button
[hide private]
[frames] | no frames]

Source Code for Module ajango.database.columns.button

 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 kolumny z przyciskiem. """ 
20   
21  from ajango.database.columns import ColumnBase 
22   
23 -class Column(ColumnBase):
24 """ Klasa kolumny z przyciskiem. """
25 - def __init__(self, xmldoc, param=None):
26 self.view = None 27 self.value = None 28 ColumnBase.__init__(self, xmldoc, param)
29 - def pre_init(self):
30 """ Czynnosci do wykonania przed inicjalizacja. """ 31 self.type = 'button'
32 - def read_from_xml(self, xmldoc):
33 """ Inicjalizacja z danych XML. """ 34 ColumnBase.read_from_xml(self, xmldoc) 35 self.view = self.getAttribute('view') 36 self.value = self.getAttribute('value')
37 - def read_from_dict(self, params):
38 """ Inicjalizacja ze zmiennej slownikowej. """ 39 ColumnBase.read_from_dict(self, params) 40 self.view = self.object['view']
41 - def execute(self, view, view_name='view'):
42 """ Wykonanie czynnosci kolumny. """ 43 view.add_line("%s.add_column({'type' : 'button', " 44 "'label' : %r, " 45 "'tag' : %r, " 46 "'view' : %r})" % 47 (view_name, self.label, self.tag, self.view))
48 - def prepare_data(self):
49 """ Przygotowanie danych. """ 50 ColumnBase.prepare_data(self) 51 self.data['view'] = self.view
52 - def get_data(self, value=None):
53 """ Pobranie danych dla szablonu. """ 54 self.prepare_data() 55 result = value['result'] 56 data = dict(self.data) 57 data['id'] = result.get_element('id') 58 data['type'] = self.type 59 return data
60