Allow commit info dialog to be resized#109
Conversation
jorio
left a comment
There was a problem hiding this comment.
Sweet! Great contribution.
Perhaps summaryLabel should be selectable, like in QMessageBox? This way the user can copy text even if the details box isn't shown.
| assert "A U Thor" in qmb.text() | ||
| qmb.accept() | ||
| dlg = findCommitInfoDialog(rw, "Merge branch 'a' into c") | ||
| summary = dlg.findChild(QLabel, "commit_info_summary").text() |
There was a problem hiding this comment.
| summary = dlg.findChild(QLabel, "commit_info_summary").text() | |
| summary = dlg.summaryLabel.text() |
I had to rely on object names because QMessageBox doesn't expose its widgets publicly, but that's moot now.
|
|
||
| if MACOS: # pragma: no cover | ||
| self.setStyleSheet("CommitInfoDialog QLabel { font-weight: normal; }") | ||
| MakeNonNativeDialog(self) |
There was a problem hiding this comment.
| if MACOS: # pragma: no cover | |
| self.setStyleSheet("CommitInfoDialog QLabel { font-weight: normal; }") | |
| MakeNonNativeDialog(self) |
This used to override some predefined behavior in QMessageBox, so we can get rid of this now that this isn't a QMessageBox anymore.
| # Click on a "parent" link; this should close the message box and jump to another commit | ||
| label = qmb.findChild(QLabel, "qt_msgbox_label") | ||
| # Click on a "parent" link; this should close the dialog and jump to another commit | ||
| label = dlg.findChild(QLabel, "commit_info_summary") |
There was a problem hiding this comment.
| label = dlg.findChild(QLabel, "commit_info_summary") | |
| label = dlg.summaryLabel |
| self, | ||
| parent: QWidget | None, | ||
| title: str, | ||
| summary_html: str, |
There was a problem hiding this comment.
| summary_html: str, | |
| summaryHtml: str, |
For consistency with the rest of the codebase - camelCase, please :)
(except in porcelain.py because it interfaces with pygit2)
There was a problem hiding this comment.
Hard to break old habits :) Will push a fix
| self.summaryLabel = QLabel(self) | ||
| self.summaryLabel.setObjectName("commit_info_summary") | ||
| self.summaryLabel.setTextFormat(Qt.TextFormat.RichText) | ||
| self.summaryLabel.setText(summary_html) |
There was a problem hiding this comment.
| self.summaryLabel.setText(summary_html) | |
| self.summaryLabel.setText(summaryHtml) |
132ab46 to
3f24a91
Compare
Replace commit info window with a custom dialog box to allow it to be resized. Add CommitInfoDialog as a QDialog with the same info and behaviour. The main difference is that the the dialog is user-resizable with a size grip if the details box is shown. Clicking "Show Details..." or "Hide Details..." will enable or disable resizing. Adjust tests and translation catalog for the new dialog. Note: Language files need to be regenerated
3f24a91 to
fd693d0
Compare
|
All review comments should be fixed now |
The problem:
QMessageBox.setDetailedText()keeps the window at a fixed size whenever the layout updates, which makes long commit bodies hard to read.GetCommitInfoinmisctasks.py) with a customCommitInfoDialog.CommitInfoDialogkeeps the same look: info icon, HTML summary with parent/signature links, optional read-only details in aQPlainTextEdit, and OK to dismiss.