neurochat.nc_uiutils module¶
This module implements utility functions and classes for NeuroChaT UI.
@author: Md Nurul Islam; islammn at tcd dot ie
-
class
neurochat.nc_uiutils.NLogBox(parent=None)[source]¶ Bases:
PyQt5.QtWidgets.QTextEditThis class creates a formatted text-editable log-box for NeuroChaT.
Subclassed from PyQt5.QtWidgets.QTextEdit
-
class
neurochat.nc_uiutils.NOut[source]¶ Bases:
PyQt5.QtCore.QObjectImplements the Qt signalling mechanism.
Subclassed from PyQt5.QtCore.QObject, it implements the Qt signalling mechanism so that when a text is written using NOut() object, it emits a text to the output to an output console or file or where the emitted signal is connected to.
In NeuroChaT, the sys.stdout.write is replaced with NOut().write, which means print(‘some text’) will print to GUI log box in GUI and to the standard output console when used in API.
-
emitted¶
-
-
class
neurochat.nc_uiutils.PandasModel(data, parent=None)[source]¶ Bases:
PyQt5.QtCore.QAbstractTableModelClass to populate a QT table view with a pandas dataframe.
Also implements methods that are to be overridden.
-
columnCount(parent=None)[source]¶ Override the columnCount() method.
Parameters: parent (QtCore.QModelIndex) – Specific model for item index. Usually not required. Returns: int – Count of column in the item model
-
data(index, role=0)[source]¶ Data model for the QtCore.QAbstractTableModel.
Parameters: - index – Pandas DataFrame index
- role (Qt.ItemDataRole) – Usually set for QtCore.Qt.DisplayRole which means the data to rendered in the form of text
Returns: str – Returns the data in the DataFrame’s ‘index’ location in str format
-
headerData(index, orientation, role)[source]¶ Data model for the QtCore.QAbstractTableModel.
Parameters: - index – Pandas DataFrame index
- orientation (Qt.Orientation) – Orientation of the data
- role (Qt.ItemDataRole) – Usually set for QtCore.Qt.DisplayRole which means the data to be rendered in the form of text
Returns: - Data in the DataFrame().columns[index] if orientation is ‘Horizontal’
- or DataFrame().index[index] if orientation is ‘Vertical’
-
-
class
neurochat.nc_uiutils.ScrollableWidget[source]¶ Bases:
PyQt5.QtWidgets.QWidgetThis class creates a scrollable PyQt5 widget.
Subclassed from PyQt5.QtWidgets.QWidget
-
neurochat.nc_uiutils.add_check_box(parent=None, position=None, obj_name='', text=None)[source]¶ Return a QtWidgets.QCheckBox() object.
Parameters: - parent – Parent widget
- position (tuple) – Position in the parent object
- obj_name (str) – Name of the newly created object
- text (str) – Check box text
Returns: QtWidgets.QCheckBox – Instance of QtWidgets.QCheckBox Class
-
neurochat.nc_uiutils.add_combo_box(parent=None, position=None, obj_name='')[source]¶ Return a QtWidgets.QComboBox() object.
Parameters: - parent – Parent widget
- position (tuple) – Position in the parent object
- obj_name (str) – Name of the newly created object
Returns: QtWidgets.QComboBox – Instance of QtWidgets.QComboBox Class
-
neurochat.nc_uiutils.add_double_spin_box(parent=None, position=None, min_val=0, max_val=1, obj_name='')[source]¶ Return a QtWidgets.QDoubleSpinBox() object.
Parameters: - parent – Parent widget
- position (tuple) – Position in the parent object
- min_val (float) – Minimum value of the spin-box
- max_val (float) – Maximum value of the spin-box
- obj_name (str) – Name of the newly created object
Returns: QtWidgets.QDoubleSpinBox – Instance of QtWidgets.QDoubleSpinBox Class
-
neurochat.nc_uiutils.add_group_box(parent=None, position=None, obj_name='', title=None)[source]¶ Return a QtWidgets.QGroupBox() object.
Parameters: - parent – Parent widget
- position (tuple) – Position in the parent object
- obj_name (str) – Name of the newly created object
- title (str) – Title of the group-box
Returns: QtWidgets.QGroupBox – Instance of QtWidgets.QGroupBox Class
-
neurochat.nc_uiutils.add_label(parent=None, position=None, obj_name='', text=None)[source]¶ Return a QtWidgets.QLabel() object.
Parameters: - parent – Parent widget
- position (tuple) – Position in the parent object
- obj_name (str) – Name of the newly created object
- text (str) – Label text
Returns: QtWidgets.QLabel – Instance of QtWidgets.QLabel Class
-
neurochat.nc_uiutils.add_line_edit(parent=None, position=None, obj_name='', text=None)[source]¶ Return a QtWidgets.QLineEdit() object.
Parameters: - parent – Parent widget
- position (tuple) – Position in the parent object
- obj_name (str) – Name of the newly created object
- text (str) – Line-edit text
Returns: QtWidgets.QLineEdit – Instance of QtWidgets.QLineEdit Class
-
neurochat.nc_uiutils.add_log_box(obj_name)[source]¶ Return a NLogBox() object.
Parameters: obj_name (str) – Name of the newly created object Returns: NLogBox – Instance of NLogBox Class
Return a QtWidgets.QPushButton() object.
Parameters: - parent – Parent widget
- position (tuple) – Position in the parent object
- obj_name (str) – Name of the newly created object
- text (str) – Button text
Returns: QtWidgets.QPushButton – Instance of QtWidgets.QPushButton Class
Return a QtWidgets.QRadioButton() object.
Parameters: - parent – Parent widget
- position (tuple) – Position in the parent object
- obj_name (str) – Name of the newly created object
- text (str) – Button text
Returns: QtWidgets.QRadioButton – Instance of QtWidgets.QRadioButton Class
-
neurochat.nc_uiutils.add_spin_box(parent=None, position=None, obj_name='', min_val=0, max_val=128)[source]¶ Return a QtWidgets.QSpinBox() object.
Parameters: - parent – Parent widget
- position (tuple) – Position in the parent object
- min_val (int) – Minimum value of the spin-box
- max_val (int) – Maximum value of the spin-box
- obj_name (str) – Name of the newly created object
Returns: QtWidgets.QSpinBox – Instance of QtWidgets.QSpinBox Class
-
neurochat.nc_uiutils.add_widget(parent=None, position=None, obj_name='')[source]¶ Return a QtWidgets.QWidget() object.
Parameters: - parent – Parent widget
- position (tuple) – Position in the parent object
- obj_name (str) – Name of the newly created object
Returns: QtWidgets.QWidget – Instance of QtWidgets.QWidget Class