--- a/Plugins/ViewManagerPlugins/Tabview/Tabview.py Sun Mar 30 22:00:14 2014 +0200 +++ b/Plugins/ViewManagerPlugins/Tabview/Tabview.py Thu Apr 03 23:05:31 2014 +0200 @@ -12,7 +12,7 @@ import os from PyQt4.QtCore import QPoint, QFileInfo, pyqtSignal, QEvent, QByteArray, \ - QMimeData, Qt + QMimeData, Qt, QSize from PyQt4.QtGui import QWidget, QColor, QHBoxLayout, QDrag, QPixmap, \ QSplitter, QTabBar, QApplication, QToolButton, QMenu, QLabel @@ -158,10 +158,12 @@ @param vm view manager widget (Tabview) """ super(TabWidget, self).__init__() - self.setAttribute(Qt.WA_DeleteOnClose, True) self.__tabBar = TabBar(self) self.setTabBar(self.__tabBar) + iconSize = self.__tabBar.iconSize() + self.__tabBar.setIconSize( + QSize(2 * iconSize.width(), iconSize.height())) self.setUsesScrollButtons(True) self.setElideMode(Qt.ElideNone) @@ -191,7 +193,7 @@ self.navigationButton = QToolButton(self) self.navigationButton.setIcon(UI.PixmapCache.getIcon("1downarrow.png")) - self.navigationButton.setToolTip(self.trUtf8("Show a navigation menu")) + self.navigationButton.setToolTip(self.tr("Show a navigation menu")) self.navigationButton.setPopupMode(QToolButton.InstantPopup) self.navigationButton.setMenu(self.__navigationMenu) self.navigationButton.setEnabled(False) @@ -202,7 +204,7 @@ self.closeButton = QToolButton(self) self.closeButton.setIcon(UI.PixmapCache.getIcon("close.png")) self.closeButton.setToolTip( - self.trUtf8("Close the current editor")) + self.tr("Close the current editor")) self.closeButton.setEnabled(False) self.closeButton.clicked[bool].connect(self.__closeButtonClicked) self.rightCornerWidgetLayout.addWidget(self.closeButton) @@ -235,46 +237,46 @@ self.__menu = QMenu(self) self.leftMenuAct = self.__menu.addAction( UI.PixmapCache.getIcon("1leftarrow.png"), - self.trUtf8('Move Left'), self.__contextMenuMoveLeft) + self.tr('Move Left'), self.__contextMenuMoveLeft) self.rightMenuAct = self.__menu.addAction( UI.PixmapCache.getIcon("1rightarrow.png"), - self.trUtf8('Move Right'), self.__contextMenuMoveRight) + self.tr('Move Right'), self.__contextMenuMoveRight) self.firstMenuAct = self.__menu.addAction( UI.PixmapCache.getIcon("2leftarrow.png"), - self.trUtf8('Move First'), self.__contextMenuMoveFirst) + self.tr('Move First'), self.__contextMenuMoveFirst) self.lastMenuAct = self.__menu.addAction( UI.PixmapCache.getIcon("2rightarrow.png"), - self.trUtf8('Move Last'), self.__contextMenuMoveLast) + self.tr('Move Last'), self.__contextMenuMoveLast) self.__menu.addSeparator() 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.__contextMenuCloseOthers) + 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 __showContextMenu(self, coord, index): @@ -418,7 +420,7 @@ if len(txt) > maxFileNameChars: txt = "...{0}".format(txt[-maxFileNameChars:]) if editor.isReadOnly(): - txt = self.trUtf8("{0} (ro)").format(txt) + txt = self.tr("{0} (ro)").format(txt) assembly = editor.parent() index = self.indexOf(assembly) @@ -859,7 +861,7 @@ 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.currentTabWidget.addTab(win, noName) editor.setNoName(noName) else: @@ -870,7 +872,7 @@ if len(txt) > self.maxFileNameChars: txt = "...{0}".format(txt[-self.maxFileNameChars:]) if not QFileInfo(fn).isWritable(): - txt = self.trUtf8("{0} (ro)").format(txt) + txt = self.tr("{0} (ro)").format(txt) self.currentTabWidget.addTab(win, txt) index = self.currentTabWidget.indexOf(win) self.currentTabWidget.setTabToolTip(index, fn) @@ -900,7 +902,7 @@ 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) tabWidget.insertWidget(index, win, noName) editor.setNoName(noName) else: @@ -911,7 +913,7 @@ if len(txt) > self.maxFileNameChars: txt = "...{0}".format(txt[-self.maxFileNameChars:]) if not QFileInfo(fn).isWritable(): - txt = self.trUtf8("{0} (ro)").format(txt) + txt = self.tr("{0} (ro)").format(txt) nindex = tabWidget.insertWidget(index, win, txt) tabWidget.setTabToolTip(nindex, fn) tabWidget.setCurrentWidget(win) @@ -1003,14 +1005,16 @@ if tw.hasEditor(editor): break index = tw.indexOf(editor) + keys = [] if m: - tw.setTabIcon(index, UI.PixmapCache.getIcon("fileModified.png")) - elif editor.hasSyntaxErrors(): - tw.setTabIcon(index, UI.PixmapCache.getIcon("syntaxError.png")) + keys.append("fileModified.png") + if editor.hasSyntaxErrors(): + keys.append("syntaxError22.png") elif editor.hasWarnings(): - tw.setTabIcon(index, UI.PixmapCache.getIcon("warning.png")) - else: - tw.setTabIcon(index, UI.PixmapCache.getIcon("empty.png")) + keys.append("warning22.png") + if not keys: + keys.append("empty.png") + tw.setTabIcon(index, UI.PixmapCache.getCombinedIcon(keys)) self._checkActions(editor) def _syntaxErrorToggled(self, editor): @@ -1023,14 +1027,16 @@ if tw.hasEditor(editor): break index = tw.indexOf(editor) + keys = [] + if editor.isModified(): + keys.append("fileModified.png") if editor.hasSyntaxErrors(): - tw.setTabIcon(index, UI.PixmapCache.getIcon("syntaxError.png")) + keys.append("syntaxError22.png") elif editor.hasWarnings(): - tw.setTabIcon(index, UI.PixmapCache.getIcon("warning.png")) - elif editor.isModified(): - tw.setTabIcon(index, UI.PixmapCache.getIcon("fileModified.png")) - else: - tw.setTabIcon(index, UI.PixmapCache.getIcon("empty.png")) + keys.append("warning22.png") + if not keys: + keys.append("empty.png") + tw.setTabIcon(index, UI.PixmapCache.getCombinedIcon(keys)) ViewManager._syntaxErrorToggled(self, editor) @@ -1238,7 +1244,7 @@ if len(txt) > self.maxFileNameChars: txt = "...{0}".format(txt[-self.maxFileNameChars:]) if not QFileInfo(fn).isWritable(): - txt = self.trUtf8("{0} (ro)").format(txt) + txt = self.tr("{0} (ro)").format(txt) tabWidget.setTabText(index, txt) def getTabWidgetById(self, id_):