diff --git a/lintunes/__init__.py b/lintunes/__init__.py index b80a732..810756f 100644 --- a/lintunes/__init__.py +++ b/lintunes/__init__.py @@ -1,3 +1,3 @@ """LinTunes — iTunes-style music library manager and player for Linux.""" -__version__ = "0.31.8" +__version__ = "0.31.9" diff --git a/lintunes/gui/cassette_dialogs.py b/lintunes/gui/cassette_dialogs.py index f1f08a9..a1dc534 100644 --- a/lintunes/gui/cassette_dialogs.py +++ b/lintunes/gui/cassette_dialogs.py @@ -37,7 +37,6 @@ class ShareInviteDialog(QDialog): def __init__(self, code: str, parent=None): super().__init__(parent) self.setWindowTitle("Share Library with a Friend") - self.resize(520, 260) layout = QVBoxLayout(self) intro = QLabel( "Send this code to one friend. They paste it into " @@ -51,6 +50,11 @@ class ShareInviteDialog(QDialog): self.code = QPlainTextEdit(code) self.code.setReadOnly(True) self.code.setLineWrapMode(QPlainTextEdit.LineWrapMode.WidgetWidth) + # Room for the whole code (four lines at this width) without scrolling. + lines = 5 + self.code.setMinimumHeight( + self.code.fontMetrics().lineSpacing() * lines + + 2 * (self.code.frameWidth() + int(self.code.document().documentMargin()))) layout.addWidget(self.code, stretch=1) row = QHBoxLayout() self.copy = QPushButton("Copy Code") @@ -63,6 +67,12 @@ class ShareInviteDialog(QDialog): done.clicked.connect(self.accept) row.addWidget(done) layout.addLayout(row) + # Open tall enough for the wrapped intro: a fixed height cut its last + # line off, since a word-wrapped label only knows its height for a + # given width. + width = 560 + self.resize(width, max(layout.totalHeightForWidth(width), + layout.totalMinimumSize().height())) def _copy(self): QGuiApplication.clipboard().setText(self.code.toPlainText())