Helpviewer/History/HistoryMenu.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 3002
6ffc581f00f1
child 3058
0a02c433f52d
diff -r 9986ec0e559a -r 10516539f238 Helpviewer/History/HistoryMenu.py
--- a/Helpviewer/History/HistoryMenu.py	Tue Oct 15 22:03:54 2013 +0200
+++ b/Helpviewer/History/HistoryMenu.py	Fri Oct 18 23:00:41 2013 +0200
@@ -77,7 +77,8 @@
             folders = self.sourceModel().rowCount()
             bumpedItems = self.bumpedRows()
             if bumpedItems <= self.MOVEDROWS and \
-               bumpedItems == self.sourceModel().rowCount(self.sourceModel().index(0, 0)):
+                    bumpedItems == self.sourceModel().rowCount(
+                        self.sourceModel().index(0, 0)):
                 folders -= 1
             return bumpedItems + folders
         
@@ -100,7 +101,8 @@
         @return proxy model index (QModelIndex)
         """
         sourceRow = self.__treeModel.mapToSource(sourceIndex).row()
-        return self.createIndex(sourceIndex.row(), sourceIndex.column(), sourceRow)
+        return self.createIndex(
+            sourceIndex.row(), sourceIndex.column(), sourceRow)
     
     def mapToSource(self, proxyIndex):
         """
@@ -115,10 +117,12 @@
         if proxyIndex.internalId() == sys.maxsize:
             bumpedItems = self.bumpedRows()
             if proxyIndex.row() < bumpedItems:
-                return self.__treeModel.index(proxyIndex.row(), proxyIndex.column(),
+                return self.__treeModel.index(
+                    proxyIndex.row(), proxyIndex.column(),
                     self.__treeModel.index(0, 0))
             if bumpedItems <= self.MOVEDROWS and \
-               bumpedItems == self.sourceModel().rowCount(self.__treeModel.index(0, 0)):
+                    bumpedItems == self.sourceModel().rowCount(
+                        self.__treeModel.index(0, 0)):
                 bumpedItems -= 1
             return self.__treeModel.index(proxyIndex.row() - bumpedItems,
                                           proxyIndex.column())
@@ -151,7 +155,8 @@
         bumpedItems = 0
         if treeIndexParent == self.sourceModel().index(0, 0):
             bumpedItems = self.bumpedRows()
-        treeIndex = self.__treeModel.index(row + bumpedItems, column, treeIndexParent)
+        treeIndex = self.__treeModel.index(
+            row + bumpedItems, column, treeIndexParent)
         historyIndex = self.__treeModel.mapToSource(treeIndex)
         historyRow = historyIndex.row()
         if historyRow == -1:
@@ -169,14 +174,16 @@
         if offset == sys.maxsize or not index.isValid():
             return QModelIndex()
         
-        historyIndex = self.__treeModel.sourceModel().index(index.internalId(), 0)
+        historyIndex = self.__treeModel.sourceModel().index(
+            index.internalId(), 0)
         treeIndex = self.__treeModel.mapFromSource(historyIndex)
         treeIndexParent = treeIndex.parent()
         
         sourceRow = self.sourceModel().mapToSource(treeIndexParent).row()
         bumpedItems = self.bumpedRows()
         if bumpedItems <= self.MOVEDROWS and \
-           bumpedItems == self.sourceModel().rowCount(self.sourceModel().index(0, 0)):
+                bumpedItems == self.sourceModel().rowCount(
+                    self.sourceModel().index(0, 0)):
             bumpedItems -= 1
         
         return self.createIndex(bumpedItems + treeIndexParent.row(),
@@ -234,8 +241,8 @@
         dateTime_R = \
             self.sourceModel().data(right, HistoryModel.DateTimeRole)
         
-        # Sort results in descending frequency-derived score. If frequencies are equal,
-        # sort on most recently viewed
+        # Sort results in descending frequency-derived score. If frequencies
+        # are equal, sort on most recently viewed
         if frequency_R == frequency_L:
             return dateTime_R < dateTime_L
         
@@ -270,7 +277,8 @@
         self.__mostVisitedMenu = None
         
         self.__closedTabsMenu = QMenu(self.trUtf8("Closed Tabs"))
-        self.__closedTabsMenu.aboutToShow.connect(self.__aboutToShowClosedTabsMenu)
+        self.__closedTabsMenu.aboutToShow.connect(
+            self.__aboutToShowClosedTabsMenu)
         self.__tabWidget.closedTabsManager().closedTabAvailable.connect(
             self.__closedTabAvailable)
         
@@ -302,9 +310,10 @@
         """
         if self.__historyManager is None:
             import Helpviewer.HelpWindow
-            self.__historyManager = Helpviewer.HelpWindow.HelpWindow.historyManager()
-            self.__historyMenuModel = \
-                HistoryMenuModel(self.__historyManager.historyTreeModel(), self)
+            self.__historyManager = \
+                Helpviewer.HelpWindow.HelpWindow.historyManager()
+            self.__historyMenuModel = HistoryMenuModel(
+                self.__historyManager.historyTreeModel(), self)
             self.setModel(self.__historyMenuModel)
         
         # initial actions
@@ -343,7 +352,8 @@
     
     def setInitialActions(self, actions):
         """
-        Public method to set the list of actions that should appear first in the menu.
+        Public method to set the list of actions that should appear first in
+        the menu.
         
         @param actions list of initial actions (list of QAction)
         """
@@ -453,8 +463,8 @@
         if self.__historyMenuModel is None:
             import Helpviewer.HelpWindow
             historyManager = Helpviewer.HelpWindow.HelpWindow.historyManager()
-            self.__historyMenuModel = \
-                HistoryMostVisitedMenuModel(historyManager.historyFilterModel(), self)
+            self.__historyMenuModel = HistoryMostVisitedMenuModel(
+                historyManager.historyFilterModel(), self)
             self.setModel(self.__historyMenuModel)
         self.__historyMenuModel.sort(0)
         

eric ide

mercurial