MainUI package

Submodules

MainUI.InputSelectorDialog module

class MainUI.InputSelectorDialog.InputSelectorDialog(channels)

Bases: PyQt5.QtWidgets.QDialog

This class creates a dialog window that lets the user select an input audio device and then select which channels to record form that device. The result of the selection is saved in self.channels, a list. The last entry of the list is the device index while all other entries list the channels to record: e.g. [0,1,2,4] -> record channel 0, 1 and 2 from device 4.

buildDrop()

Retrieves all available audio devices from PyAudio and filters them to only display input devices. All matching devices are added to a dropdown menu.

buildTree(dropdownIndex)

Creates a list of checkable items after the user selected an input device. Retrieves the number of available input channels for the given device from PyAudio.

Parameters:dropdownIndex – The list self.devices links the dropdown index to the device index
confirm()

When the user has selected device and channel, this method will compose the list and close the dialog.

resource_path(relative_path)

MainUI.MainWindow module

class MainUI.MainWindow.MainWindow

Bases: PyQt5.QtWidgets.QMainWindow

The MainWindow class combines the menubar and statusbar with the analysis and editor dockwidget to create the main window of the SNARE application. The analysis and editor widgets communicate mostly directly with the backend, for all other user interface elements, this class provides the interface to the backend. E.g. all input on the menubar and all output on the statusbar.

aboutDialog()

Start the about dialog message box.

addAnalysis(analysis)

Interface relay to add an analysis widget to the analysis area.

Parameters:analysis – The AnalysisWidget to add.
addTrack(track)

Interface relay to add Track elements to the editor area.

Parameters:track – The TrackUI object to add.
configRecord
configRecordWindow()

Opens a dialog (InputSelectorDialog) for selecting an input device and channel. The results of the selection are then transmitted to the backend.

deselectAllReports
dragEnterEvent(event)

Overwrites DragEnterEvent for Drag and Drop file support.

dragMoveEvent(event)

Overwrites DragMoveEvent for Drag and Drop file support.

dropEvent(event)

Overwrites DropEvent for Drag and Drop file support. Before passing to __openWave__, fileNames is casted to the needed format.

exportReport
helpDialog()

Start the help dialog message box.

nestedView()

Slot to switch the main window view to a nested style. (Windows side by side)

newSelection
openWave
pauseRecord
removeAnalysis(analysis)

Interface relay to remove an analysis widget from the analysis area.

Parameters:analysis – Reference to the AnalysisWidget to remove.
removeTrack(track)

Interface relay to remove a Track element from the editor area.

Parameters:track – Reference to the TrackUI object to remove.
selectAllReports
startRecord
stopRecord
tabView()

Slot to switch the main window view to a tabbed style.

updateAnalysesStatus(text)

Relay message to the status bar.

Parameters:text – Integer containing the number of currently loaded widgets.
updateRecordingStatus(text)

Relay message to the status bar.

Parameters:text – String containing a recording status message.
updateWaveformMessage(quelength)

Relay message to the status bar.

Parameters:quelength – Integer containing the current workload of the render threads.

MainUI.Menubar module

class MainUI.Menubar.Menubar

Bases: PyQt5.QtWidgets.QMenuBar

This class creates the menubar displayed on top of SNARE’s main window.

aboutDialog
changeViewNested
changeViewTab
configRecord
deselectAllReports
exportReport
helpDialog
newSelection
openWave
pauseRecord
selectAllReports
startRecord
stopRecord

MainUI.StartDialog module

class MainUI.StartDialog.StartDialog(result, icon)

Bases: PyQt5.QtWidgets.QDialog

On startup of SNARE, this dialog is presented to the user. There is a choice between opening a WAVE-file (and setting sample rate and sample width this way) or manually selecting sample rate and sample width and then selecting an input device and channels (via InputSelectorDialog)

confirm()

Pressing “Record...” will lead to the InputSelectorDialog and only set sample rate and sample width.

dragEnterEvent(event)

Overwrites DragEnterEvent for Drag and Drop file support.

dragMoveEvent(event)

Overwrites DragMoveEvent for Drag and Drop file support.

dropEvent(event)

Overwrites DropEvent for Drag and Drop file support. Before passing to openFiles, fileNames is casted to the needed format.

openFile(fileNames=False)

Opens a Wav File.

openFiles(files=False)

Loop for opening Wav files. Triggered by pressing “Open Wav” or by Drag and Drop in the Window. If no valid wave-file has been selected, StartDialog will return to its initial state. First check if method is triggered by “Open Files...” button to open file dialog. Then make sure that filename is not empty, which is the case by canceling the file dialog.

MainUI.Statusbar module

class MainUI.Statusbar.Statusbar

Bases: PyQt5.QtWidgets.QStatusBar

A status bar displayed at the bottom of SNARE’s main window.

updateAnalysesStatus(cntwidgets)

Inteface for the analysis status message.

Parameters:cntwidgets – Takes a fully formatted message.
updateRecordingStatus(str)

Interface for the recording status message.

Parameters:str – E.g. “Ready for Recording”
updateWaveformMessage(quelength)

Interface for the render thread workload message.

Parameters:quelength – Current workload measured in pixmaps to render

MainUI.SubWindow module

class MainUI.SubWindow.SubWindow

Bases: PyQt5.QtWidgets.QWidget

Both the analysis window and the editor window are objects of this class. It contains a layout and an interface to add and remove widgets to/from the layout.

addWidget(widget)

Adds a widget to the layout.

Parameters:widget – A QWidget to add.
removeWidget(widget)

Removes a widget from the layout.

Parameters:widget – A QWidget to remove.
class MainUI.SubWindow.SubWindowDock(title)

Bases: PyQt5.QtWidgets.QDockWidget

This class turns the SubWindow into a dock widget, that can be dragged, minimised and detached from the main window, allowing the user to set up the user interface in an individual way.

addWidget(widget)

Interface for adding a widget, relayed to SubWindow.

Parameters:widget – A QWidget to add.
removeWidget(widget)

Interface for removing a widget, relayed to SubWindow.

Parameters:widget – A QWidget to remove.

Module contents