brainvisa.processing.qt4gui modules

brainvisa.processing.qtgui.backwardCompatibleQt

brainvisa.processing.qt4gui.neuroProcessesGUI

class brainvisa.processing.qt4gui.neuroProcessesGUI.AboutWidget(parent=None, name=None)[source]

Bases: PyQt5.QtWidgets.QWidget

class brainvisa.processing.qt4gui.neuroProcessesGUI.BrainVISAAnimation(parent=None)[source]

Bases: PyQt5.QtWidgets.QLabel

class brainvisa.processing.qt4gui.neuroProcessesGUI.ExecutionContextGUI[source]

Bases: brainvisa.processes.ExecutionContext

ask(message, *buttons, **kwargs)[source]

This method asks a question to the user. The message is displayed and the user is invited to choose a value among the propositions. The method returns the index of the chosen value, beginning by 0. If the answer is not valid, the returned value is -1. Sometimes, when the process is called automatically (in batch mode), these calls to context.ask are ignored and return directly -1 without asking question.

Example

>>> if context.ask('Is the result ok ?', 'yes', 'no') == 1:
>>>     try_again()
dialog(parentOrFirstArgument, *args, **kwargs)[source]

This method is available only in a graphical context. Like ask, it is used to ask a question to the user, but the dialog interface is customisable. It is possible to add a signature to the dialog : fields that the user has to fill in.

Example

>>> dial = context.dialog(1, 'Enter a value', Signature('param', Number()), _t_('OK'), _t_('Cancel'))
>>> dial.setValue('param', 0)
>>> r = dial.call()
>>> if r == 0:
>>>     v=dial.getValue('param')
mainThreadActions()[source]

Returns an object which allows to pass actions to be executed in the main thread. Its implementation may differ according to the presence of a running graphics event loop, thus the returned object may be an instance of different classes: soma.qtgui.api.QtThreadCall, soma.qtgui.api.FakeQtThreadCall, or even something else.

In any case the returned mainthreadactions object has 2 methods, call() and push():

result = mainthreadactions.call(function, *args, **kwargs)
#or
mainthreadactions.push(function, *args, **kwargs)
showProgress(value, maxval=None)[source]

Output the given progress value. This is just the output method which is overriden in subclassed contexts.

Users should normally not call it directory, but use progress() instead.

class brainvisa.processing.qt4gui.neuroProcessesGUI.ExecutionNodeGUI(parent, parameterized, read_only=False)[source]

Bases: PyQt5.QtWidgets.QWidget

closeEvent(self, QCloseEvent)[source]
class brainvisa.processing.qt4gui.neuroProcessesGUI.HTMLBrowser(parent=None, name=None, fl=0)[source]

Bases: PyQt5.QtWidgets.QWidget

class BVTextBrowser(parent, name=None)[source]

Bases: soma.qt4gui.text.WebBrowserWithSearch

contextMenuEvent(self, QContextMenuEvent)[source]
closeEvent(self, QCloseEvent)[source]
showCategoryDocumentation(category)[source]

Searches for a documentation file associated to this category and opens it in this browser. Documentation files are in docPath/processes/categories/category. Category is a relative path, so if no documentation is found with the entire path, it removes the first item and retries. For example, if “t1 mri/viewers” doesn’t exists, tries “viewers”. If there is no documentation file, the browser page is empty.

siteSearch()[source]

Search the brainvisa.info website using google search

class brainvisa.processing.qt4gui.neuroProcessesGUI.IterationDialog(parent, parameterized, context)[source]

Bases: PyQt5.QtWidgets.QDialog

accept(self)[source]
class brainvisa.processing.qt4gui.neuroProcessesGUI.MainWindow[source]

Bases: PyQt5.QtWidgets.QWidget

closeEvent(self, QCloseEvent)[source]
class brainvisa.processing.qt4gui.neuroProcessesGUI.NamedPushButton(parent, name)[source]

Bases: PyQt5.QtWidgets.QPushButton

class brainvisa.processing.qt4gui.neuroProcessesGUI.NodeCheckListItem(node, parent, index=None, text=None, itemType=None, read_only=False)[source]

Bases: PyQt5.QtWidgets.QTreeWidgetItem

check(b)[source]

This method is used to check or uncheck a checkable item and warn the underlying model of the state change. It is useful for the feature select/unselect before/after/all in pipelines and iterations.

currentItemChanged(current)[source]

This function is called when the item gains or lose the status of current item of the tree widget. In case the item is a radio button, its background and foreground colors are changed to follow the tree item widget policy.

Parameters

current – indicates if the item is the current item or not. boolean.

setIcon(self, int, QIcon)[source]
class brainvisa.processing.qt4gui.neuroProcessesGUI.ParameterLabel(parameterName, mandatory, parent, userLevel=0)[source]

Bases: PyQt5.QtWidgets.QLabel

A QLabel that emits signal ‘contextMenuEvent’ whenever a contextMenuEvent occurs

contextMenuEvent(self, QContextMenuEvent)[source]
lockChanged(checked=False)[source]

This function is to lock or unlock data if a user click on the lock menu

readText(txt)[source]

Function to return the value of text without value of tag for images

setlock(default)[source]

This function is to set lock or unlock data

class brainvisa.processing.qt4gui.neuroProcessesGUI.ParameterizedWidget(parameterized, parent)[source]

Bases: PyQt5.QtWidgets.QWidget

closeEvent(self, QCloseEvent)[source]
parameterChanged(parameterized, parameterName, value)[source]

This method is called when an attribute has changed in the model. A parameter can change in the model because it is links to another parameter that has changed or because the user changed it in the GUI.

readUserValues()[source]

Ensure that values typed by the user are taken into account

setValue(parameterName, value, default=0)[source]

Set the value of a parameter

class brainvisa.processing.qt4gui.neuroProcessesGUI.ProcessEdit(process)[source]

Bases: PyQt5.QtWidgets.QDialog

accept(self)[source]
closeEvent(self, QCloseEvent)[source]
class brainvisa.processing.qt4gui.neuroProcessesGUI.ProcessSelectionWidget[source]

Bases: PyQt5.QtWidgets.QMainWindow

This widget is the main window in brainvisa. Provides navigation among processes.

buttonSearch()[source]

Called when user click on search / next button. The text written in the search box is searched in tree leaves names (processes). The first item found which name contains the searched string becomes selected. If the user click another time on the search / next button, next item is searched…

closeEvent(self, QCloseEvent)[source]
itemSelected(item)[source]

Called when a tree item becomes selected. currentProcessId is updated and associated documentation is shown.

Parameters

item – the newly selected item ProcessTree.Item

keyPressEvent(self, QKeyEvent)[source]
openProcess(item=None)[source]

Called to open current process. If the process is not given, selected process in current tree is opened.

Parameters

item – the process to open. ProcessTree.Item

resetSearch()[source]

Called at the end of a search or when the user click on reset button.

updateList()[source]

Reloads the list of process trees.

class brainvisa.processing.qt4gui.neuroProcessesGUI.ProcessTreesWidget(processTrees=None, parent=None)[source]

Bases: PyQt5.QtWidgets.QSplitter

A widget that shows a list of ProcessTree. Each process tree presents a sub group of existing processes.

It’s composed of two parts : * the list of process trees (use profiles) * a view of currently selected tree Each process tree can be opened in another window in order to enable drag and drop from one tree to another.

treeIndex

Widget containing items representing each process tree. TreeListWidget.

treeStack

A stack of EditableTreeWidget, representing the content of each processTree. QWidgetStack.

treeStackIdentifiers

dict associating a processTree to an unique integer identifier used with the widget stack. Only the selected processTree widget of the stack is visible.

widgets

list of EditableTreeWidget currently in the stack. Useful because QWidgetStack doesn’t provide iterator on its content.

openedTreeWidget

Currently opened process tree. It is in a window independant from the main window. EditableTreeWidget

model

list of ProcessTree which this widget represents. ProcessTrees

popupMenu

QPopupMenu contextual menu associated to the list of process trees.

savesTimer

QTimer started when the model has changed. When the timer times out, the model is saved. Used to delay model saves : it speeds up execution when there is several modification at the same time (drag&drop several elements).

Parameters
  • processTrees – ProcessTrees, the list of process trees which this widget represents

  • parent – QWidget, container of this widget

addProcessTree(processTree)[source]

Add elements in the widget to add a representation of this process tree.

Parameters

processTree – new process tree for which the widget must be completed.

doubleClicked_slot(item, col)[source]

Called on double click on an item of current process tree. This method emits a signal that must be caught by parent widget.

findItem(name)[source]

Find items that contain the string given in parameters in their name. Each found item is selected and yield (and replace previous selection). Wide search.

Parameters

name – string searched in items names.

Return type

generator

menuDelTabEvent()[source]

Called on click on del option in contextual menu. Removes the selected tree from the model.

menuEditProcessEvent()[source]

Called on click on edit option in process menu. Emits a signal for the parent window which will edit the process.

menuIterateProcessEvent()[source]

Called on click on iterate option in process menu. Emits a signal for the parent window which will iterate the process.

menuNewTabEvent()[source]

Called on click on new option in contextual menu. Adds a new empty tree in the model.

menuOpenProcessEvent()[source]

Called on click on open option in process menu. Emits a signal for the parent window which will open the process.

menuOpenTabEvent()[source]

Called on click on open option in contextual menu. Opens selected tree in a new window.

menuSetDefaultEvent()[source]

Called on click on set default option in contextual menu. Sets the selected tree as the default selected tree. So on next run of brainvisa, this tree will be selected.

modelChanged(action=None, items=None, position=None)[source]

Method registred to be called when a process tree has changed or when the list of tree has changed. New ProcessTree list must be saved in a minf file. If change is insertion of a new item in a tree, registers listeners on this new item.

openContextMenu(point)[source]

Called on contextMenuRequested signal. It opens the popup menu at cursor position.

openProcessMenu(listView, point)[source]

Called on contextMenuRequested signal on the list of processes of a toolbox. It opens the process menu at cursor position if the current item represents a process.

select(widget, item, lastSelection)[source]

Select a process tree and an item in it. Undo last selection.

Parameters
  • widget – EditableTreeWidget, the tree widget that contains the item to select.

  • item – EditableTreeItem, the item (process) to select

  • lastSelection – tuple(EditableTreeWidget, EditableTreeItem), previous selected item and its container, to be unselected.

selectIndex(model)[source]

Select a process tree in the left panel (toolboxes).

Parameters

model – the process tree to select

selectionChanged_slot(item, col=0)[source]

Called when selected item has changed in current process tree. This method emits a signal that must be caught by parent widget.

setCurrentTree(item, previous=None)[source]

Changes the visible widget in the stack.

setModel(processTrees)[source]

The widget is initialized with the given list of process tree. For each process tree, an item is added in treeIndex. A widget is created to represent each process tree and added to treeStack.

Parameters

processTrees – the list of process trees which this widget represents

updateContent(action=None, items=None, position=None)[source]

Called on model change (list of process trees). The widget must update itself to reflect the change.

updateSelectedTree(newSelection)[source]

Called when the selected tree changes.

class brainvisa.processing.qt4gui.neuroProcessesGUI.ProcessView(processId, parent=None, externalInfo=None, read_only=False)[source]

Bases: PyQt5.QtWidgets.QWidget, brainvisa.processing.qt4gui.neuroProcessesGUI.ExecutionContextGUI

closeEvent(self, QCloseEvent)[source]
dialog(modal, message, signature, *buttons)[source]

This method is available only in a graphical context. Like ask, it is used to ask a question to the user, but the dialog interface is customisable. It is possible to add a signature to the dialog : fields that the user has to fill in.

Example

>>> dial = context.dialog(1, 'Enter a value', Signature('param', Number()), _t_('OK'), _t_('Cancel'))
>>> dial.setValue('param', 0)
>>> r = dial.call()
>>> if r == 0:
>>>     v=dial.getValue('param')
openContextMenu(point)[source]

Called on contextMenuRequested signal. It opens the popup menu at cursor position.

system(*args, **kwargs)[source]

This function is used to call system commands. It is very similar to functions like os.system() in Python and system() in C. The main difference is the management of messages sent on standard output. These messages are intercepted and reported in BrainVISA interface according to the current execution context.

Moreover, a command started using this function can be interrupted via the Interrupt button in the interface which is not the case if the python os.system() function is used directly.

If the command is given as one argument, it is converted to a string and passed to the system. If there are several arguments, each argument is converted to a string, surrounded by simple quotes and all elements are joined, separated by spaces. The resulting command is passed to the system. The second method is recommended because the usage of quotes enables to pass arguments that contain spaces. The function returns the value returned by the system command.

optional keyword paramerers

outputLevel: (int)

if >=0 and < userLevel, write stdout in log

stdoutInContext: (bool)

if True, write stdout in the current context output

ignoreReturnValue: (bool)

if True, ignore the command return value. Useful when you know the command will exit badly even if the work is done.

stdout: (file object)

if specified, stdout will be written in this stream. It may be a StringIO object.

stderr: (file object)

if specified, stderr will be written in this stream. It may be a StringIO object.

nativeEnv: (bool or None)

if True, forces execution within the “native” system environment variables (for commands external to the brainvisa binary distribution). If False, force execution within the current brainvisa environment. If None (default), guess if the executed command path is external to the main brainvisa path.

cwd: (str or None)

Current directory of the child process (by default or if None, it is inherited from the parent process i.e. BrainVISA).

env: dict

Environment variables to be set. Contrarily to soma.subprocess.Popen, they do not completely replace the current environment variables, but only add / replace the given variables. If both env and nativeEnv keyword arguments are used, nativeEnv acts before env, thus native environment can be overriden by env.

Example

>>> arg1 = 'x'
>>> arg2 = 'y z'
>>> context.system('command ' + arg1 + ' ' + arg2)
>>> context.system('command', arg1, arg2)

The first call generates the command command x y z which calls the commands with 3 parameters. The second call generates the command ‘command’ ‘x’ ‘y z’ which calls the command with two parameters.

class brainvisa.processing.qt4gui.neuroProcessesGUI.RadioItem(text, group, parent=None)[source]

Bases: PyQt5.QtWidgets.QWidget

An custom item to replace a QTreeWidgetItem for the representation of a SelectionExecutionNode item with a radio button. QTreeWidgetItem enables only check box items.

class brainvisa.processing.qt4gui.neuroProcessesGUI.RemoteContextGUI(parent, name='Remote Hosts:')[source]

Bases: PyQt5.QtWidgets.QTreeWidgetItem

Specific GUI to display messages returned by processes executed remotely.

The specific GUI is a QListView. It is composed of an arborescence of QListViewItems that sorts the messages according to the process and the host they belong to:

Remote Hosts: | –host


--process

–message –message

--process

–message

Parameters
  • parent – the QListView.

  • name – name

class brainvisa.processing.qt4gui.neuroProcessesGUI.SectionTitle(section_title, section_widgets=[], collapsed=False)[source]

Bases: PyQt5.QtWidgets.QLabel

This widget is used to create a virtual signature separation, called implicitly by “section” argument. All parameters will be grouped by section in signature with this label text as title.

Examples

‘bool_field’, Boolean(section=’Section title’), or ‘image’, WriteDiskItem( ‘4D Volume’, ‘NIFTI-1 image’, section=’Output images’ ),

mouseReleaseEvent(self, QMouseEvent)[source]
class brainvisa.processing.qt4gui.neuroProcessesGUI.SomaWorkflowMiniWidget(model, sw_widget, parent=None)[source]

Bases: soma_workflow.gui.workflowGui.SomaWorkflowMiniWidget

class brainvisa.processing.qt4gui.neuroProcessesGUI.SomaWorkflowProcessView(model, workflow_id, resource_id, process=None, serialized_process=None, parent=None)[source]

Bases: PyQt5.QtWidgets.QMainWindow

closeEvent(self, QCloseEvent)[source]
class brainvisa.processing.qt4gui.neuroProcessesGUI.SomaWorkflowWidget(model, computing_resource=None, parent=None)[source]

Bases: soma_workflow.gui.workflowGui.SomaWorkflowWidget

workflow_filter(workflows)[source]

Reimplement this function to filter the displayed workflows.

class brainvisa.processing.qt4gui.neuroProcessesGUI.UserDialog(parent, modal, message, signature, buttons)[source]

Bases: PyQt5.QtWidgets.QDialog

class brainvisa.processing.qt4gui.neuroProcessesGUI.WidgetScrollV(parent=None, name=None)[source]

Bases: PyQt5.QtWidgets.QScrollArea

class brainvisa.processing.qt4gui.neuroProcessesGUI.WorkflowSubmissionDlg(parent=None)[source]

Bases: PyQt5.QtWidgets.QDialog

brainvisa.processing.qt4gui.neuroProcessesGUI.reloadToolboxesGUI()[source]

Calls brainvisa.processes.reloadToolboxes() and updates the main window (list of toolboxes or processes may have changed). If some databases should be updated, the user is warned.

brainvisa.processing.qt4gui.neuroProcessesGUI.runCsvViewer(source, existingWidget=None)[source]

run the CSV viewer defined in BV config. If it is a builtin viewer, use an existing widget, or instantiate and return a new one.

brainvisa.processing.qt4gui.neuroProcessesGUI.runHtmlBrowser(source, existingWidget=None)[source]

run the HTML browser defined in BV config. If it is a builtin browser, use an existing widget, or instantiate and return a new one.

brainvisa.processing.qt4gui.neuroProcessesGUI.showProcess(process_id, *args, **kwargs)[source]

Opens a process window and set the corresponding arguments

brainvisa.processing.qt4gui.neuroLogGUI

class brainvisa.processing.qt4gui.neuroLogGUI.LogItemsViewer(logitems=[], parent=None)[source]

Bases: PyQt5.QtWidgets.QWidget

Widget to visualize a list of neuroLog.LogFile.Item. It is compound of a splitter with the list of items displayed as a QTreeWidget at the left and the text of the content of the selected item at the right side. A contextual menu is available on the content panel to search a string in the text.

findItem(name)[source]

Find items that contain the string given in parameters in their name. Each found item is selected and yield (and replace previous selection). Wide search. @type name: string @param name: string searched in items names.

@rtype: generator @return: a generator

keyPressEvent(self, QKeyEvent)[source]
class brainvisa.processing.qt4gui.neuroLogGUI.LogViewer(fileName, parent=None, name=None)[source]

Bases: PyQt5.QtWidgets.QWidget

A viewer for a log file. The file is read and its items are displayed in a LogItemsViewer. Buttons are available at the bottom of the window to refresh the display, close the window or open a new log file.

closeEvent(self, QCloseEvent)[source]

brainvisa.processing.qt4gui.neuroExceptionGUI

class brainvisa.processing.qt4gui.neuroExceptionGUI.ShowException(messageHTML, detailHTML, parent=None, caption=None)[source]

Bases: PyQt5.QtWidgets.QDialog

closeEvent(self, QCloseEvent)[source]

brainvisa.processing.qt4gui.command

brainvisa.configuration.qt4gui.neuroConfigGUI

class brainvisa.configuration.qt4gui.neuroConfigGUI.BugReportDialog(parent=None, name=None)[source]

Bases: PyQt5.QtWidgets.QWidget

brainvisa.configuration.qt4gui.neuroConfigGUI.editConfiguration()[source]

Opens Brainvisa options window. When the user closes the window, the configuration is saved in Brainvisa options file.

Some options are taken into account immediately:

  • if databases selection has changed, databases are reloaded

  • if userLevel has changed, the list of available processes is updated

  • new HTML browser and new text editors are taken into account

  • language change is applied to documentation pages.

Some other options are not applied directly but are saved in the options file and will be applied next time Brainvisa is started.