pypeit.setup_gui.text_viewer module

Classes for displaying text content to a Qt window.

class pypeit.setup_gui.text_viewer.LogWindow(logBuffer)[source]

Bases: TextViewerWindow

Text window for viewing the PypeIt log messages as they occurr. logBuffer: LogBuffer receiving PypeIt log messages.

Parameters:

logBuffer (LogBuffer)

_messageLogged(message)[source]

Callback that is notified by the log buffer for each message logged.

Parameters:

message (str) – The log message

closeEvent(event)[source]

Event handle for closing the log window. Overridden from QWidget.

Parameters:

event (QEvent) – The close event. Not used by this implementation.

newMessage

Signal sent when a new log message is logged.

class pypeit.setup_gui.text_viewer.TextViewerWindow(title, width, height, text_stream, start_at_top, filename=None, file_type=FileType(name='Text Files', extension='.txt'))[source]

Bases: QWidget

Window to display text. The text can also be saved to a file.

Parameters:
  • title (str) – Title for the window

  • width (int) – Initial width of the window, in characters.

  • height (int) – Initial height of the window, in characters.

  • filename (Union[str, Path, None]) – Name of the file being viewed.

  • text_stream (TextIOBase) – The file object for the text to display.

  • start_at_top (bool) – Whether to start with the window scrolled to the top of the text.

  • filters – File extension filters for saving the file, in the format used by QFileDialog. Defaults to [“Text Files (‘*’.txt)”]

  • file_type (FileType)

addText(text)[source]

Add text to the text viewer

Parameters:

text (str) – The text to add

closeEvent(event)[source]

Event handle for closing the log window. Overridden from QWidget.

Parameters:

event (QEvent) – The close event. Not used by this implementation.

closed

Signal sent when the window is closed.

save()[source]

Save the log to a file.