Esempio n. 1
0
    def widget_select(self, item):
        if self.audiowidget is not None:
            self.audiowidget.close()
            self.audiowidget.deleteLater()

        self.type = item

        if item is 0:
            self.audiowidget = Levels_Widget(self, self.logger)
        elif item is 1:
            self.audiowidget = Scope_Widget(self, self.sharedGLWidget,
                                            self.logger)
        elif item is 2:
            self.audiowidget = Spectrum_Widget(self, self.sharedGLWidget,
                                               self.logger)
        elif item is 3:
            self.audiowidget = Spectrogram_Widget(self,
                                                  self.parent().audiobackend,
                                                  self.logger)
        elif item is 4:
            self.audiowidget = OctaveSpectrum_Widget(self, self.logger)
        elif item is 5:
            self.audiowidget = Generator_Widget(self,
                                                self.parent().audiobackend,
                                                self.logger)
        elif item is 6:
            self.audiowidget = Delay_Estimator_Widget(self, self.logger)

        self.audiowidget.set_buffer(self.parent().audiobuffer)

        self.layout.addWidget(self.audiowidget)

        self.controlBar.comboBox_select.setCurrentIndex(item)
Esempio n. 2
0
	def widget_select(self, item):
		if self.audiowidget is not None:
		    self.audiowidget.close()
		    self.audiowidget.deleteLater()
		
		self.type = item
		
		if item is 0:
			self.audiowidget = Levels_Widget(self, self.logger)
		elif item is 1:
			self.audiowidget = Scope_Widget(self, self.logger)
		elif item is 2:
			self.audiowidget = Spectrum_Widget(self, self.logger)
		elif item is 3:
			self.audiowidget = Spectrogram_Widget(self, self.parent.parent().audiobackend, self.logger)
		elif item is 4:
			self.audiowidget = OctaveSpectrum_Widget(self, self.logger)
		elif item is 5:
			self.audiowidget = Generator_Widget(self, self.parent.parent().audiobackend, self.logger)
		elif item is 6:
			self.audiowidget = Delay_Estimator_Widget(self, self.logger)

		self.audiowidget.set_buffer(self.parent.parent().audiobuffer)
		
		if self.audiowidget.update is not None:
			self.connect(self.parent.parent().display_timer, QtCore.SIGNAL('timeout()'), self.audiowidget.update)

		self.layout.addWidget(self.audiowidget)
		
		self.controlBar.comboBox_select.setCurrentIndex(item)
Esempio n. 3
0
	def widget_select(self, item):
		if self.audiowidget is not None:
		    self.audiowidget.close()
		    self.audiowidget.deleteLater()
		
		self.type = item

		if item is 0:
			self.audiowidget = Levels_Widget(self, self.logger)
		elif item is 1:
			self.audiowidget = Scope_Widget(self, self.logger)
		elif item is 2:
			self.audiowidget = Spectrum_Widget(self, self.logger)
		elif item is 3:
			self.audiowidget = Spectrogram_Widget(self, self.parent().audiobackend, self.logger)
		elif item is 4:
			self.audiowidget = OctaveSpectrum_Widget(self, self.logger)
		elif item is 5:
			self.audiowidget = Generator_Widget(self, self.parent().audiobackend, self.logger)
		elif item is 6:
			self.audiowidget = Delay_Estimator_Widget(self, self.logger)
		
		self.audiowidget.set_buffer(self.parent().audiobuffer)
		self.parent().audiobuffer.new_data_available.connect(self.audiowidget.handle_new_data)

		self.layout.addWidget(self.audiowidget)
		
		self.controlBar.comboBox_select.setCurrentIndex(item)
Esempio n. 4
0
    def widget_select(self, item):
        if self.audiowidget is not None:
            self.audiowidget.close()
            self.audiowidget.deleteLater()

        self.type = item

        if item is 0:
            self.audiowidget = Levels_Widget(self, self.logger)
        elif item is 1:
            self.audiowidget = Scope_Widget(self, self.logger)
        elif item is 2:
            self.audiowidget = Spectrum_Widget(self, self.logger)
        elif item is 3:
            self.audiowidget = Spectrogram_Widget(self,
                                                  self.parent().audiobackend,
                                                  self.logger)
        elif item is 4:
            self.audiowidget = OctaveSpectrum_Widget(self, self.logger)
        elif item is 5:
            self.audiowidget = Generator_Widget(self,
                                                self.parent().audiobackend,
                                                self.logger)
        elif item is 6:
            self.audiowidget = Delay_Estimator_Widget(self, self.logger)
        elif item is 7:
            self.audiowidget = LongLevelWidget(self, self.logger)
        else:
            self.audiowidget = Levels_Widget(self, self.logger)

        self.audiowidget.set_buffer(self.parent().audiobuffer)
        self.parent().audiobuffer.new_data_available.connect(
            self.audiowidget.handle_new_data)

        self.layout.addWidget(self.audiowidget)

        self.control_bar.combobox_select.setCurrentIndex(item)
Esempio n. 5
0
class Dock(QtWidgets.QDockWidget):
    def __init__(self, parent, sharedGLWidget, logger, name, type=0):
        super().__init__(name, parent)

        self.setObjectName(name)

        self.sharedGLWidget = sharedGLWidget
        self.logger = logger

        self.controlBar = ControlBar(self)

        self.controlBar.comboBox_select.activated.connect(self.widget_select)
        self.controlBar.settingsButton.clicked.connect(self.settings_slot)

        self.dockwidget = QtWidgets.QWidget(self)
        self.layout = QtWidgets.QVBoxLayout(self.dockwidget)
        self.layout.addWidget(self.controlBar)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.dockwidget.setLayout(self.layout)

        self.setWidget(self.dockwidget)

        self.audiowidget = None
        self.widget_select(type)

    # note that by default the closeEvent is accepted, no need to do it explicitely
    def closeEvent(self, event):
        self.parent().dockmanager.close_dock(self)

    # slot
    def widget_select(self, item):
        if self.audiowidget is not None:
            self.audiowidget.close()
            self.audiowidget.deleteLater()

        self.type = item

        if item is 0:
            self.audiowidget = Levels_Widget(self, self.logger)
        elif item is 1:
            self.audiowidget = Scope_Widget(self, self.sharedGLWidget,
                                            self.logger)
        elif item is 2:
            self.audiowidget = Spectrum_Widget(self, self.sharedGLWidget,
                                               self.logger)
        elif item is 3:
            self.audiowidget = Spectrogram_Widget(self,
                                                  self.parent().audiobackend,
                                                  self.logger)
        elif item is 4:
            self.audiowidget = OctaveSpectrum_Widget(self, self.logger)
        elif item is 5:
            self.audiowidget = Generator_Widget(self,
                                                self.parent().audiobackend,
                                                self.logger)
        elif item is 6:
            self.audiowidget = Delay_Estimator_Widget(self, self.logger)

        self.audiowidget.set_buffer(self.parent().audiobuffer)

        self.layout.addWidget(self.audiowidget)

        self.controlBar.comboBox_select.setCurrentIndex(item)

    def update(self):
        if self.audiowidget is not None:
            self.audiowidget.update()

    def pause(self):
        if self.audiowidget is not None:
            self.audiowidget.pause()

    def restart(self):
        if self.audiowidget is not None:
            self.audiowidget.restart()

    # slot
    def settings_slot(self, checked):
        self.audiowidget.settings_called(checked)

    # method
    def saveState(self, settings):
        settings.setValue("type", self.type)
        self.audiowidget.saveState(settings)

    # method
    def restoreState(self, settings):
        widgetType = settings.value("type", 0)
        self.widget_select(widgetType)
        self.audiowidget.restoreState(settings)
Esempio n. 6
0
class CentralWidget(QtGui.QWidget):
	def __init__(self, parent, logger, name, type = 0):
		QtGui.QWidget.__init__(self, parent)
		
		self.setObjectName(name)
		
		self.parent = parent
		self.logger = logger
		
		self.controlBar = ControlBar(self)
				
		self.connect(self.controlBar.comboBox_select, QtCore.SIGNAL('activated(int)'), self.widget_select)
		self.connect(self.controlBar.settingsButton, QtCore.SIGNAL('clicked(bool)'), self.settings_slot)
		
		self.label = QtGui.QLabel(self)
		self.label.setText(" Central dock ") # spaces before and after for nicer alignment
		self.controlBar.layout.insertWidget(0, self.label)
		
		self.layout = QtGui.QVBoxLayout(self)
		self.layout.addWidget(self.controlBar)
		self.layout.setContentsMargins(0, 0, 0, 0)
		self.setLayout(self.layout)
		
		self.audiowidget = None
		self.widget_select(type)

	# slot
	def widget_select(self, item):
		if self.audiowidget is not None:
		    self.audiowidget.close()
		    self.audiowidget.deleteLater()
		
		self.type = item
		
		if item is 0:
			self.audiowidget = Levels_Widget(self, self.logger)
		elif item is 1:
			self.audiowidget = Scope_Widget(self, self.logger)
		elif item is 2:
			self.audiowidget = Spectrum_Widget(self, self.logger)
		elif item is 3:
			self.audiowidget = Spectrogram_Widget(self, self.parent.parent().audiobackend, self.logger)
		elif item is 4:
			self.audiowidget = OctaveSpectrum_Widget(self, self.logger)
		elif item is 5:
			self.audiowidget = Generator_Widget(self, self.parent.parent().audiobackend, self.logger)
		elif item is 6:
			self.audiowidget = Delay_Estimator_Widget(self, self.logger)

		self.audiowidget.set_buffer(self.parent.parent().audiobuffer)
		
		if self.audiowidget.update is not None:
			self.connect(self.parent.parent().display_timer, QtCore.SIGNAL('timeout()'), self.audiowidget.update)

		self.layout.addWidget(self.audiowidget)
		
		self.controlBar.comboBox_select.setCurrentIndex(item)

	def custom_timer_start(self):
		try:
			self.audiowidget.timer.start()
		except:
			pass

	def custom_timer_stop(self):
		try:
			self.audiowidget.timer.stop()
		except:
			pass

	# slot
	def settings_slot(self, checked):
		self.audiowidget.settings_called(checked)

	# method
	def saveState(self, settings):
		settings.setValue("type", self.type)
		self.audiowidget.saveState(settings)
	
	# method
	def restoreState(self, settings):
		(type, ok) = settings.value("type", 2).toInt()
		self.widget_select(type)
		self.audiowidget.restoreState(settings)
Esempio n. 7
0
class Dock(QtWidgets.QDockWidget):

	def __init__(self, parent, logger, name, type = 0):
		super().__init__(name, parent)
		
		self.setObjectName(name)

		self.logger = logger
		
		self.controlBar = ControlBar(self)
				
		self.controlBar.comboBox_select.activated.connect(self.widget_select)
		self.controlBar.settingsButton.clicked.connect(self.settings_slot)

		self.dockwidget = QtWidgets.QWidget(self)
		self.layout = QtWidgets.QVBoxLayout(self.dockwidget)
		self.layout.addWidget(self.controlBar)
		self.layout.setContentsMargins(0, 0, 0, 0)
		self.dockwidget.setLayout(self.layout)
		
		self.setWidget(self.dockwidget)
		
		self.audiowidget = None
		self.widget_select(type)

	# note that by default the closeEvent is accepted, no need to do it explicitely
	def closeEvent(self, event):
		self.parent().dockmanager.close_dock(self)

	# slot
	def widget_select(self, item):
		if self.audiowidget is not None:
		    self.audiowidget.close()
		    self.audiowidget.deleteLater()
		
		self.type = item

		if item is 0:
			self.audiowidget = Levels_Widget(self, self.logger)
		elif item is 1:
			self.audiowidget = Scope_Widget(self, self.logger)
		elif item is 2:
			self.audiowidget = Spectrum_Widget(self, self.logger)
		elif item is 3:
			self.audiowidget = Spectrogram_Widget(self, self.parent().audiobackend, self.logger)
		elif item is 4:
			self.audiowidget = OctaveSpectrum_Widget(self, self.logger)
		elif item is 5:
			self.audiowidget = Generator_Widget(self, self.parent().audiobackend, self.logger)
		elif item is 6:
			self.audiowidget = Delay_Estimator_Widget(self, self.logger)
		
		self.audiowidget.set_buffer(self.parent().audiobuffer)
		self.parent().audiobuffer.new_data_available.connect(self.audiowidget.handle_new_data)

		self.layout.addWidget(self.audiowidget)
		
		self.controlBar.comboBox_select.setCurrentIndex(item)

	def canvasUpdate(self):
		if self.audiowidget is not None:
			self.audiowidget.canvasUpdate()

	def pause(self):
		if self.audiowidget is not None:
			self.audiowidget.pause()

	def restart(self):
		if self.audiowidget is not None:
			self.audiowidget.restart()

	# slot
	def settings_slot(self, checked):
		self.audiowidget.settings_called(checked)

	# method
	def saveState(self, settings):
		settings.setValue("type", self.type)
		self.audiowidget.saveState(settings)
	
	# method
	def restoreState(self, settings):
		widgetType = settings.value("type", 0)
		self.widget_select(widgetType)
		self.audiowidget.restoreState(settings)
Esempio n. 8
0
class CentralWidget(QtWidgets.QWidget):

    def __init__(self, parent, logger, name, widget_type=0):
        super().__init__(parent)

        self.setObjectName(name)

        self.logger = logger

        self.control_bar = ControlBar(self)

        self.control_bar.combobox_select.activated.connect(self.widget_select)
        self.control_bar.settings_button.clicked.connect(self.settings_slot)

        self.label = QtWidgets.QLabel(self)
        self.label.setText(" Central dock ")  # spaces before and after for nicer alignment
        self.control_bar.layout.insertWidget(0, self.label)

        self.layout = QtWidgets.QVBoxLayout(self)
        self.layout.addWidget(self.control_bar)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.layout)

        self.audiowidget = None
        self.widget_select(widget_type)

    # slot
    def widget_select(self, item):
        if self.audiowidget is not None:
            self.audiowidget.close()
            self.audiowidget.deleteLater()

        self.type = item

        if item is 0:
            self.audiowidget = Levels_Widget(self, self.logger)
        elif item is 1:
            self.audiowidget = Scope_Widget(self, self.logger)
        elif item is 2:
            self.audiowidget = Spectrum_Widget(self, self.logger)
        elif item is 3:
            self.audiowidget = Spectrogram_Widget(self, self.parent().parent().audiobackend, self.logger)
        elif item is 4:
            self.audiowidget = OctaveSpectrum_Widget(self, self.logger)
        elif item is 5:
            self.audiowidget = Generator_Widget(self, self.parent().parent().audiobackend, self.logger)
        elif item is 6:
            self.audiowidget = Delay_Estimator_Widget(self, self.logger)

        self.audiowidget.set_buffer(self.parent().parent().audiobuffer)
        self.parent().parent().audiobuffer.new_data_available.connect(self.audiowidget.handle_new_data)

        self.layout.addWidget(self.audiowidget)

        self.control_bar.combobox_select.setCurrentIndex(item)

    def canvasUpdate(self):
        if self.audiowidget is not None:
            self.audiowidget.canvasUpdate()

    def pause(self):
        if self.audiowidget is not None:
            try:
                self.audiowidget.pause()
            except AttributeError:
                pass

    def restart(self):
        if self.audiowidget is not None:
            try:
                self.audiowidget.restart()
            except AttributeError:
                pass

    # slot
    def settings_slot(self, checked):
        self.audiowidget.settings_called(checked)

    # method
    def saveState(self, settings):
        settings.setValue("type", self.type)
        self.audiowidget.saveState(settings)

    # method
    def restoreState(self, settings):
        widget_type = settings.value("type", DEFAULT_CENTRAL_WIDGET)
        self.widget_select(widget_type)
        self.audiowidget.restoreState(settings)
Esempio n. 9
0
class CentralWidget(QtGui.QWidget):
    def __init__(self, parent, logger, name, type=0):
        QtGui.QWidget.__init__(self, parent)

        self.setObjectName(name)

        self.logger = logger

        self.controlBar = ControlBar(self)

        self.connect(self.controlBar.comboBox_select,
                     QtCore.SIGNAL('activated(int)'), self.widget_select)
        self.connect(self.controlBar.settingsButton,
                     QtCore.SIGNAL('clicked(bool)'), self.settings_slot)

        self.label = QtGui.QLabel(self)
        self.label.setText(
            " Central dock ")  # spaces before and after for nicer alignment
        self.controlBar.layout.insertWidget(0, self.label)

        self.layout = QtGui.QVBoxLayout(self)
        self.layout.addWidget(self.controlBar)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.layout)

        self.audiowidget = None
        self.widget_select(type)

    # slot
    def widget_select(self, item):
        if self.audiowidget is not None:
            self.audiowidget.close()
            self.audiowidget.deleteLater()

        self.type = item

        if item is 0:
            self.audiowidget = Levels_Widget(self, self.logger)
        elif item is 1:
            self.audiowidget = Scope_Widget(self, self.logger)
        elif item is 2:
            self.audiowidget = Spectrum_Widget(self, self.logger)
        elif item is 3:
            self.audiowidget = Spectrogram_Widget(
                self,
                self.parent().parent().audiobackend, self.logger)
        elif item is 4:
            self.audiowidget = OctaveSpectrum_Widget(self, self.logger)
        elif item is 5:
            self.audiowidget = Generator_Widget(
                self,
                self.parent().parent().audiobackend, self.logger)
        elif item is 6:
            self.audiowidget = Delay_Estimator_Widget(self, self.logger)

        self.audiowidget.set_buffer(self.parent().parent().audiobuffer)

        self.layout.addWidget(self.audiowidget)

        self.controlBar.comboBox_select.setCurrentIndex(item)

    def update(self):
        if self.audiowidget <> None:
            self.audiowidget.update()

    # slot
    def settings_slot(self, checked):
        self.audiowidget.settings_called(checked)

    # method
    def saveState(self, settings):
        settings.setValue("type", self.type)
        self.audiowidget.saveState(settings)

    # method
    def restoreState(self, settings):
        (type, ok) = settings.value("type", DEFAULT_CENTRAL_WIDGET).toInt()
        self.widget_select(type)
        self.audiowidget.restoreState(settings)