| 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 """Controls to filter data"""
29
30 import logging
31 logger = logging.getLogger('camelot.view.controls.filter')
32
33 from PyQt4 import QtGui
34 from PyQt4 import QtCore
35
36 _ = lambda x:x
37
38
40 """A list with filters that can be applied on a query in the tableview"""
41
43 """@param item list of tubles (name, choices) for constructing the
44 different filterboxes
45 """
46 QtGui.QScrollArea.__init__(self, parent)
47 self.widget = QtGui.QWidget()
48 layout = QtGui.QVBoxLayout()
49 self.filters = []
50 layout.addWidget(QtGui.QLabel(_('Filter'), self))
51
52 for filter,(name,options) in items:
53 widget = filter.render(self, name, options)
54 layout.addWidget(widget)
55 self.filters.append(widget)
56 self.connect(widget,
57 QtCore.SIGNAL('filter_changed'),
58 self.emit_filters_changed)
59
60 layout.addStretch()
61 self.widget.setLayout(layout)
62 self.setWidget(self.widget)
63 self.setMaximumWidth(self.widget.width() + 10)
64 if len(self.filters) == 0:
65 self.setMaximumWidth(0)
66
71
75
77 logger.debug('delete filter list')
78
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Sat Jan 31 18:50:05 2009 | http://epydoc.sourceforge.net |