Plugins/ViewManagerPlugins/Tabview/Tabview.py

changeset 3270
d8532d902e76
parent 3201
0f115f6db6cb
child 3484
645c12de6b0c
equal deleted inserted replaced
3269:866c3a2f5380 3270:d8532d902e76
8 """ 8 """
9 9
10 import os 10 import os
11 11
12 from PyQt4.QtCore import QPoint, QFileInfo, pyqtSignal, QEvent, QByteArray, \ 12 from PyQt4.QtCore import QPoint, QFileInfo, pyqtSignal, QEvent, QByteArray, \
13 QMimeData, Qt 13 QMimeData, Qt, QSize
14 from PyQt4.QtGui import QWidget, QColor, QHBoxLayout, QDrag, QPixmap, \ 14 from PyQt4.QtGui import QWidget, QColor, QHBoxLayout, QDrag, QPixmap, \
15 QSplitter, QTabBar, QApplication, QToolButton, QMenu, QLabel 15 QSplitter, QTabBar, QApplication, QToolButton, QMenu, QLabel
16 16
17 from E5Gui.E5Application import e5App 17 from E5Gui.E5Application import e5App
18 18
157 """ 157 """
158 super().__init__() 158 super().__init__()
159 159
160 self.__tabBar = TabBar(self) 160 self.__tabBar = TabBar(self)
161 self.setTabBar(self.__tabBar) 161 self.setTabBar(self.__tabBar)
162 iconSize = self.__tabBar.iconSize()
163 self.__tabBar.setIconSize(
164 QSize(2 * iconSize.width(), iconSize.height()))
162 165
163 self.setUsesScrollButtons(True) 166 self.setUsesScrollButtons(True)
164 self.setElideMode(Qt.ElideNone) 167 self.setElideMode(Qt.ElideNone)
165 if isMacPlatform(): 168 if isMacPlatform():
166 self.setDocumentMode(True) 169 self.setDocumentMode(True)
995 """ 998 """
996 for tw in self.tabWidgets: 999 for tw in self.tabWidgets:
997 if tw.hasEditor(editor): 1000 if tw.hasEditor(editor):
998 break 1001 break
999 index = tw.indexOf(editor) 1002 index = tw.indexOf(editor)
1003 keys = []
1000 if m: 1004 if m:
1001 tw.setTabIcon(index, UI.PixmapCache.getIcon("fileModified.png")) 1005 keys.append("fileModified.png")
1002 elif editor.hasSyntaxErrors(): 1006 if editor.hasSyntaxErrors():
1003 tw.setTabIcon(index, UI.PixmapCache.getIcon("syntaxError.png")) 1007 keys.append("syntaxError22.png")
1004 elif editor.hasWarnings(): 1008 elif editor.hasWarnings():
1005 tw.setTabIcon(index, UI.PixmapCache.getIcon("warning.png")) 1009 keys.append("warning22.png")
1006 else: 1010 if not keys:
1007 tw.setTabIcon(index, UI.PixmapCache.getIcon("empty.png")) 1011 keys.append("empty.png")
1012 tw.setTabIcon(index, UI.PixmapCache.getCombinedIcon(keys))
1008 self._checkActions(editor) 1013 self._checkActions(editor)
1009 1014
1010 def _syntaxErrorToggled(self, editor): 1015 def _syntaxErrorToggled(self, editor):
1011 """ 1016 """
1012 Protected slot to handle the syntaxerrorToggled signal. 1017 Protected slot to handle the syntaxerrorToggled signal.
1015 """ 1020 """
1016 for tw in self.tabWidgets: 1021 for tw in self.tabWidgets:
1017 if tw.hasEditor(editor): 1022 if tw.hasEditor(editor):
1018 break 1023 break
1019 index = tw.indexOf(editor) 1024 index = tw.indexOf(editor)
1025 keys = []
1026 if editor.isModified():
1027 keys.append("fileModified.png")
1020 if editor.hasSyntaxErrors(): 1028 if editor.hasSyntaxErrors():
1021 tw.setTabIcon(index, UI.PixmapCache.getIcon("syntaxError.png")) 1029 keys.append("syntaxError22.png")
1022 elif editor.hasWarnings(): 1030 elif editor.hasWarnings():
1023 tw.setTabIcon(index, UI.PixmapCache.getIcon("warning.png")) 1031 keys.append("warning22.png")
1024 elif editor.isModified(): 1032 if not keys:
1025 tw.setTabIcon(index, UI.PixmapCache.getIcon("fileModified.png")) 1033 keys.append("empty.png")
1026 else: 1034 tw.setTabIcon(index, UI.PixmapCache.getCombinedIcon(keys))
1027 tw.setTabIcon(index, UI.PixmapCache.getIcon("empty.png"))
1028 1035
1029 ViewManager._syntaxErrorToggled(self, editor) 1036 ViewManager._syntaxErrorToggled(self, editor)
1030 1037
1031 def addSplit(self): 1038 def addSplit(self):
1032 """ 1039 """

eric ide

mercurial