v0.31.9: Share Library dialog opens tall enough for all its text
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
"""LinTunes — iTunes-style music library manager and player for Linux."""
|
||||
|
||||
__version__ = "0.31.8"
|
||||
__version__ = "0.31.9"
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user