| 144 | |
| 145 | # inbox, sent, thrash first, rest alphabetically |
| 146 | def __lt__(self, other): |
| 147 | if (isinstance(other, Ui_FolderWidget)): |
| 148 | if self.folderName in self.folderWeight: |
| 149 | x = self.folderWeight[self.folderName] |
| 150 | else: |
| 151 | x = 99 |
| 152 | if other.folderName in self.folderWeight: |
| 153 | y = self.folderWeight[other.folderName] |
| 154 | else: |
| 155 | y = 99 |
| 156 | reverse = False |
| 157 | if self.treeWidget().header().sortIndicatorOrder() == QtCore.Qt.DescendingOrder: |
| 158 | reverse = True |
| 159 | if x == y: |
| 160 | return self.folderName < other.folderName |
| 161 | else: |
| 162 | return (x >= y if reverse else x < y) |
| 163 | |
| 164 | return super(QtGui.QTreeWidgetItem, self).__lt__(other) |
| 165 | |
| 166 | |
| 167 | class Ui_AddressWidget(QtGui.QTreeWidgetItem, AccountMixin, SettingsMixin): |