Use QPlainTextEdit for log file display

This commit is contained in:
Rebecca Breu 2021-07-09 15:44:05 +02:00
parent 5ec0164390
commit ae71f231e3
4 changed files with 26 additions and 11 deletions

13
beeref.desktop Normal file
View file

@ -0,0 +1,13 @@
[Desktop Entry]
Name=BeeRef
Comment=BeeRef 0.1.0
Terminal=false
Exec=/home/yourname/path/to/beeref/git/dist/BeeRef-0.1.0/BeeRef-0.1.0
Type=Application
Icon=/home/yourname/path/to/BeeRef-0.1.0/beeref/assets/logo.png
Name[en_US]=Beeref
MimeType=application/x-beeref;
Categories=Qt;KDE;Graphics;
X-KDE-NativeMimeType=application/x-beeref
X-KDE-ExtraNativeMimeTypes=

View file

@ -108,12 +108,8 @@ class DebugLogDialog(QtWidgets.QDialog):
with open(logfile_name()) as f:
self.log_txt = f.read()
self.log = QtWidgets.QLabel(self.log_txt)
self.log.setTextInteractionFlags(
Qt.TextInteractionFlag.TextSelectableByMouse)
scroll = QtWidgets.QScrollArea(self)
scroll.setWidgetResizable(True)
scroll.setWidget(self.log)
self.log = QtWidgets.QPlainTextEdit(self.log_txt)
self.log.setReadOnly(True)
buttons = QtWidgets.QDialogButtonBox(
QtWidgets.QDialogButtonBox.StandardButton.Close)
@ -129,7 +125,7 @@ class DebugLogDialog(QtWidgets.QDialog):
name_widget.setTextInteractionFlags(
Qt.TextInteractionFlag.TextSelectableByMouse)
layout.addWidget(name_widget)
layout.addWidget(scroll)
layout.addWidget(self.log)
layout.addWidget(buttons)
self.show()

View file

@ -2,7 +2,7 @@ from setuptools import setup
setup(
name='BeeRef',
version='0.0.1',
version='0.1.0',
author='Rebecca Breu',
author_email='rebecca@rbreu.de',
url='https://github.com/rbreu/beeref',
@ -14,13 +14,19 @@ setup(
'rectangle-packer>=2.0.1',
'exif',
],
packages=['beeref'],
packages=[
'beeref',
'beeref.actions',
'beeref.assets',
'beeref.documentation',
'beeref.fileio',
],
entry_points={
'gui_scripts': [
'beeref = beeref.__main__:main'
]
},
package_data={
'assets': ['*.png', '*.svg'],
'assets': ['*.png', '*.html'],
},
)

View file

@ -12,7 +12,7 @@ def test_debug_log_dialog(qtbot, settings, view):
dialog = DebugLogDialog(view)
dialog.show()
qtbot.addWidget(dialog)
assert dialog.log.text() == 'my log output'
assert dialog.log.toPlainText() == 'my log output'
qtbot.mouseClick(dialog.copy_button, Qt.MouseButton.LeftButton)
clipboard = QtWidgets.QApplication.clipboard()
assert clipboard.text() == 'my log output'