Пример #1
0
 def __init__(self):
     """
     Constructor
     """
     ericPic = QPixmap(
         os.path.join(getConfig('ericPixDir'), 'pymakrSplash.png'))
     self.labelAlignment = Qt.Alignment(Qt.AlignBottom | Qt.AlignRight
                                        | Qt.AlignAbsolute)
     super(SplashScreen, self).__init__(ericPic)
     lblVersion = QLabel(self)
     lblVersion.setText(UI.Info.Version)
     lblVersion.adjustSize()
     lblVersion.setStyleSheet("QLabel { color : white; }")
     lblVersion.setAttribute(Qt.WA_TranslucentBackground)
     lblVersion.move(425 - lblVersion.width(), 195)
     self.show()
     self.raise_()  # needed for mac
     QApplication.flush()
class Window(QWidget):
    def __init__(self, unfolding, parent=None):
        super(Window, self).__init__(parent)
        self.listCheckBox = []
        self.listLabel = []
        self.unfolding = unfolding

        for hinge in unfolding.all_hinges:
            self.listCheckBox.append(str(hinge))
            self.listLabel.append('')

        grid = QGridLayout()

        for i, v in enumerate(self.listCheckBox):
            self.listCheckBox[i] = QCheckBox(v)
            self.listLabel[i] = QLabel()
            grid.addWidget(self.listCheckBox[i], i, 0)
            grid.addWidget(self.listLabel[i], i, 1)
            if unfolding.all_hinges[i] in unfolding.open_hinges:
                self.listCheckBox[i].setChecked(True)
            else:
                self.listCheckBox[i].setChecked(False)

        self.button = QPushButton("Update hinges")
        self.button.clicked.connect(self.checkboxChanged)
        self.labelResult = QLabel()

        grid.addWidget(self.button, 10, 0, 1, 2)
        grid.addWidget(self.labelResult, 11, 0, 1, 2)
        self.setLayout(grid)
        self.setWindowTitle('Hinge Selection')

    def checkboxChanged(self):
        self.labelResult.setText("")
        open_hinges = []
        for i, v in enumerate(self.listCheckBox):
            self.listLabel[i].setText("True" if v.checkState() else "False")
            self.labelResult.setText("{}, {}".format(self.labelResult.text(),
                                                     self.listLabel[i].text()))
            if v.checkState():
                open_hinges.append(self.unfolding.all_hinges[i])
        self.unfolding.open_hinges = open_hinges
        self.close()
    def _update_ranging_status_indicators(self):
        container = self._anchor_stats_container

        ids = sorted(self._anchors.keys())

        # Update existing labels or add new if needed
        count = 0
        for id in ids:
            col = count % 8
            row = int(count / 8)

            if count < container.count():
                label = container.itemAtPosition(row, col).widget()
            else:
                label = QLabel()
                label.setMinimumSize(30, 0)
                label.setProperty('frameShape', 'QFrame::Box')
                label.setAlignment(Qt.AlignCenter)
                container.addWidget(label, row, col)

            label.setText(str(id))

            if self._anchors[id].is_active():
                label.setStyleSheet(STYLE_GREEN_BACKGROUND)
            else:
                label.setStyleSheet(STYLE_RED_BACKGROUND)

            count += 1

        # Remove labels if there are too many
        for i in range(count, container.count()):
            col = i % 8
            row = int(i / 8)

            label = container.itemAtPosition(row, col).widget()
            label.deleteLater()
    def _update_ranging_status_indicators(self):
        container = self._anchor_stats_container

        ids = sorted(self._anchors.keys())

        # Update existing labels or add new if needed
        count = 0
        for id in ids:
            col = count % 8
            row = int(count / 8)

            if count < container.count():
                label = container.itemAtPosition(row, col).widget()
            else:
                label = QLabel()
                label.setMinimumSize(30, 0)
                label.setProperty('frameShape', 'QFrame::Box')
                label.setAlignment(Qt.AlignCenter)
                container.addWidget(label, row, col)

            label.setText(str(id))

            if self._anchors[id].is_active():
                label.setStyleSheet(STYLE_GREEN_BACKGROUND)
            else:
                label.setStyleSheet(STYLE_RED_BACKGROUND)

            count += 1

        # Remove labels if there are too many
        for i in range(count, container.count()):
            col = i % 8
            row = int(i / 8)

            label = container.itemAtPosition(row, col).widget()
            label.deleteLater()
Пример #5
0
class MainWindow(QMainWindow):
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)

        self.setFixedSize(600, 180)
        self.l0 = QLabel(self)
        self.l0.setFixedWidth(300)
        self.l0.setFixedHeight(40)
        self.l0.setAlignment(Qt.AlignCenter)
        self.l0.setText("Breathing(bpm)")
        self.l0.move(0, 0)

        self.l1 = QLabel(self)
        self.l1.setFixedWidth(300)
        self.l1.setFixedHeight(40)
        self.l1.setAlignment(Qt.AlignCenter)
        self.l1.setText("Heart Rate(bpm)")
        self.l1.move(300, 0)

        pe = QPalette()
        pe.setColor(QPalette.WindowText, Qt.yellow)
        pe.setColor(QPalette.Background, Qt.gray)
        self.l0.setAutoFillBackground(True)
        self.l0.setPalette(pe)
        self.l1.setAutoFillBackground(True)
        self.l1.setPalette(pe)

        self.l0.setFont(QFont("Roman times", 20, QFont.Bold))
        self.l1.setFont(QFont("Roman times", 20, QFont.Bold))

        self.lbr = QLabel(self)
        self.lbr.setFixedWidth(300)
        self.lbr.setFixedHeight(60)
        self.lbr.setAlignment(Qt.AlignCenter)
        self.lbr.setFont(QFont("Roman times", 55, QFont.Bold))
        self.lbr.setText("Breathing")
        self.lbr.move(0, 75)

        self.lhr = QLabel(self)
        self.lhr.setFixedWidth(300)
        self.lhr.setFixedHeight(60)
        self.lhr.setAlignment(Qt.AlignCenter)
        self.lhr.setFont(QFont("Roman times", 55, QFont.Bold))
        self.lhr.setText("Heart Rate")

        self.lhr.move(300, 75)