Plugins/ViewManagerPlugins/Listspace/Listspace.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3270
d8532d902e76
child 3591
2f2a4a76dd22
--- a/Plugins/ViewManagerPlugins/Listspace/Listspace.py	Sun Mar 30 22:00:14 2014 +0200
+++ b/Plugins/ViewManagerPlugins/Listspace/Listspace.py	Thu Apr 03 23:05:31 2014 +0200
@@ -34,7 +34,6 @@
         @param parent parent widget (QWidget)
         """
         super(StackedWidget, self).__init__(parent)
-        self.setAttribute(Qt.WA_DeleteOnClose, True)
         
         self.editors = []
         
@@ -229,34 +228,34 @@
         self.__menu = QMenu(self)
         self.__menu.addAction(
             UI.PixmapCache.getIcon("tabClose.png"),
-            self.trUtf8('Close'), self.__contextMenuClose)
+            self.tr('Close'), self.__contextMenuClose)
         self.closeOthersMenuAct = self.__menu.addAction(
             UI.PixmapCache.getIcon("tabCloseOther.png"),
-            self.trUtf8("Close Others"),
+            self.tr("Close Others"),
             self.__contextMenuCloseOthers)
         self.__menu.addAction(
-            self.trUtf8('Close All'), self.__contextMenuCloseAll)
+            self.tr('Close All'), self.__contextMenuCloseAll)
         self.__menu.addSeparator()
         self.saveMenuAct = self.__menu.addAction(
             UI.PixmapCache.getIcon("fileSave.png"),
-            self.trUtf8('Save'), self.__contextMenuSave)
+            self.tr('Save'), self.__contextMenuSave)
         self.__menu.addAction(
             UI.PixmapCache.getIcon("fileSaveAs.png"),
-            self.trUtf8('Save As...'), self.__contextMenuSaveAs)
+            self.tr('Save As...'), self.__contextMenuSaveAs)
         self.__menu.addAction(
             UI.PixmapCache.getIcon("fileSaveAll.png"),
-            self.trUtf8('Save All'), self.__contextMenuSaveAll)
+            self.tr('Save All'), self.__contextMenuSaveAll)
         self.__menu.addSeparator()
         self.openRejectionsMenuAct = self.__menu.addAction(
-            self.trUtf8("Open 'rejection' file"),
+            self.tr("Open 'rejection' file"),
             self.__contextMenuOpenRejections)
         self.__menu.addSeparator()
         self.__menu.addAction(
             UI.PixmapCache.getIcon("print.png"),
-            self.trUtf8('Print'), self.__contextMenuPrintFile)
+            self.tr('Print'), self.__contextMenuPrintFile)
         self.__menu.addSeparator()
         self.copyPathAct = self.__menu.addAction(
-            self.trUtf8("Copy Path to Clipboard"),
+            self.tr("Copy Path to Clipboard"),
             self.__contextMenuCopyPathToClipboard)
         
     def __showMenu(self, point):
@@ -386,13 +385,13 @@
         if fn is None:
             if not noName:
                 self.untitledCount += 1
-                noName = self.trUtf8("Untitled {0}").format(self.untitledCount)
+                noName = self.tr("Untitled {0}").format(self.untitledCount)
             self.viewlist.addItem(noName)
             editor.setNoName(noName)
         else:
             txt = os.path.basename(fn)
             if not QFileInfo(fn).isWritable():
-                txt = self.trUtf8("{0} (ro)").format(txt)
+                txt = self.tr("{0} (ro)").format(txt)
             itm = QListWidgetItem(txt)
             itm.setToolTip(fn)
             self.viewlist.addItem(itm)
@@ -507,7 +506,7 @@
             index = self.editors.index(editor)
             txt = os.path.basename(newName)
             if not QFileInfo(newName).isWritable():
-                txt = self.trUtf8("{0} (ro)").format(txt)
+                txt = self.tr("{0} (ro)").format(txt)
             itm = self.viewlist.item(index)
             itm.setText(txt)
             itm.setToolTip(newName)
@@ -523,18 +522,17 @@
         """
         currentRow = self.viewlist.currentRow()
         index = self.editors.index(editor)
+        keys = []
         if m:
-            self.viewlist.item(index).setIcon(
-                UI.PixmapCache.getIcon("fileModified.png"))
-        elif editor.hasSyntaxErrors():
-            self.viewlist.item(index).setIcon(
-                UI.PixmapCache.getIcon("syntaxError.png"))
+            keys.append("fileModified.png")
+        if editor.hasSyntaxErrors():
+            keys.append("syntaxError22.png")
         elif editor.hasWarnings():
-            self.viewlist.item(index).setIcon(
-                UI.PixmapCache.getIcon("warning.png"))
-        else:
-            self.viewlist.item(index).setIcon(
-                UI.PixmapCache.getIcon("empty.png"))
+            keys.append("warning22.png")
+        if not keys:
+            keys.append("empty.png")
+        self.viewlist.item(index).setIcon(
+            UI.PixmapCache.getCombinedIcon(keys))
         self.viewlist.setCurrentRow(currentRow)
         self._checkActions(editor)
         
@@ -546,18 +544,17 @@
         """
         currentRow = self.viewlist.currentRow()
         index = self.editors.index(editor)
+        keys = []
+        if editor.isModified():
+            keys.append("fileModified.png")
         if editor.hasSyntaxErrors():
-            self.viewlist.item(index).setIcon(
-                UI.PixmapCache.getIcon("syntaxError.png"))
+            keys.append("syntaxError22.png")
         elif editor.hasWarnings():
-            self.viewlist.item(index).setIcon(
-                UI.PixmapCache.getIcon("warning.png"))
-        elif editor.isModified():
-            self.viewlist.item(index).setIcon(
-                UI.PixmapCache.getIcon("fileModified.png"))
-        else:
-            self.viewlist.item(index).setIcon(
-                UI.PixmapCache.getIcon("empty.png"))
+            keys.append("warning22.png")
+        if not keys:
+            keys.append("empty.png")
+        self.viewlist.item(index).setIcon(
+            UI.PixmapCache.getCombinedIcon(keys))
         self.viewlist.setCurrentRow(currentRow)
         
         ViewManager._syntaxErrorToggled(self, editor)

eric ide

mercurial