Home | Trees | Indices | Help |
|
---|
|
1 # ============================================================================ 2 # 3 # Copyright (C) 2007-2008 Conceptive Engineering bvba. All rights reserved. 4 # www.conceptive.be / project-camelot@conceptive.be 5 # 6 # This file is part of the Camelot Library. 7 # 8 # This file may be used under the terms of the GNU General Public 9 # License version 2.0 as published by the Free Software Foundation 10 # and appearing in the file LICENSE.GPL included in the packaging of 11 # this file. Please review the following information to ensure GNU 12 # General Public Licensing requirements will be met: 13 # http://www.trolltech.com/products/qt/opensource.html 14 # 15 # If you are unsure which license is appropriate for your use, please 16 # review the following information: 17 # http://www.trolltech.com/products/qt/licensing.html or contact 18 # project-camelot@conceptive.be. 19 # 20 # This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 21 # WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 22 # 23 # For use of this library in commercial applications, please contact 24 # project-camelot@conceptive.be 25 # 26 # ============================================================================ 27 28 from PyQt4 import QtGui, QtCore 29 30 from camelot.core.utils import ugettext as _ 31 from camelot.view.art import Icon 32 from camelot.view.model_thread import post 33 3436 """FormPage is a generic wizard page that displays a form for an object 37 in a wizard page, subclass this class to use it. The class attribute 'Data' 38 should be the class of the object to be used to store the form information. 39 40 To access the data stored by the wizard form into a data object, use its 41 get_data method. 42 43 The 'Next' button will only be activated when the form is complete. 44 """ 45 46 icon = Icon('tango/32x32/mimetypes/x-office-spreadsheet.png') 47 title = None 48 sub_title = None 49 Data = None 50 Admin = None 5188 92 9553 54 from camelot.view.controls.formview import FormWidget 55 from camelot.view.proxy.collection_proxy import CollectionProxy 56 57 super(FormPage, self).__init__(parent) 58 assert self.Data 59 self.setTitle(unicode(self.get_title())) 60 self.setSubTitle(unicode(self.get_sub_title())) 61 self.setPixmap(QtGui.QWizard.LogoPixmap, self.get_icon().getQPixmap()) 62 self._data = self.Data() 63 self._complete = False 64 65 admin = self.get_admin() 66 self._model = CollectionProxy(admin, lambda:[self._data], admin.get_fields) 67 validator = self._model.get_validator() 68 69 layout = QtGui.QVBoxLayout() 70 form = FormWidget(admin) 71 self.connect(validator, validator.validity_changed_signal, self._validity_changed) 72 form.set_model(self._model) 73 layout.addWidget(form) 74 self.setLayout(layout)7577 # do inital validation, so the validity changed signal is valid 78 self._complete = False 79 self.emit(QtCore.SIGNAL('completeChanged()')) 80 self._validity_changed()81 86 87 post(is_valid, self._change_complete)97 from camelot.view.application_admin import get_application_admin 98 app_admin = get_application_admin() 99 if self.Admin: 100 return self.Admin(app_admin, self.Data) 101 return app_admin.get_entity_admin(self.Data)102 105 108110 return self.icon111 114
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Jun 12 15:42:14 2010 | http://epydoc.sourceforge.net |