Set an appropriate size hint for the comments dialog

This commit is contained in:
Kovid Goyal 2021-12-04 08:21:34 +05:30
parent 414fc5f669
commit 0ef264056f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -6,7 +6,8 @@ __docformat__ = 'restructuredtext en'
__license__ = 'GPL v3'
from qt.core import (
QApplication, QDialog, QDialogButtonBox, QPlainTextEdit, QSize, Qt, QVBoxLayout
QApplication, QDialog, QDialogButtonBox, QPlainTextEdit, QSize, Qt,
QVBoxLayout
)
from calibre.gui2 import Application, gprefs
@ -43,6 +44,13 @@ class CommentsDialog(QDialog):
geom = gprefs.get('comments_dialog_geom', None)
if geom is not None:
QApplication.instance().safe_restore_geometry(self, geom)
else:
self.resize(self.sizeHint())
def sizeHint(self):
ans = super().sizeHint()
ans.setWidth(500), ans.setHeight(600)
return ans
def save_geometry(self):
gprefs.set('comments_dialog_geom', bytearray(self.saveGeometry()))