Ejemplo n.º 1
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1123, 759)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.toggleButton = QtWidgets.QPushButton(self.centralwidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.toggleButton.sizePolicy().hasHeightForWidth())
        self.toggleButton.setSizePolicy(sizePolicy)
        self.toggleButton.setMaximumSize(QtCore.QSize(20, 16777215))
        self.toggleButton.setText("")
        self.toggleButton.setObjectName("toggleButton")
        self.gridLayout.addWidget(self.toggleButton, 0, 0, 2, 1)
        self.treeWidget = QtWidgets.QTreeWidget(self.centralwidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.treeWidget.sizePolicy().hasHeightForWidth())
        self.treeWidget.setSizePolicy(sizePolicy)
        self.treeWidget.setMaximumSize(QtCore.QSize(180, 16777215))
        self.treeWidget.setObjectName("treeWidget")
        self.treeWidget.headerItem().setText(0, "1")
        self.gridLayout.addWidget(self.treeWidget, 0, 1, 1, 1)
        self.widget = PaintWidget(self.centralwidget)
        self.widget.setObjectName("widget")
        self.gridLayout.addWidget(self.widget, 0, 2, 2, 1)
        self.updateButton = QtWidgets.QPushButton(self.centralwidget)
        self.updateButton.setObjectName("updateButton")
        self.gridLayout.addWidget(self.updateButton, 1, 1, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1123, 26))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.updateButton.setText(_translate("MainWindow", "Update Streams"))
Ejemplo n.º 2
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1299, 800)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setContentsMargins(-1, -1, -1, 12)
        self.gridLayout.setObjectName("gridLayout")
        self.widget = PaintWidget(self.centralwidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.widget.sizePolicy().hasHeightForWidth())
        self.widget.setSizePolicy(sizePolicy)
        self.widget.setObjectName("widget")
        self.gridLayout.addWidget(self.widget, 0, 2, 1, 1)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)
        self.horizontalLayout.setContentsMargins(0, -1, -1, -1)
        self.horizontalLayout.setSpacing(8)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.btnShowDataStream = QtWidgets.QToolButton(self.centralwidget)
        self.btnShowDataStream.setMinimumSize(QtCore.QSize(0, 22))
        self.btnShowDataStream.setMaximumSize(QtCore.QSize(156, 22))
        self.btnShowDataStream.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)
        self.btnShowDataStream.setObjectName("btnShowDataStream")
        self.horizontalLayout.addWidget(self.btnShowDataStream)
        self.gridLayout.addLayout(self.horizontalLayout, 1, 2, 1, 1)
        self.toggleButton = QtWidgets.QPushButton(self.centralwidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.toggleButton.sizePolicy().hasHeightForWidth())
        self.toggleButton.setSizePolicy(sizePolicy)
        self.toggleButton.setMinimumSize(QtCore.QSize(20, 698))
        self.toggleButton.setMaximumSize(QtCore.QSize(20, 16777215))
        self.toggleButton.setBaseSize(QtCore.QSize(20, 698))
        self.toggleButton.setText("")
        self.toggleButton.setObjectName("toggleButton")
        self.gridLayout.addWidget(self.toggleButton, 0, 0, 2, 1)
        self.treeWidget = QtWidgets.QTreeWidget(self.centralwidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.treeWidget.sizePolicy().hasHeightForWidth())
        self.treeWidget.setSizePolicy(sizePolicy)
        self.treeWidget.setMaximumSize(QtCore.QSize(180, 16777215))
        self.treeWidget.setObjectName("treeWidget")
        self.treeWidget.headerItem().setText(0, "1")
        self.gridLayout.addWidget(self.treeWidget, 0, 1, 1, 1)
        self.updateButton = QtWidgets.QPushButton(self.centralwidget)
        self.updateButton.setMinimumSize(QtCore.QSize(100, 32))
        self.updateButton.setMaximumSize(QtCore.QSize(16777215, 32))
        self.updateButton.setObjectName("updateButton")
        self.gridLayout.addWidget(self.updateButton, 1, 1, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1299, 22))
        self.menubar.setObjectName("menubar")
        self.menuViews = QtWidgets.QMenu(self.menubar)
        self.menuViews.setObjectName("menuViews")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.actionShow_Received_Data_Stream = QtWidgets.QAction(MainWindow)
        self.actionShow_Received_Data_Stream.setObjectName(
            "actionShow_Received_Data_Stream")
        self.menuViews.addAction(self.actionShow_Received_Data_Stream)
        self.menubar.addAction(self.menuViews.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Ejemplo n.º 3
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1200, 800)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")

        self.toggleButton = QtWidgets.QPushButton(self.centralwidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.toggleButton.sizePolicy().hasHeightForWidth())
        self.toggleButton.setSizePolicy(sizePolicy)
        self.toggleButton.setMaximumSize(QtCore.QSize(20, 16777215))
        self.toggleButton.setText("")
        self.toggleButton.setObjectName("toggleButton")
        self.gridLayout.addWidget(self.toggleButton, 0, 0, 2, 1)

        self.treeWidget = QtWidgets.QTreeWidget(self.centralwidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.treeWidget.sizePolicy().hasHeightForWidth())
        self.treeWidget.setSizePolicy(sizePolicy)
        self.treeWidget.setMaximumSize(QtCore.QSize(180, 16777215))
        self.treeWidget.setObjectName("treeWidget")
        self.treeWidget.headerItem().setText(0, "1")
        self.gridLayout.addWidget(self.treeWidget, 0, 1, 1, 1)

        self.widget = PaintWidget(self.centralwidget)
        self.widget.setObjectName("widget")
        self.gridLayout.addWidget(self.widget, 0, 2, 2, 1)
        self.updateButton = QtWidgets.QPushButton(self.centralwidget)
        self.updateButton.setObjectName("updateButton")
        self.gridLayout.addWidget(self.updateButton, 1, 1, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)

        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1123, 26))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)

        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.toggleButton.setIcon(QtGui.QIcon("icons/chevron_left.svg"))
        self.toggleButton.setIconSize(QtCore.QSize(30, 30))
        self.toggleButton.clicked.connect(self.toggle_panel)
        self.updateButton.clicked.connect(self.widget.dataTr.update_streams)
        self.widget.dataTr.updateStreamNames.connect(
            self.update_metadata_widget)
        self.panelHidden = False

        self.treeWidget.setHeaderLabel('Streams')
        self.treeWidget.itemExpanded.connect(self.tree_item_expanded)
        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Ejemplo n.º 4
0
class Ui_sigvisualizer(object):
    stream_expanded = QtCore.pyqtSignal(str)

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1200, 800)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")

        self.toggleButton = QtWidgets.QPushButton(self.centralwidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.toggleButton.sizePolicy().hasHeightForWidth())
        self.toggleButton.setSizePolicy(sizePolicy)
        self.toggleButton.setMaximumSize(QtCore.QSize(20, 16777215))
        self.toggleButton.setText("")
        self.toggleButton.setObjectName("toggleButton")
        self.gridLayout.addWidget(self.toggleButton, 0, 0, 2, 1)

        self.treeWidget = QtWidgets.QTreeWidget(self.centralwidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.treeWidget.sizePolicy().hasHeightForWidth())
        self.treeWidget.setSizePolicy(sizePolicy)
        self.treeWidget.setMaximumSize(QtCore.QSize(180, 16777215))
        self.treeWidget.setObjectName("treeWidget")
        self.treeWidget.headerItem().setText(0, "1")
        self.gridLayout.addWidget(self.treeWidget, 0, 1, 1, 1)

        self.widget = PaintWidget(self.centralwidget)
        self.widget.setObjectName("widget")
        self.gridLayout.addWidget(self.widget, 0, 2, 2, 1)
        self.updateButton = QtWidgets.QPushButton(self.centralwidget)
        self.updateButton.setObjectName("updateButton")
        self.gridLayout.addWidget(self.updateButton, 1, 1, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)

        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1123, 26))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)

        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.toggleButton.setIcon(QtGui.QIcon("icons/chevron_left.svg"))
        self.toggleButton.setIconSize(QtCore.QSize(30, 30))
        self.toggleButton.clicked.connect(self.toggle_panel)
        self.updateButton.clicked.connect(self.widget.dataTr.update_streams)
        self.widget.dataTr.updateStreamNames.connect(
            self.update_metadata_widget)
        self.panelHidden = False

        self.treeWidget.setHeaderLabel('Streams')
        self.treeWidget.itemExpanded.connect(self.tree_item_expanded)
        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def tree_item_expanded(self, widget_item):
        name = widget_item.text(0)
        for it_ix in range(self.treeWidget.topLevelItemCount()):
            item = self.treeWidget.topLevelItem(it_ix)
            if item.text(0) != name:
                item.setExpanded(False)

    def update_metadata_widget(self, metadata, default_idx):
        for s_ix, s_meta in enumerate(metadata):
            item = QtWidgets.QTreeWidgetItem(self.treeWidget)
            item.setText(0, s_meta["name"])

            for m in range(s_meta["ch_count"]):
                channel_item = QtWidgets.QTreeWidgetItem(item)
                channel_item.setText(0, 'Channel {}'.format(m + 1))
                channel_item.setCheckState(0, QtCore.Qt.Checked)
            self.treeWidget.itemClicked.connect(self.update_clicked)

            item.setExpanded(True if s_ix == default_idx else False)
            self.treeWidget.addTopLevelItem(item)

        self.treeWidget.setAnimated(True)
        try:
            self.statusbar.showMessage("Sampling rate: {}Hz".format(
                metadata[default_idx]["srate"]))
        except IndexError:
            self.show_popup_msg()

    def update_clicked(self, channel, column):
        containingTree = channel.treeWidget()
        # print(channel.checkState(column))
        # print(containingTree.indexFromItem(channel,column).row())
        # print()
        self.widget.set_display(
            channel.checkState(column),
            containingTree.indexFromItem(channel, column).row())

    def show_popup_msg(self):
        no_data_msg = QtWidgets.QMessageBox()
        no_data_msg.setWindowTitle('Error')
        no_data_msg.setText('No channels detected.')

        no_data_msg.setIcon(QtWidgets.QMessageBox.Critical)
        no_data_msg.setDefaultButton(QtWidgets.QMessageBox.Ok)
        no_data_msg.setStandardButtons(QtWidgets.QMessageBox.Ok
                                       | QtWidgets.QMessageBox.Retry)
        no_data_msg.setDetailedText('Ensure that EEG data is streaming over'
                                    ' the correct network.')
        no_data_msg.buttonClicked.connect(
            lambda button_name: self.repeat_get_streams(
                button_name, no_data_msg))

        no_data_msg.exec_()

    def repeat_get_streams(self, button_type, popup_obj):
        if button_type.text() == 'Retry':
            self.widget.dataTr.update_streams()

    def toggle_panel(self):
        if self.panelHidden:
            self.panelHidden = False
            self.treeWidget.show()
            self.updateButton.show()
            self.toggleButton.setIcon(QtGui.QIcon("icons/chevron_left.svg"))
            self.toggleButton.setIconSize(QtCore.QSize(30, 30))
        else:
            self.panelHidden = True
            self.treeWidget.hide()
            self.updateButton.hide()
            self.toggleButton.setIcon(QtGui.QIcon("icons/chevron_right.svg"))
            self.toggleButton.setIconSize(QtCore.QSize(30, 30))

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "Trifecta"))
        self.updateButton.setText(_translate("MainWindow", "Update Streams"))