Exemplo n.º 1
0
    def setup(self, qtbot):
        # Create dialog to show this instance
        self.dialog = QtWidgets.QMainWindow()

        # Start main event loop
        self.prog = application.mainWindow(self.dialog)
        self.graphInstance = graph.CalmaPlot(600, 600, 100, True)
Exemplo n.º 2
0
  def generate_plot_view(self):
    """
    Starts a new plot of CALMA data.

    This function is typically called after CALMA data has been retrieved
    and a track has been clicked upon.
    """

    self.calmaGraphView = graph.CalmaPlot(600,600,100, self.hasCalma)
    self.app.debugDialog.add_line('{0}: generated CALMA figure'.format(sys._getframe().f_code.co_name))
Exemplo n.º 3
0
 def test_has_calma_available(self):
     graphInstance = graph.CalmaPlot(600, 600, 100, True)
     assert (graphInstance.placeHolderText._text ==
             'Click on a performance track for CALMA data')
Exemplo n.º 4
0
 def test_has_no_calma_available(self):
     graphInstance = graph.CalmaPlot(600, 600, 100, False)
     assert (graphInstance.placeHolderText._text ==
             'No CALMA data available for this query')
Exemplo n.º 5
0
 def setup(self):
     self.graphInstance = graph.CalmaPlot(600, 600, 100, True)
     self.cache = cache.Cache()
     self.calma = calma.Calma(self.cache)
Exemplo n.º 6
0
    def callback_set_new_track(self, loudness, keys, segments, duration,
                               trackInfo):
        """
    Takes a blob of CALMA data, and a feature desired, and returned a structured set of
    chronological events for that feature.

    Parameters
    ----------
    loudness : List
        Array of loudness amplitude values.
    keys : List
        List of key change feature data.
    segments : List
        List of segmentation feature data.
    duration : float
        Duration of the track for calculating linear X-space.
    trackInfo : Dict
        Track meta-data containing feature type and label.
    """

        # If not exceeded number of tracks
        if self.numberCalmaDisplayed < self.max:
            # Set correct feature
            if trackInfo['feature'] == 'key':
                features = keys
            else:
                features = segments

            # Create a new plot and add widget to dialog
            self.plots.append(graph.CalmaPlot(600, 600, 100, True))
            self.plots[self.numberCalmaDisplayed].plot_calma_data(
                loudness,
                features,
                duration,
                trackInfo['feature'],
                title=trackInfo['title'],
                release=True)
            self.plotLayout.addWidget(self.plots[self.numberCalmaDisplayed])
            self.numberCalmaDisplayed += 1

            # If last track
            if self.numberCalmaDisplayed == self.max - 1:
                # Set final properties for dialog & show to user
                self.plotContainerWidget.setLayout(self.plotLayout)

                # Create scroll area
                scroll = QtWidgets.QScrollArea()
                scroll.setWidget(self.plotContainerWidget)
                scroll.setWidgetResizable(True)
                scroll.setMinimumWidth(1280)
                scroll.setMinimumHeight(720)

                # Create scroll layout and add plots
                self.layout = QtWidgets.QVBoxLayout(self)
                self.layout.addWidget(scroll)
                self.setLayout(self.layout)
                scroll.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                     QtWidgets.QSizePolicy.Expanding)

                # Show widget to user
                self.show()