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 """Functionallity common to TableViews and FormViews 29 """ 30 31 from PyQt4 import QtCore, QtGui 32 33 from camelot.view.model_thread import post, gui_function, model_function36 """A string used to format the title of the view :: 37 38 title_format = 'Movie rental overview' 39 40 .. attribute:: header_widget 41 42 The widget class to be used as a header in the table view:: 43 44 header_widget = None 45 """ 46 47 title_format = '' 48 header_widget = None 49 50 title_changed_signal = QtCore.SIGNAL('titleChanged(const QString&)') 51 52 @gui_function8254 """Will emit the title_changed_signal""" 55 import sip 56 if not sip.isdeleted(self): 57 self.emit(self.title_changed_signal, unicode(new_title))58 59 @model_function 62 63 @model_function65 from camelot.view.export.word import open_html_in_word 66 html = self.to_html() 67 open_html_in_word(html)68 69 @model_function71 from camelot.view.export.excel import open_data_with_excel 72 title = self.getTitle() 73 columns = self.getColumns() 74 data = [d for d in self.getData()] 75 open_data_with_excel(title, columns, data)76 77 @model_function79 from camelot.view.export.outlook import open_html_in_outlook 80 html = self.to_html() 81 open_html_in_outlook(html)84 """Class to combine multiple views in Tabs and let them behave as one view. This class can be 85 used when defining custom create_table_view methods on an ObjectAdmin class to group multiple 86 table views together in one view. 87 """ 88109 11390 """ 91 :param views: a list of the views to combine 92 """ 93 AbstractView.__init__(self, parent) 94 layout = QtGui.QVBoxLayout() 95 if self.header_widget: 96 self.header = self.header_widget(self, admin) 97 else: 98 self.header = None 99 layout.addWidget(self.header) 100 self.tab_widget = QtGui.QTabWidget(self) 101 layout.addWidget(self.tab_widget) 102 self.setLayout(layout) 103 104 def get_views_and_titles(): 105 return [(view, view.get_title()) for view in views]106 107 post(get_views_and_titles, self.set_views_and_titles ) 108 post(lambda:self.title_format, self.change_title )115 return self.tab_widget.currentWidget().export_to_excel()116118 return self.tab_widget.currentWidget().export_to_word()119121 return self.tab_widget.currentWidget().export_to_mail()122124 return self.tab_widget.currentWidget().to_html()125
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Jun 12 15:42:11 2010 | http://epydoc.sourceforge.net |