Plugins/ViewManagerPlugins/Listspace/Listspace.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2791
a9577f248f04
parent 3005
3953ddfb991d
child 3058
0a02c433f52d
diff -r 9986ec0e559a -r 10516539f238 Plugins/ViewManagerPlugins/Listspace/Listspace.py
--- a/Plugins/ViewManagerPlugins/Listspace/Listspace.py	Tue Oct 15 22:03:54 2013 +0200
+++ b/Plugins/ViewManagerPlugins/Listspace/Listspace.py	Fri Oct 18 23:00:41 2013 +0200
@@ -12,8 +12,8 @@
 import os
 
 from PyQt4.QtCore import pyqtSignal, QFileInfo, QEvent, Qt
-from PyQt4.QtGui import QStackedWidget, QSplitter, QListWidget, QListWidgetItem, \
-    QSizePolicy, QMenu, QApplication
+from PyQt4.QtGui import QStackedWidget, QSplitter, QListWidget, \
+    QListWidgetItem, QSizePolicy, QMenu, QApplication
 
 from ViewManager.ViewManager import ViewManager
 
@@ -128,7 +128,8 @@
         
     def firstEditor(self):
         """
-        Public method to retrieve the first editor in the list of managed editors.
+        Public method to retrieve the first editor in the list of managed
+            editors.
         
         @return first editor in list (QScintilla.Editor.Editor)
         """
@@ -146,21 +147,24 @@
     @signal editorOpened(str) emitted after an editor window was opened
     @signal editorOpenedEd(Editor) emitted after an editor window was opened
     @signal editorClosed(str) emitted just before an editor window gets closed
-    @signal editorClosedEd(Editor) emitted just before an editor window gets closed
+    @signal editorClosedEd(Editor) emitted just before an editor window gets
+        closed
     @signal editorSaved(str) emitted after an editor window was saved
     @signal checkActions(Editor) emitted when some actions should be checked
-            for their status
-    @signal cursorChanged(Editor) emitted after the cursor position of the active
-            window has changed
+        for their status
+    @signal cursorChanged(Editor) emitted after the cursor position of the
+        active window has changed
     @signal breakpointToggled(Editor) emitted when a breakpoint is toggled.
     @signal bookmarkToggled(Editor) emitted when a bookmark is toggled.
     @signal syntaxerrorToggled(Editor) emitted when a syntax error is toggled.
-    @signal previewStateChanged(bool) emitted to signal a change in the preview state
+    @signal previewStateChanged(bool) emitted to signal a change in the
+        preview state
     @signal editorLanguageChanged(Editor) emitted to signal a change of an
-            editors language
-    @signal editorTextChanged(Editor) emitted to signal a change of an editor's text
-    @signal editorLineChanged(str,int) emitted to signal a change of an editor's
-            current line (line is given one based)
+        editors language
+    @signal editorTextChanged(Editor) emitted to signal a change of an
+        editor's text
+    @signal editorLineChanged(str,int) emitted to signal a change of an
+        editor's current line (line is given one based)
     """
     changeCaption = pyqtSignal(str)
     editorChanged = pyqtSignal(str)
@@ -186,8 +190,6 @@
         Constructor
         
         @param parent parent widget (QWidget)
-        @param ui reference to the main user interface
-        @param dbs reference to the debug server object
         """
         self.stacks = []
         
@@ -228,9 +230,11 @@
         self.__menu.addAction(UI.PixmapCache.getIcon("tabClose.png"),
             self.trUtf8('Close'), self.__contextMenuClose)
         self.closeOthersMenuAct = self.__menu.addAction(
-            UI.PixmapCache.getIcon("tabCloseOther.png"), self.trUtf8("Close Others"),
+            UI.PixmapCache.getIcon("tabCloseOther.png"),
+            self.trUtf8("Close Others"),
             self.__contextMenuCloseOthers)
-        self.__menu.addAction(self.trUtf8('Close All'), self.__contextMenuCloseAll)
+        self.__menu.addAction(
+            self.trUtf8('Close All'), self.__contextMenuCloseAll)
         self.__menu.addSeparator()
         self.saveMenuAct = \
             self.__menu.addAction(UI.PixmapCache.getIcon("fileSave.png"),
@@ -247,12 +251,16 @@
         self.__menu.addAction(UI.PixmapCache.getIcon("print.png"),
             self.trUtf8('Print'), self.__contextMenuPrintFile)
         self.__menu.addSeparator()
-        self.copyPathAct = self.__menu.addAction(self.trUtf8("Copy Path to Clipboard"),
+        self.copyPathAct = self.__menu.addAction(
+            self.trUtf8("Copy Path to Clipboard"),
             self.__contextMenuCopyPathToClipboard)
         
     def __showMenu(self, point):
         """
-        Private slot to handle the customContextMenuRequested signal of the viewlist.
+        Private slot to handle the customContextMenuRequested signal of
+        the viewlist.
+        
+        @param point position to open the menu at (QPoint)
         """
         if self.editors:
             itm = self.viewlist.itemAt(point)
@@ -261,16 +269,19 @@
                 self.contextMenuEditor = self.editors[row]
                 self.contextMenuIndex = row
                 if self.contextMenuEditor:
-                    self.saveMenuAct.setEnabled(self.contextMenuEditor.isModified())
+                    self.saveMenuAct.setEnabled(
+                        self.contextMenuEditor.isModified())
                     fileName = self.contextMenuEditor.getFileName()
                     self.copyPathAct.setEnabled(bool(fileName))
                     if fileName:
                         rej = "{0}.rej".format(fileName)
-                        self.openRejectionsMenuAct.setEnabled(os.path.exists(rej))
+                        self.openRejectionsMenuAct.setEnabled(
+                            os.path.exists(rej))
                     else:
                         self.openRejectionsMenuAct.setEnabled(False)
                     
-                    self.closeOthersMenuAct.setEnabled(self.viewlist.count() > 1)
+                    self.closeOthersMenuAct.setEnabled(
+                        self.viewlist.count() > 1)
                     
                     self.__menu.popup(self.viewlist.mapToGlobal(point))
         
@@ -312,7 +323,7 @@
         
     def _removeAllViews(self):
         """
-        Protected method to remove all views (i.e. windows)
+        Protected method to remove all views (i.e. windows).
         """
         self.viewlist.clear()
         for win in self.editors:
@@ -324,7 +335,7 @@
         
     def _removeView(self, win):
         """
-        Protected method to remove a view (i.e. window)
+        Protected method to remove a view (i.e. window).
         
         @param win editor window to be removed
         """
@@ -361,7 +372,7 @@
         
     def _addView(self, win, fn=None, noName=""):
         """
-        Protected method to add a view (i.e. window)
+        Protected method to add a view (i.e. window).
         
         @param win editor assembly to be added
         @param fn filename of this editor (string)
@@ -424,7 +435,7 @@
         
     def _showView(self, win, fn=None):
         """
-        Protected method to show a view (i.e. window)
+        Protected method to show a view (i.e. window).
         
         @param win editor assembly to be shown
         @param fn filename of this editor (string)
@@ -475,7 +486,8 @@
         
     def _initWindowActions(self):
         """
-        Protected method to define the user interface actions for window handling.
+        Protected method to define the user interface actions for window
+        handling.
         """
         pass
         
@@ -508,13 +520,17 @@
         currentRow = self.viewlist.currentRow()
         index = self.editors.index(editor)
         if m:
-            self.viewlist.item(index).setIcon(UI.PixmapCache.getIcon("fileModified.png"))
+            self.viewlist.item(index).setIcon(
+                UI.PixmapCache.getIcon("fileModified.png"))
         elif editor.hasSyntaxErrors():
-            self.viewlist.item(index).setIcon(UI.PixmapCache.getIcon("syntaxError.png"))
+            self.viewlist.item(index).setIcon(
+                UI.PixmapCache.getIcon("syntaxError.png"))
         elif editor.hasFlakesWarnings():
-            self.viewlist.item(index).setIcon(UI.PixmapCache.getIcon("warning.png"))
+            self.viewlist.item(index).setIcon(
+                UI.PixmapCache.getIcon("warning.png"))
         else:
-            self.viewlist.item(index).setIcon(UI.PixmapCache.getIcon("empty.png"))
+            self.viewlist.item(index).setIcon(
+                UI.PixmapCache.getIcon("empty.png"))
         self.viewlist.setCurrentRow(currentRow)
         self._checkActions(editor)
         
@@ -527,13 +543,17 @@
         currentRow = self.viewlist.currentRow()
         index = self.editors.index(editor)
         if editor.hasSyntaxErrors():
-            self.viewlist.item(index).setIcon(UI.PixmapCache.getIcon("syntaxError.png"))
+            self.viewlist.item(index).setIcon(
+                UI.PixmapCache.getIcon("syntaxError.png"))
         elif editor.hasFlakesWarnings():
-            self.viewlist.item(index).setIcon(UI.PixmapCache.getIcon("warning.png"))
+            self.viewlist.item(index).setIcon(
+                UI.PixmapCache.getIcon("warning.png"))
         elif editor.isModified():
-            self.viewlist.item(index).setIcon(UI.PixmapCache.getIcon("fileModified.png"))
+            self.viewlist.item(index).setIcon(
+                UI.PixmapCache.getIcon("fileModified.png"))
         else:
-            self.viewlist.item(index).setIcon(UI.PixmapCache.getIcon("empty.png"))
+            self.viewlist.item(index).setIcon(
+                UI.PixmapCache.getIcon("empty.png"))
         self.viewlist.setCurrentRow(currentRow)
         
         ViewManager._syntaxErrorToggled(self, editor)
@@ -553,7 +573,8 @@
             size = self.stackArea.width()
         else:
             size = self.stackArea.height()
-        self.stackArea.setSizes([int(size / len(self.stacks))] * len(self.stacks))
+        self.stackArea.setSizes(
+            [int(size / len(self.stacks))] * len(self.stacks))
         self.splitRemoveAct.setEnabled(True)
         self.nextSplitAct.setEnabled(True)
         self.prevSplitAct.setEnabled(True)
@@ -681,7 +702,8 @@
         
     def __contextMenuOpenRejections(self):
         """
-        Private slot to open a rejections file associated with the selected editor.
+        Private slot to open a rejections file associated with the selected
+        editor.
         """
         if self.contextMenuEditor:
             fileName = self.contextMenuEditor.getFileName()
@@ -699,7 +721,8 @@
         
     def __contextMenuCopyPathToClipboard(self):
         """
-        Private method to copy the file name of the selected editor to the clipboard.
+        Private method to copy the file name of the selected editor to the
+        clipboard.
         """
         if self.contextMenuEditor:
             fn = self.contextMenuEditor.getFileName()
@@ -727,7 +750,8 @@
             self.changeCaption.emit(fn)
             if not self.__inRemoveView:
                 self.editorChanged.emit(fn)
-                self.editorLineChanged.emit(fn, editor.getCursorPosition()[0] + 1)
+                self.editorLineChanged.emit(
+                    fn, editor.getCursorPosition()[0] + 1)
         else:
             self.changeCaption.emit("")
         self.editorChangedEd.emit(editor)
@@ -768,7 +792,8 @@
                     self.changeCaption.emit(fn)
                     if switched:
                         self.editorChanged.emit(fn)
-                        self.editorLineChanged.emit(fn, aw.getCursorPosition()[0] + 1)
+                        self.editorLineChanged.emit(
+                            fn, aw.getCursorPosition()[0] + 1)
                 else:
                     self.changeCaption.emit("")
                 self.editorChangedEd.emit(aw)

eric ide

mercurial