hyperspyui.uiprogressbar module

Created on Wed Nov 26 19:11:19 2014

@author: Vidar Tonaas Fauske

class hyperspyui.uiprogressbar.Signaler

Bases: PyQt5.QtCore.QObject

class hyperspyui.uiprogressbar.UIProgressBar(*_, **__)

Bases: tqdm.std.tqdm

Connector between hyperspy process with a progressbar, and the UI. See also the doc for wrap() for more details.


Slot for the UI to call if it wants to cancel the process. Thread safe.


Cleanup and (if leave=False) close the progressbar.


Used to tell the progress is finished. Called by hyperspy side.

static format_string(n, total, elapsed, rate=None)
uid = 1

Updates the progress bar to a new value. Called by the hyperspy side. Not safe to call from UI.

classmethod write(s, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, end='\n')

Print a message via tqdm_gui (just an alias for print)

hyperspyui.uiprogressbar._wrap(*args, **kwargs)

Replacement function for hyperspy.external.progressbar.progressbar(). Causes a UIProgressBar() to be made, which the MainWindow can connect to in order to create a progress indicator. It is important that the connection is made with QtCore.Signals, as they are thread aware, and the signal is processed on the GUI main event loop, i.e. the main thread. This is necessary as all UI operations have to happen on the main thread, and the hyperspy processing might be pushed to a worker thread “threaded.py”.


Replace hyperspy.external.progressbar.progressbar() with uiprogressbar.wrap(). The main_window will be connected to all the events whenever a progressbar is created.