daplis_rtp.gui.tabs.base module
What the four plotting tabs do the same way.
Finding the newest data file, noticing when a new one lands, reporting a file that cannot be read, stopping cleanly when it goes wrong: each tab had its own copy of all four, and they had drifted. Only one of them guarded against the refresh firing again while one was still running, only one closed over the case of the directory disappearing mid-stream, and the three that showed an error box left the timer running behind it - so a modal box, which spins an event loop of its own, stacked a new box on top of itself every 100 ms until the stream was stopped by hand.
- class daplis_rtp.gui.tabs.base.PlotTab(parent=None)[source]
Bases:
TabShellA tab with a plot, a folder of data files, and a live stream.
- canvas_class = None
- hint_text = ''
- static last_data_file(path)[source]
The newest ‘.dat’ file in
path, orNone.Nonecovers both a directory with no data files in it and the files - or the directory itself - going away while the stream runs:globlists the directory first andgetctimeis called on the result afterwards, so a file that disappears in between raisesOSErrorrather than simply dropping out of the list.
- no_data(message)[source]
There is nothing to read in the folder.
Silent while a stream is running, because that is the ordinary way a run begins: the stream is started first and the acquisition second, so the folder is empty for the first few seconds by design. Interrupting that with a message box - and stopping the stream to show it, as every error here must - meant the stream could not be armed before the data it was waiting for existed.
An explicit ‘Refresh plot’ is a different question, and gets a different answer: nothing there is exactly what the user asked about.
- on_session_restored()[source]
Hook: derive whatever the restored controls imply.
A control whose value the tab also keeps in a variable - a cycle length parsed out of a line edit - has to be re-read once the stored text is back in the widget.
- plotted_data()[source]
The numbers behind the plot, for File -> Export.
Returns
Nonewhen there is nothing to export, or a dict:stemA suggested file name, without an extension.
columnsOrdered
{heading: 1-D array}; every column the same length.notesLines describing where the numbers came from, written into the file as
#comments so that a plot found on a disk six months later can still say what it was.
- report_error(text, details=None)[source]
Stop the stream, then say what went wrong.
In that order on purpose: a modal box runs an event loop of its own, so a stream left running would ask for
refreshagain behind it and stack a new box on top of this one for as long as it stayed open.
- session_scope = ''