Merge pull request #122 from vkbo/details_panel_max_size

Fix growing tree details panel on long labels
This commit is contained in:
Veronica K. Berglyd Olsen
2019-11-03 23:20:57 +01:00
committed by GitHub
2 changed files with 10 additions and 3 deletions
+8 -1
View File
@@ -13,6 +13,7 @@
import logging import logging
import nw import nw
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QFont from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import QFrame, QGridLayout, QLabel from PyQt5.QtWidgets import QFrame, QGridLayout, QLabel
@@ -57,8 +58,11 @@ class GuiDocDetails(QFrame):
for nRow in range(4): for nRow in range(4):
lblOne = QLabel(colOne[nRow]) lblOne = QLabel(colOne[nRow])
lblOne.setFont(self.fntOne) lblOne.setFont(self.fntOne)
lblOne.setAlignment(Qt.AlignTop)
self.mainBox.addWidget(lblOne,nRow,0) self.mainBox.addWidget(lblOne,nRow,0)
self.mainBox.addWidget(self.colTwo[nRow],nRow,1) self.mainBox.addWidget(self.colTwo[nRow],nRow,1)
self.colTwo[nRow].setWordWrap(True)
self.colTwo[nRow].setAlignment(Qt.AlignTop)
self.mainBox.setColumnStretch(0,0) self.mainBox.setColumnStretch(0,0)
self.mainBox.setColumnStretch(1,1) self.mainBox.setColumnStretch(1,1)
@@ -74,8 +78,11 @@ class GuiDocDetails(QFrame):
if nwItem is None: if nwItem is None:
colTwo = [""]*4 colTwo = [""]*4
else: else:
theLabel = nwItem.itemName
if len(theLabel) > 100:
theLabel = theLabel[:96].rstrip()+" ..."
colTwo = [ colTwo = [
nwItem.itemName, theLabel,
nwItem.itemStatus, nwItem.itemStatus,
nwLabels.CLASS_NAME[nwItem.itemClass], nwLabels.CLASS_NAME[nwItem.itemClass],
nwLabels.LAYOUT_NAME[nwItem.itemLayout], nwLabels.LAYOUT_NAME[nwItem.itemLayout],
+2 -2
View File
@@ -811,8 +811,8 @@ class GuiMain(QMainWindow):
return return
def _splitViewMove(self, pWidth, pHeight): def _splitViewMove(self, pWidth, pHeight):
"""Alert dependent GUI elements that the main pane splitter has """Alert dependent GUI elements that the edit/view pane splitter
been moved. has been moved.
""" """
self.docEditor.changeWidth() self.docEditor.changeWidth()
return return