mcsas.gui.bases.logwidget module¶
-
class
LogWidget(parent=None, appversion=None)[source]¶ Bases:
QTextBrowser,gui.bases.mixins.contextmenuwidget.ContextMenuWidgetSimple TextEdit which can save its contents to file.
Fill it with text. >>> from gui.utils.dialoginteraction import DialogInteraction >>> from gui.widgets.logwidget import LogWidget >>> testdata = ‘blablubbanblubb’ >>> te = DialogInteraction.instance(LogWidget) >>> te.append(testdata) >>> te.contents() == testdata True
Call save to file dialog and save. >>> fn = str(DialogInteraction.query(fileDialogType(), te.saveToFile, ... slot = ‘accept’))
Verify written data and remove test file. >>> import os >>> data = None >>> if fn is not None: ... data = open(fn).read() ... os.remove(fn) >>> data == testdata True
PlainTextEdit Tests: Simple TextEdit which can save its contents to file.
Fill it with text. >>> from utilsgui import DialogInteraction, fileDialogType >>> from plaintextedit import PlainTextEdit >>> testdata = ‘blablubbanblubb’ >>> te = DialogInteraction.instance(PlainTextEdit) >>> te.appendPlainText(testdata) >>> te.toPlainText() == testdata True
Call save to file dialog and save. >>> fn = str(DialogInteraction.query(fileDialogType(), te.saveToFile, ... slot = ‘accept’))
Verify written data and remove test file. >>> import os >>> data = None >>> if fn is not None: ... data = open(fn).read() ... os.remove(fn) >>> data == testdata True
-
appversion¶
-
isCopyAvailable()[source]¶ Warning
method ‘gui.bases.logwidget.LogWidget.isCopyAvailable’ undocumented
-
onCloseSlot()[source]¶ Workaround to exit a program during calculation. Logging a message processes Qt events (see append()). It makes sure this slot is called if connected to a application close signal. For example, emitted by the main window on closeEvent().
-
saveToFile(filename=None)[source]¶ Warning
method ‘gui.bases.logwidget.LogWidget.saveToFile’ undocumented
-
scrollToBottom()[source]¶ Warning
method ‘gui.bases.logwidget.LogWidget.scrollToBottom’ undocumented
-
setCopyAvailable(yes)[source]¶ Warning
method ‘gui.bases.logwidget.LogWidget.setCopyAvailable’ undocumented
-
title= None¶
-