mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Ensure details widget has fixed width for its size hint in the proceed popup
This commit is contained in:
parent
facf01e9dd
commit
cdcfc358e8
@ -11,7 +11,7 @@ from collections import namedtuple
|
|||||||
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QWidget, Qt, QLabel, QVBoxLayout, QPixmap, QDialogButtonBox, QApplication, QTimer,
|
QWidget, Qt, QLabel, QVBoxLayout, QPixmap, QDialogButtonBox, QApplication, QTimer,
|
||||||
QSize, pyqtSignal, QIcon, QPlainTextEdit, QCheckBox, QPainter, QHBoxLayout,
|
QSize, pyqtSignal, QIcon, QPlainTextEdit, QCheckBox, QPainter, QHBoxLayout, QFontMetrics,
|
||||||
QPainterPath, QRectF, pyqtProperty, QPropertyAnimation, QEasingCurve, QSizePolicy)
|
QPainterPath, QRectF, pyqtProperty, QPropertyAnimation, QEasingCurve, QSizePolicy)
|
||||||
|
|
||||||
from calibre.constants import __version__
|
from calibre.constants import __version__
|
||||||
@ -69,6 +69,13 @@ class Icon(QWidget):
|
|||||||
p.drawPixmap(self.rect(), self.icon)
|
p.drawPixmap(self.rect(), self.icon)
|
||||||
p.end()
|
p.end()
|
||||||
|
|
||||||
|
class PlainTextEdit(QPlainTextEdit):
|
||||||
|
|
||||||
|
def sizeHint(self):
|
||||||
|
fm = QFontMetrics(self.font())
|
||||||
|
ans = QPlainTextEdit.sizeHint(self)
|
||||||
|
ans.setWidth(fm.averageCharWidth() * 50)
|
||||||
|
return ans
|
||||||
|
|
||||||
class ProceedQuestion(QWidget):
|
class ProceedQuestion(QWidget):
|
||||||
|
|
||||||
@ -117,7 +124,7 @@ class ProceedQuestion(QWidget):
|
|||||||
self.det_msg_toggle.clicked.connect(self.toggle_det_msg)
|
self.det_msg_toggle.clicked.connect(self.toggle_det_msg)
|
||||||
self.det_msg_toggle.setToolTip(
|
self.det_msg_toggle.setToolTip(
|
||||||
_('Show detailed information about this error'))
|
_('Show detailed information about this error'))
|
||||||
self.det_msg = QPlainTextEdit(self)
|
self.det_msg = PlainTextEdit(self)
|
||||||
self.det_msg.setReadOnly(True)
|
self.det_msg.setReadOnly(True)
|
||||||
self.bb.setStandardButtons(self.bb.Yes|self.bb.No|self.bb.Ok)
|
self.bb.setStandardButtons(self.bb.Yes|self.bb.No|self.bb.Ok)
|
||||||
self.bb.button(self.bb.Yes).setDefault(True)
|
self.bb.button(self.bb.Yes).setDefault(True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user