14 |
14 |
15 from E4Gui.E4ModelMenu import E4ModelMenu |
15 from E4Gui.E4ModelMenu import E4ModelMenu |
16 |
16 |
17 import Helpviewer.HelpWindow |
17 import Helpviewer.HelpWindow |
18 |
18 |
19 from HistoryModel import HistoryModel |
19 from .HistoryModel import HistoryModel |
20 from HistoryDialog import HistoryDialog |
20 from .HistoryDialog import HistoryDialog |
21 |
21 |
22 import UI.PixmapCache |
22 import UI.PixmapCache |
23 |
23 |
24 class HistoryMenuModel(QAbstractProxyModel): |
24 class HistoryMenuModel(QAbstractProxyModel): |
25 """ |
25 """ |
78 if bumpedItems <= self.MOVEDROWS and \ |
78 if bumpedItems <= self.MOVEDROWS and \ |
79 bumpedItems == self.sourceModel().rowCount(self.sourceModel().index(0, 0)): |
79 bumpedItems == self.sourceModel().rowCount(self.sourceModel().index(0, 0)): |
80 folders -= 1 |
80 folders -= 1 |
81 return bumpedItems + folders |
81 return bumpedItems + folders |
82 |
82 |
83 if parent.internalId() == sys.maxint: |
83 if parent.internalId() == sys.maxsize: |
84 if parent.row() < self.bumpedRows(): |
84 if parent.row() < self.bumpedRows(): |
85 return 0 |
85 return 0 |
86 |
86 |
87 idx = self.mapToSource(parent) |
87 idx = self.mapToSource(parent) |
88 defaultCount = self.sourceModel().rowCount(idx) |
88 defaultCount = self.sourceModel().rowCount(idx) |
110 @return source model index (QModelIndex) |
110 @return source model index (QModelIndex) |
111 """ |
111 """ |
112 if not proxyIndex.isValid(): |
112 if not proxyIndex.isValid(): |
113 return QModelIndex() |
113 return QModelIndex() |
114 |
114 |
115 if proxyIndex.internalId() == sys.maxint: |
115 if proxyIndex.internalId() == sys.maxsize: |
116 bumpedItems = self.bumpedRows() |
116 bumpedItems = self.bumpedRows() |
117 if proxyIndex.row() < bumpedItems: |
117 if proxyIndex.row() < bumpedItems: |
118 return self.__treeModel.index(proxyIndex.row(), proxyIndex.column(), |
118 return self.__treeModel.index(proxyIndex.row(), proxyIndex.column(), |
119 self.__treeModel.index(0, 0)) |
119 self.__treeModel.index(0, 0)) |
120 if bumpedItems <= self.MOVEDROWS and \ |
120 if bumpedItems <= self.MOVEDROWS and \ |
142 column >= self.columnCount(parent) or \ |
142 column >= self.columnCount(parent) or \ |
143 parent.column() > 0: |
143 parent.column() > 0: |
144 return QModelIndex() |
144 return QModelIndex() |
145 |
145 |
146 if not parent.isValid(): |
146 if not parent.isValid(): |
147 return self.createIndex(row, column, sys.maxint) |
147 return self.createIndex(row, column, sys.maxsize) |
148 |
148 |
149 treeIndexParent = self.mapToSource(parent) |
149 treeIndexParent = self.mapToSource(parent) |
150 |
150 |
151 bumpedItems = 0 |
151 bumpedItems = 0 |
152 if treeIndexParent == self.sourceModel().index(0, 0): |
152 if treeIndexParent == self.sourceModel().index(0, 0): |
164 |
164 |
165 @param index index of item to get parent (QModelIndex) |
165 @param index index of item to get parent (QModelIndex) |
166 @return index of parent (QModelIndex) |
166 @return index of parent (QModelIndex) |
167 """ |
167 """ |
168 offset = index.internalId() |
168 offset = index.internalId() |
169 if offset == sys.maxint or not index.isValid(): |
169 if offset == sys.maxsize or not index.isValid(): |
170 return QModelIndex() |
170 return QModelIndex() |
171 |
171 |
172 historyIndex = self.__treeModel.sourceModel().index(index.internalId(), 0) |
172 historyIndex = self.__treeModel.sourceModel().index(index.internalId(), 0) |
173 treeIndex = self.__treeModel.mapFromSource(historyIndex) |
173 treeIndex = self.__treeModel.mapFromSource(historyIndex) |
174 treeIndexParent = treeIndex.parent() |
174 treeIndexParent = treeIndex.parent() |