Braviz Qt Widgets

This module contain PyQt widgets that may be used in several applications.

class ListValidator(valid_options)[source]

Can be applied to QLineEdit so that it will only accept input from a list of possible values.

Can be used together with QCompleter

Parameters:valid_options (set) – Set of valid strings to accept as input
class ContextVariablesPanel(parent, title='Context', initial_variable_idxs=None, initial_subject=None, app=None, sample=None)[source]

A panel that displays and allows to edit variables for a given subject.

The context menu of the panel allows the user to select variables and to make some of them editable. In this case a save changes button will also be displayed. Pressing it will cause the changes to be written into the databases

Parameters:
  • parent (QObject) – Qt parent
  • title (str) – Title for the widget
  • initial_variable_idxs (list) – List of variable indices to display at start
  • initial_subject – Id of the initial subject whose variable values will be displayed
  • app – Optional, an application with the save_screenshot and get_state_dict method. In this case a scenario will be automatically created whenever a variable is first modified.
  • sample (list) – list of subjects. This sample will be passed on to the variable select dialog deployed by the panel.
create_context_menu(pos)[source]

Create a context menu which gives the user the option to open a dialog to select variables

Parameters:pos – Position of event
get_editables()[source]

Get a list of tuples (var_code, editable) indicating which variables are editable

get_variables()[source]

Get a list of current variable codes

set_sample(new_sample)[source]

Set the sample used in the variable selection dialogs

Parameters:new_sample (list) – List of subject ids
set_subject(subject_id)[source]

Set the current subject to which variable values are associated

Parameters:subject_id – Subject id
set_variables(variables, editables=None)[source]

Sets a new set of variables for the panel

Parameters:
  • variables (list) – List of variable indices
  • editables (dict) – Dictionary mapping variable indices to booleans that indicate if a variable should be modifiable by the user
Context panel example
class RotatedLabel(parent)[source]

A vertical label useful for labeling rows of data

Parameters:parent (QObject) – Qt Parent
set_color(color)[source]

Sets the color of the label

Parameters:color (tuple) – a 3-tuple with values in [0,1]
RotatedLabel example