def onFlowZoomChanged(self): """Triggered when a flow zoom is changed""" self.monoFont = getZoomedCFMonoFont() self.monoFontMetrics = QFontMetrics(self.monoFont, self.__paintDevice) self.badgeFont = getZoomedCFBadgeFont() self.badgeFontMetrics = QFontMetrics(self.badgeFont, self.__paintDevice) # Recalculate various paddings. If they are not recalculated then the # badges may overlap the text and even boxes newHeight = self.monoFontMetrics.boundingRect('W').height() noZoomHeight = self.__noZoomFontMetrics.boundingRect('W').height() self.coefficient = float(newHeight) / float(noZoomHeight) self.ifWidth = self.__getNormalized('ifWidth') self.commentCorner = self.__getNormalized('commentCorner') self.hCellPadding = self.__getNormalized('hCellPadding') self.vCellPadding = self.__getNormalized('vCellPadding') self.hTextPadding = self.__getNormalized('hTextPadding') self.vTextPadding = self.__getNormalized('vTextPadding') self.vHiddenTextPadding = self.__getNormalized('vHiddenTextPadding') self.hHiddenTextPadding = self.__getNormalized('hHiddenTextPadding') self.hHeaderPadding = self.__getNormalized('hHeaderPadding') self.vHeaderPadding = self.__getNormalized('vHeaderPadding') self.vSpacer = self.__getNormalized('vSpacer') self.mainLine = self.__getNormalized('mainLine') self.minWidth = self.__getNormalized('minWidth') self.returnRectRadius = self.__getNormalized('returnRectRadius') self.collapsedOutlineWidth = \ self.__getNormalized('collapsedOutlineWidth') self.openGroupVSpacer = self.__getNormalized('openGroupVSpacer') self.openGroupHSpacer = self.__getNormalized('openGroupHSpacer')
def onFlowZoomChanged(self): """Triggered when a flow zoom is changed""" self.monoFont = getZoomedCFMonoFont() self.monoFontMetrics = QFontMetrics(self.monoFont, self.__paintDevice) self.badgeFont = getZoomedCFBadgeFont() self.badgeFontMetrics = QFontMetrics(self.badgeFont, self.__paintDevice) # Recalculate various paddings. If they are not recalculated then the # badges may overlap the text and even boxes newHeight = self.monoFontMetrics.boundingRect('W').height() noZoomHeight = self.__noZoomFontMetrics.boundingRect('W').height() coefficient = float(newHeight) / float(noZoomHeight) self.hCellPadding = self.__getNormalized('hCellPadding', coefficient) self.vCellPadding = self.__getNormalized('vCellPadding', coefficient) self.hTextPadding = self.__getNormalized('hTextPadding', coefficient) self.vTextPadding = self.__getNormalized('vTextPadding', coefficient) self.vHiddenTextPadding = self.__getNormalized('vHiddenTextPadding', coefficient) self.hHiddenTextPadding = self.__getNormalized('hHiddenTextPadding', coefficient) self.hHeaderPadding = self.__getNormalized('hHeaderPadding', coefficient) self.vHeaderPadding = self.__getNormalized('vHeaderPadding', coefficient) self.vSpacer = self.__getNormalized('vSpacer', coefficient) self.mainLine = self.__getNormalized('mainLine', coefficient)
def detectRevisionMarginWidth(self): """Caculates the margin width depending on the margin font and the current zoom""" skin = GlobalData().skin font = QFont(skin.lineNumFont) font.setPointSize(font.pointSize() + self.getZoom()) fontMetrics = QFontMetrics(font, self) return fontMetrics.width('W' * self.__maxLength) + 3
class CFlowSettings: """Holds the control flow rendering and drawing settings""" def __init__(self, paintDevice, params): self.__paintDevice = paintDevice # Used to generate each item unique sequential ID self.itemID = 0 self.__noZoomFontMetrics = QFontMetrics( _DEFAULT_CFLOW_SETTINGS['cfMonoFont']) for key, value in params.items(): setattr(self, key, value) # Some display related settings are coming from the IDE wide settings settings = Settings() setattr(self, 'hidedocstrings', settings['hidedocstrings']) setattr(self, 'hidecomments', settings['hidecomments']) setattr(self, 'hideexcepts', settings['hideexcepts']) self.onFlowZoomChanged() def __getNormalized(self, value, coefficient): """Normalize a defalt value to the current zoom""" return ceil(float(_DEFAULT_CFLOW_SETTINGS[value]) * coefficient) def onFlowZoomChanged(self): """Triggered when a flow zoom is changed""" self.monoFont = getZoomedCFMonoFont() self.monoFontMetrics = QFontMetrics(self.monoFont, self.__paintDevice) self.badgeFont = getZoomedCFBadgeFont() self.badgeFontMetrics = QFontMetrics(self.badgeFont, self.__paintDevice) # Recalculate various paddings. If they are not recalculated then the # badges may overlap the text and even boxes newHeight = self.monoFontMetrics.boundingRect('W').height() noZoomHeight = self.__noZoomFontMetrics.boundingRect('W').height() coefficient = float(newHeight) / float(noZoomHeight) self.hCellPadding = self.__getNormalized('hCellPadding', coefficient) self.vCellPadding = self.__getNormalized('vCellPadding', coefficient) self.hTextPadding = self.__getNormalized('hTextPadding', coefficient) self.vTextPadding = self.__getNormalized('vTextPadding', coefficient) self.vHiddenTextPadding = self.__getNormalized('vHiddenTextPadding', coefficient) self.hHiddenTextPadding = self.__getNormalized('hHiddenTextPadding', coefficient) self.hHeaderPadding = self.__getNormalized('hHeaderPadding', coefficient) self.vHeaderPadding = self.__getNormalized('vHeaderPadding', coefficient) self.vSpacer = self.__getNormalized('vSpacer', coefficient) self.mainLine = self.__getNormalized('mainLine', coefficient)
def setCursorStyle(self): """Sets the cursor style depending on the mode and the cursor pos""" if self.mode == self.MODE_OUTPUT: if self.cursorWidth() != 1: self.setCursorWidth(1) else: if self.absCursorPosition >= self.lastOutputPos: if self.cursorWidth() == 1: fontMetrics = QFontMetrics(self.font(), self) self.setCursorWidth(fontMetrics.width('W')) self.update() else: if self.cursorWidth() != 1: self.setCursorWidth(1) self.update()
def __init__(self, edge, modObj): text = edge.label.replace('\\n', '\n') QGraphicsTextItem.__init__(self, text) self.__modObj = modObj font = QFont("Arial", 10) self.setFont(font) metric = QFontMetrics(font) rec = metric.boundingRect(0, 0, 10000, 10000, Qt.AlignLeft, text) self.setPos(edge.labelX - rec.width() / 2, edge.labelY - rec.height() / 2) # To make double click delivered self.setFlag(QGraphicsItem.ItemIsSelectable, True)
def onFlowZoomChanged(self): """Triggered when a flow zoom is changed""" self.monoFont = getZoomedCFMonoFont() self.monoFontMetrics = QFontMetrics(self.monoFont, self.__paintDevice) self.badgeFont = getZoomedCFBadgeFont() self.badgeFontMetrics = QFontMetrics(self.badgeFont, self.__paintDevice) # Recalculate various paddings. If they are not recalculated then the # badges may overlap the text and even boxes newHeight = self.monoFontMetrics.boundingRect('W').height() noZoomHeight = self.__noZoomFontMetrics.boundingRect('W').height() self.coefficient = float(newHeight) / float(noZoomHeight) for paramName in NEED_NORMALIZE: setattr(self, paramName, self.__getNormalized(paramName))
def __init__(self, edge, edgeFont): text = edge.label.replace('\\n', '\n') QGraphicsTextItem.__init__(self, text) if edgeFont: self.setFont(edgeFont) else: self.setFont(DEFAULT_FONT) metric = QFontMetrics(self.font()) rec = metric.boundingRect(0, 0, 10000, 10000, Qt.AlignCenter, text) self.setPos(edge.labelX - rec.width() / 2, edge.labelY - rec.height() / 2) # To make double click not delivered self.setFlag(QGraphicsItem.ItemIsSelectable, False)
def __init__(self, paintDevice, params): self.__paintDevice = paintDevice # Used to generate each item unique sequential ID self.itemID = 0 self.__noZoomFontMetrics = QFontMetrics( _DEFAULT_CFLOW_SETTINGS['cfMonoFont']) for key, value in params.items(): setattr(self, key, value) # Some display related settings are coming from the IDE wide settings settings = Settings() setattr(self, 'hidedocstrings', settings['hidedocstrings']) setattr(self, 'hidecomments', settings['hidecomments']) setattr(self, 'hideexcepts', settings['hideexcepts']) self.onFlowZoomChanged()
def __init__(self, paintDevice, params): self.__paintDevice = paintDevice self.__params = params # Used to generate each item unique sequential ID self.itemID = 0 self.__noZoomFontMetrics = QFontMetrics(self.__params['cfMonoFont'], self.__paintDevice) self.coefficient = 1.0 for key, value in params.items(): setattr(self, key, value) # Some display related settings are coming from the IDE wide settings settings = Settings() setattr(self, 'hidedocstrings', settings['hidedocstrings']) setattr(self, 'hidecomments', settings['hidecomments']) setattr(self, 'hideexcepts', settings['hideexcepts']) setattr(self, 'hidedecors', settings['hidedecors']) # Dynamic settings for the smart zoom feature setattr(self, 'noContent', False) setattr(self, 'noComment', False) setattr(self, 'noDocstring', False) setattr(self, 'noBlock', False) setattr(self, 'noImport', False) setattr(self, 'noBreak', False) setattr(self, 'noContinue', False) setattr(self, 'noReturn', False) setattr(self, 'noRaise', False) setattr(self, 'noAssert', False) setattr(self, 'noSysExit', False) setattr(self, 'noDecor', False) setattr(self, 'noFor', False) setattr(self, 'noWhile', False) setattr(self, 'noWith', False) setattr(self, 'noTry', False) setattr(self, 'noIf', False) setattr(self, 'noGroup', False) self.onFlowZoomChanged()
def __createLayout(self): """Creates the dialog layout""" self.resize(640, 480) self.setSizeGripEnabled(True) vboxLayout = QVBoxLayout(self) hLayout = QHBoxLayout() self.__propsView = QTreeWidget() self.__propsView.setAlternatingRowColors(True) self.__propsView.setRootIsDecorated(False) self.__propsView.setItemsExpandable(False) self.__propsView.setSortingEnabled(True) self.__propsView.setItemDelegate(NoOutlineHeightDelegate(4)) self.__propsView.itemSelectionChanged.connect( self.__propsSelectionChanged) propsViewHeader = QTreeWidgetItem(["Property Name", "Property Value"]) self.__propsView.setHeaderItem(propsViewHeader) self.__propsView.header().setSortIndicator(0, Qt.DescendingOrder) hLayout.addWidget(self.__propsView) self.__delButton = QToolButton() self.__delButton.setText("Delete") self.__delButton.setFocusPolicy(Qt.NoFocus) self.__delButton.setEnabled(False) self.__delButton.clicked.connect(self.__onDel) hLayout.addWidget(self.__delButton, 0, Qt.AlignBottom) vboxLayout.addLayout(hLayout) # Set property part setGroupbox = QGroupBox(self) setGroupbox.setTitle("Set Property") setLayout = QGridLayout(setGroupbox) setLayout.addWidget(QLabel("Name"), 0, 0, Qt.AlignTop | Qt.AlignRight) setLayout.addWidget(QLabel("Value"), 1, 0, Qt.AlignTop | Qt.AlignRight) self.__nameEdit = QLineEdit() self.__nameEdit.textChanged.connect(self.__nameChanged) setLayout.addWidget(self.__nameEdit, 0, 1) self.__valueEdit = QTextEdit() self.__valueEdit.setAcceptRichText(False) self.__valueEdit.textChanged.connect(self.__valueChanged) metrics = QFontMetrics(self.__valueEdit.font()) rect = metrics.boundingRect("X") self.__valueEdit.setFixedHeight(rect.height() * 4 + 5) setLayout.addWidget(self.__valueEdit, 1, 1) self.__setButton = QToolButton() self.__setButton.setText("Set") self.__setButton.setFocusPolicy(Qt.NoFocus) self.__setButton.setEnabled(False) self.__setButton.clicked.connect(self.__onSet) setLayout.addWidget(self.__setButton, 1, 2, Qt.AlignBottom | Qt.AlignHCenter) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( setGroupbox.sizePolicy().hasHeightForWidth()) setGroupbox.setSizePolicy(sizePolicy) vboxLayout.addWidget(setGroupbox) # Buttons at the bottom buttonBox = QDialogButtonBox(self) buttonBox.setOrientation(Qt.Horizontal) buttonBox.setStandardButtons(QDialogButtonBox.Ok) buttonBox.button(QDialogButtonBox.Ok).setDefault(True) buttonBox.accepted.connect(self.close) vboxLayout.addWidget(buttonBox)
class CFlowSettings: """Holds the control flow rendering and drawing settings""" def __init__(self, paintDevice, params): self.__paintDevice = paintDevice # Used to generate each item unique sequential ID self.itemID = 0 self.__noZoomFontMetrics = QFontMetrics( _DEFAULT_CFLOW_SETTINGS['cfMonoFont']) self.coefficient = 1.0 for key, value in params.items(): setattr(self, key, value) # Some display related settings are coming from the IDE wide settings settings = Settings() setattr(self, 'hidedocstrings', settings['hidedocstrings']) setattr(self, 'hidecomments', settings['hidecomments']) setattr(self, 'hideexcepts', settings['hideexcepts']) # Dynamic settings for the smart zoom feature setattr(self, 'noContent', False) setattr(self, 'noComment', False) setattr(self, 'noDocstring', False) setattr(self, 'noBlock', False) setattr(self, 'noImport', False) setattr(self, 'noBreak', False) setattr(self, 'noContinue', False) setattr(self, 'noReturn', False) setattr(self, 'noRaise', False) setattr(self, 'noAssert', False) setattr(self, 'noSysExit', False) setattr(self, 'noDecor', False) setattr(self, 'noFor', False) setattr(self, 'noWhile', False) setattr(self, 'noWith', False) setattr(self, 'noTry', False) setattr(self, 'noIf', False) setattr(self, 'noGroup', False) self.onFlowZoomChanged() def __getNormalized(self, value): """Normalize a defalt value to the current zoom""" return ceil(float(_DEFAULT_CFLOW_SETTINGS[value]) * self.coefficient) def onFlowZoomChanged(self): """Triggered when a flow zoom is changed""" self.monoFont = getZoomedCFMonoFont() self.monoFontMetrics = QFontMetrics(self.monoFont, self.__paintDevice) self.badgeFont = getZoomedCFBadgeFont() self.badgeFontMetrics = QFontMetrics(self.badgeFont, self.__paintDevice) # Recalculate various paddings. If they are not recalculated then the # badges may overlap the text and even boxes newHeight = self.monoFontMetrics.boundingRect('W').height() noZoomHeight = self.__noZoomFontMetrics.boundingRect('W').height() self.coefficient = float(newHeight) / float(noZoomHeight) self.ifWidth = self.__getNormalized('ifWidth') self.commentCorner = self.__getNormalized('commentCorner') self.hCellPadding = self.__getNormalized('hCellPadding') self.vCellPadding = self.__getNormalized('vCellPadding') self.hTextPadding = self.__getNormalized('hTextPadding') self.vTextPadding = self.__getNormalized('vTextPadding') self.vHiddenTextPadding = self.__getNormalized('vHiddenTextPadding') self.hHiddenTextPadding = self.__getNormalized('hHiddenTextPadding') self.hHeaderPadding = self.__getNormalized('hHeaderPadding') self.vHeaderPadding = self.__getNormalized('vHeaderPadding') self.vSpacer = self.__getNormalized('vSpacer') self.mainLine = self.__getNormalized('mainLine') self.minWidth = self.__getNormalized('minWidth') self.returnRectRadius = self.__getNormalized('returnRectRadius') self.collapsedOutlineWidth = \ self.__getNormalized('collapsedOutlineWidth') self.openGroupVSpacer = self.__getNormalized('openGroupVSpacer') self.openGroupHSpacer = self.__getNormalized('openGroupHSpacer')
def __createLayout(self, pathsToCommit, pathsToIgnore): """Creates the dialog layout""" self.resize(640, 480) self.setSizeGripEnabled(True) vboxLayout = QVBoxLayout(self) # Paths to commit part commitHeaderFrame = QFrame() commitHeaderFrame.setFrameStyle(QFrame.StyledPanel) commitHeaderFrame.setAutoFillBackground(True) self.__setLightPalette(commitHeaderFrame) commitHeaderFrame.setFixedHeight(24) expandingCommitSpacer = QSpacerItem(10, 10, QSizePolicy.Expanding) self.__selectAllButton = QToolButton() self.__selectAllButton.setAutoRaise(True) self.__selectAllButton.setIcon( getIcon(pluginHomeDir + 'svnselectall.png')) self.__selectAllButton.setFixedSize(20, 20) self.__selectAllButton.setToolTip("Select all") self.__selectAllButton.setFocusPolicy(Qt.NoFocus) self.__selectAllButton.clicked.connect(self.__onSelectAll) commitHeaderLayout = QHBoxLayout() commitHeaderLayout.setContentsMargins(3, 0, 0, 0) commitHeaderLayout.addWidget( QLabel("Paths to commit (total: " + str(len(pathsToCommit)) + ")")) commitHeaderLayout.addSpacerItem(expandingCommitSpacer) commitHeaderLayout.addWidget(self.__selectAllButton) commitHeaderFrame.setLayout(commitHeaderLayout) vboxLayout.addWidget(commitHeaderFrame) self.__pathToCommitView = QTreeWidget() self.__configTable(self.__pathToCommitView) self.__pathToCommitHeader = QTreeWidgetItem(["", "Path", "Status", ""]) self.__pathToCommitView.setHeaderItem(self.__pathToCommitHeader) self.__pathToCommitView.header().setSortIndicator( PATH_COL, Qt.AscendingOrder) self.__pathToCommitView.itemChanged.connect(self.__onCommitPathChanged) vboxLayout.addWidget(self.__pathToCommitView) # Paths to ignore part headerFrame = QFrame() headerFrame.setFrameStyle(QFrame.StyledPanel) headerFrame.setAutoFillBackground(True) self.__setLightPalette(headerFrame) headerFrame.setFixedHeight(24) ignoreLabel = QLabel("Ignored paths (total: " + str(len(pathsToIgnore)) + ")") expandingSpacer = QSpacerItem(10, 10, QSizePolicy.Expanding) self.__showHideIgnoredButton = QToolButton() self.__showHideIgnoredButton.setAutoRaise(True) self.__showHideIgnoredButton.setIcon(getIcon('less.png')) self.__showHideIgnoredButton.setFixedSize(20, 20) self.__showHideIgnoredButton.setToolTip("Show ignored path list") self.__showHideIgnoredButton.setFocusPolicy(Qt.NoFocus) self.__showHideIgnoredButton.clicked.connect(self.__onShowHideIgnored) ignoredHeaderLayout = QHBoxLayout() ignoredHeaderLayout.setContentsMargins(3, 0, 0, 0) ignoredHeaderLayout.addWidget(ignoreLabel) ignoredHeaderLayout.addSpacerItem(expandingSpacer) ignoredHeaderLayout.addWidget(self.__showHideIgnoredButton) headerFrame.setLayout(ignoredHeaderLayout) vboxLayout.addWidget(headerFrame) self.__pathToIgnoreView = QTreeWidget() self.__configTable(self.__pathToIgnoreView) self.__pathToIgnoreView.setVisible(False) pathToIgnoreHeader = QTreeWidgetItem(["Path", "Status"]) self.__pathToIgnoreView.setHeaderItem(pathToIgnoreHeader) self.__pathToIgnoreView.header().setSortIndicator(0, Qt.AscendingOrder) vboxLayout.addWidget(self.__pathToIgnoreView) # Message part vboxLayout.addWidget(QLabel("Message")) self.__message = QTextEdit() self.__message.setAcceptRichText(False) metrics = QFontMetrics(self.__message.font()) rect = metrics.boundingRect("X") self.__message.setFixedHeight(rect.height() * 4 + 5) vboxLayout.addWidget(self.__message) # Diff part diffHeaderFrame = QFrame() diffHeaderFrame.setFrameStyle(QFrame.StyledPanel) diffHeaderFrame.setAutoFillBackground(True) self.__setLightPalette(diffHeaderFrame) diffHeaderFrame.setFixedHeight(24) diffLabel = QLabel("Diff") diffExpandingSpacer = QSpacerItem(10, 10, QSizePolicy.Expanding) self.__showHideDiffButton = QToolButton() self.__showHideDiffButton.setAutoRaise(True) self.__showHideDiffButton.setIcon(getIcon('less.png')) self.__showHideDiffButton.setFixedSize(20, 20) self.__showHideDiffButton.setToolTip("Show diff") self.__showHideDiffButton.setFocusPolicy(Qt.NoFocus) self.__showHideDiffButton.clicked.connect(self.__onShowHideDiff) diffLayout = QHBoxLayout() diffLayout.setContentsMargins(3, 0, 0, 0) diffLayout.addWidget(diffLabel) diffLayout.addSpacerItem(diffExpandingSpacer) diffLayout.addWidget(self.__showHideDiffButton) diffHeaderFrame.setLayout(diffLayout) self.__diffViewer = DiffTabWidget() self.__diffViewer.setHTML(self.NODIFF) self.__diffViewer.setVisible(False) vboxLayout.addWidget(diffHeaderFrame) vboxLayout.addWidget(self.__diffViewer) # Buttons at the bottom buttonBox = QDialogButtonBox(self) buttonBox.setOrientation(Qt.Horizontal) buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.__OKButton = buttonBox.button(QDialogButtonBox.Ok) self.__OKButton.setText("Commit") buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) buttonBox.accepted.connect(self.userAccept) buttonBox.rejected.connect(self.close) vboxLayout.addWidget(buttonBox)
class CFlowSettings: """Holds the control flow rendering and drawing settings""" def __init__(self, paintDevice, params): self.__paintDevice = paintDevice self.__params = params # Used to generate each item unique sequential ID self.itemID = 0 self.__noZoomFontMetrics = QFontMetrics(self.__params['cfMonoFont'], self.__paintDevice) self.coefficient = 1.0 for key, value in params.items(): setattr(self, key, value) # Some display related settings are coming from the IDE wide settings settings = Settings() setattr(self, 'hidedocstrings', settings['hidedocstrings']) setattr(self, 'hidecomments', settings['hidecomments']) setattr(self, 'hideexcepts', settings['hideexcepts']) setattr(self, 'hidedecors', settings['hidedecors']) # Dynamic settings for the smart zoom feature setattr(self, 'noContent', False) setattr(self, 'noComment', False) setattr(self, 'noDocstring', False) setattr(self, 'noBlock', False) setattr(self, 'noImport', False) setattr(self, 'noBreak', False) setattr(self, 'noContinue', False) setattr(self, 'noReturn', False) setattr(self, 'noRaise', False) setattr(self, 'noAssert', False) setattr(self, 'noSysExit', False) setattr(self, 'noDecor', False) setattr(self, 'noFor', False) setattr(self, 'noWhile', False) setattr(self, 'noWith', False) setattr(self, 'noTry', False) setattr(self, 'noIf', False) setattr(self, 'noGroup', False) self.onFlowZoomChanged() def __getNormalized(self, value): """Normalize a defalt value to the current zoom""" return ceil(float(self.__params[value]) * self.coefficient) def onFlowZoomChanged(self): """Triggered when a flow zoom is changed""" self.monoFont = getZoomedCFMonoFont() self.monoFontMetrics = QFontMetrics(self.monoFont, self.__paintDevice) self.badgeFont = getZoomedCFBadgeFont() self.badgeFontMetrics = QFontMetrics(self.badgeFont, self.__paintDevice) # Recalculate various paddings. If they are not recalculated then the # badges may overlap the text and even boxes newHeight = self.monoFontMetrics.boundingRect('W').height() noZoomHeight = self.__noZoomFontMetrics.boundingRect('W').height() self.coefficient = float(newHeight) / float(noZoomHeight) for paramName in NEED_NORMALIZE: setattr(self, paramName, self.__getNormalized(paramName))
def __createLayout(self): """Creates the dialog layout""" self.resize(640, 480) self.setSizeGripEnabled(True) layout = QVBoxLayout() # Plugins list self.__pluginsView = QTreeWidget() self.__pluginsView.setAlternatingRowColors(True) self.__pluginsView.setRootIsDecorated(False) self.__pluginsView.setItemsExpandable(False) self.__pluginsView.setSortingEnabled(True) self.__pluginsView.setItemDelegate(NoOutlineHeightDelegate(4)) self.__pluginsView.setUniformRowHeights(True) # Alert | system/user | Enable | Name | Version self.__pluginsHeader = QTreeWidgetItem( ["", "", "", "Name", "Version", ""]) self.__pluginsView.setHeaderItem(self.__pluginsHeader) self.__pluginsView.header().setSortIndicator(NAME_COL, Qt.AscendingOrder) self.__pluginsView.itemSelectionChanged.connect( self.__pluginSelectionChanged) self.__pluginsView.itemChanged.connect(self.__onItemChanged) layout.addWidget(self.__pluginsView) # Detailed information detailsLabel = QLabel("Detailed information") layout.addWidget(detailsLabel) self.__details = QTreeWidget() self.__details.setAlternatingRowColors(False) self.__details.setRootIsDecorated(False) self.__details.setItemsExpandable(False) self.__details.setSortingEnabled(False) self.__details.setItemDelegate(NoOutlineHeightDelegate(4)) self.__details.setUniformRowHeights(True) detailsHeader = QTreeWidgetItem(["", ""]) self.__details.setHeaderItem(detailsHeader) self.__details.setHeaderHidden(True) metrics = QFontMetrics(self.__details.font()) rect = metrics.boundingRect("X") self.__details.setFixedHeight(rect.height() * 6 + 5) layout.addWidget(self.__details) # Errors/warnings errorsLabel = QLabel("Errors / warnings") layout.addWidget(errorsLabel) self.__errorsText = QTextEdit() self.__errorsText.setReadOnly(True) self.__errorsText.setAcceptRichText(False) metrics = QFontMetrics(self.__errorsText.font()) rect = metrics.boundingRect("X") self.__errorsText.setFixedHeight(rect.height() * 4 + 5) layout.addWidget(self.__errorsText) # Buttons box buttonBox = QDialogButtonBox(self) buttonBox.setOrientation(Qt.Horizontal) buttonBox.setStandardButtons(QDialogButtonBox.Ok) self.__OKButton = buttonBox.button(QDialogButtonBox.Ok) self.__OKButton.setDefault(True) buttonBox.accepted.connect(self.close) buttonBox.rejected.connect(self.close) layout.addWidget(buttonBox) self.setLayout(layout)