Package IDAscope :: Package idascope :: Package widgets :: Module NumberQTableWidgetItem
[hide private]
[frames] | no frames]

Source Code for Module IDAscope.idascope.widgets.NumberQTableWidgetItem

 1  #!/usr/bin/python 
 2  ######################################################################## 
 3  # Copyright (c) 2012 
 4  # Daniel Plohmann <daniel.plohmann<at>gmail<dot>com> 
 5  # Alexander Hanel <alexander.hanel<at>gmail<dot>com> 
 6  # All rights reserved. 
 7  ######################################################################## 
 8  # 
 9  #  This file is part of IDAscope 
10  # 
11  #  IDAscope is free software: you can redistribute it and/or modify it 
12  #  under the terms of the GNU General Public License as published by 
13  #  the Free Software Foundation, either version 3 of the License, or 
14  #  (at your option) any later version. 
15  # 
16  #  This program is distributed in the hope that it will be useful, but 
17  #  WITHOUT ANY WARRANTY; without even the implied warranty of 
18  #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
19  #  General Public License for more details. 
20  # 
21  #  You should have received a copy of the GNU General Public License 
22  #  along with this program.  If not, see 
23  #  <http://www.gnu.org/licenses/>. 
24  # 
25  ######################################################################## 
26   
27  from PySide import QtGui 
28   
29   
30 -class NumberQTableWidgetItem(QtGui.QTableWidgetItem):
31 """ 32 A simple helper class that allows sorting by numeric values. 33 """ 34
35 - def __lt__(self, other):
36 """ 37 Redefine function from QTableWidgetItem to allow sorting by numeric value instead of string value. 38 @param other: another item of the same type 39 @type other: I{NumberQTableWidgetItem} 40 @return: (boolean) the numeric comparison of the items. 41 """ 42 return float(self.text()) < float(other.text())
43