hyperspyui.uiprogressbar module

Created on Wed Nov 26 19:11:19 2014

@author: Vidar Tonaas Fauske

class hyperspyui.uiprogressbar.Signaler

Bases: QObject

_on_cancel(pid)
cancel

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

created

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

finished

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

on_cancel(pid)
progress

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

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

Bases: tqdm

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

cancel(pid)

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

close()

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

finish()

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

static format_string(n, total, elapsed, rate=None)
uid = 1
update(n=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”.

hyperspyui.uiprogressbar.reset_progressbar()
hyperspyui.uiprogressbar.takeover_progressbar()

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