def __init__(self, instruction: str, back_button_name: str, forward_button_name: str, button_method): super().__init__() central_widget = QtWidgets.QWidget(self) self.setCentralWidget(central_widget) self.grid_layout = QtWidgets.QGridLayout(central_widget) central_widget.setStyleSheet(Style.get_window_style()) self.label = QtWidgets.QLabel() self.label.setText(instruction) self.grid_layout.addWidget(self.label, 0, 0, 1, 2, QtCore.Qt.AlignCenter) self.label.setStyleSheet(Style.get_text_style()) self.back_button = Button("Back", self) self.grid_layout.addWidget(self.back_button, 1, 0, 1, 1, alignment=QtCore.Qt.AlignCenter) self.back_button.setStyleSheet(Style.get_button_style()) self.back_button.clicked.connect(button_method(back_button_name)) self.forward_button = Button("Ok", self) self.grid_layout.addWidget(self.forward_button, 1, 1, 1, 1, alignment=QtCore.Qt.AlignCenter) self.forward_button.setStyleSheet(Style.get_button_style()) self.forward_button.clicked.connect(button_method(forward_button_name))
def add_state_label(self, text: str, position: int, size: int): self.state_label = StateLabel(text) self.grid_layout.addWidget(self.state_label, 1, position, 1, size, alignment=QtCore.Qt.AlignCenter) self.state_label.setStyleSheet(Style.get_text_style())
def __init__(self): super().__init__() central_widget = QtWidgets.QWidget(self) self.setCentralWidget(central_widget) self.grid_layout = QtWidgets.QGridLayout(central_widget) central_widget.setStyleSheet(Style.get_window_style()) self._settings = dict() self.buttons = dict()
def add_button(self, name: str, text: str, button_method): self.buttons[name] = Button(text, self) self.grid_layout.addWidget(self.buttons[name], len(self._settings) + len(self.buttons), 0, 1, 2, alignment=QtCore.Qt.AlignCenter) self.buttons[name].setStyleSheet(Style.get_button_style()) self.buttons[name].clicked.connect(button_method(name))
def add_button(self, name: str, position: int, size: int, text: str, method): self.buttons[name] = Button(text, self) self.grid_layout.addWidget(self.buttons[name], 1, position, 1, size, alignment=QtCore.Qt.AlignCenter) self.buttons[name].setStyleSheet(Style.get_button_style()) self.buttons[name].clicked.connect(method(name))
def add_setting(self, name: str, text: str, values: list, default_option_index: int, setting_method): setting_label = QtWidgets.QLabel() setting_label.setText(text) self.grid_layout.addWidget(setting_label, len(self._settings) + len(self.buttons), 0, alignment=QtCore.Qt.AlignCenter) setting_label.setStyleSheet(Style.get_text_style()) setting_list = QtWidgets.QComboBox() setting_list.addItems(values) setting_list.setCurrentIndex(default_option_index) self.grid_layout.addWidget(setting_list, len(self._settings) + len(self.buttons), 1, alignment=QtCore.Qt.AlignCenter) setting_list.setStyleSheet(Style.get_list_style()) setting_list.currentIndexChanged.connect(setting_method) self._settings[name] = setting_list setting_method()
def __init__(self): super().__init__() central_widget = QtWidgets.QWidget(self) self.setCentralWidget(central_widget) self.grid_layout = QtWidgets.QGridLayout(central_widget) central_widget.setStyleSheet(Style.get_window_style()) # Add buttons self.buttons = dict() # Add state label self.state_label = None
def __init__(self, voices_window): super().__init__() self.voices_window = voices_window central_widget = QtWidgets.QWidget(self) self.setCentralWidget(central_widget) grid_layout = QtWidgets.QGridLayout(central_widget) central_widget.setStyleSheet(Style.get_window_style()) # Add title title_label = QtWidgets.QLabel() title_label.setText("Welcome to EUTERPE") grid_layout.addWidget(title_label, 0, 0, 1, 6, QtCore.Qt.AlignCenter) title_label.setStyleSheet(Style.get_text_style()) # Add title help_label = QtWidgets.QLabel() help_label.setText("What would you like to do today?") grid_layout.addWidget(help_label, 1, 0, 1, 6, QtCore.Qt.AlignCenter) help_label.setStyleSheet(Style.get_text_style()) # Add button to pitches page pitches_button = QtWidgets.QPushButton("Recognise Pitches", self) grid_layout.addWidget(pitches_button, 2, 0, 1, 2, alignment=QtCore.Qt.AlignCenter) pitches_button.setStyleSheet(Style.get_button_style()) pitches_button.clicked.connect( self.make_handleButton("ten_o_pitches_button")) # Add button to intervals page intervals_button = QtWidgets.QPushButton("Recognise Intervals", self) grid_layout.addWidget(intervals_button, 2, 2, 1, 2, alignment=QtCore.Qt.AlignCenter) intervals_button.setStyleSheet(Style.get_button_style()) intervals_button.clicked.connect( self.make_handleButton("intervals_button")) # Add button to voices page voices_button = QtWidgets.QPushButton("Recognise Chords and Melodies", self) grid_layout.addWidget(voices_button, 2, 4, 1, 2, alignment=QtCore.Qt.AlignCenter) voices_button.setStyleSheet(Style.get_button_style()) voices_button.clicked.connect(self.make_handleButton("voices_button")) # Add button to microtones page microtones_button = QtWidgets.QPushButton("Recognise Microtones", self) grid_layout.addWidget(microtones_button, 3, 0, 1, 3, alignment=QtCore.Qt.AlignCenter) microtones_button.setStyleSheet(Style.get_button_style()) microtones_button.clicked.connect( self.make_handleButton("microtones_button")) # Add button to detuning page detuning_button = QtWidgets.QPushButton("Recognise Detuning", self) grid_layout.addWidget(detuning_button, 3, 3, 1, 3, alignment=QtCore.Qt.AlignCenter) detuning_button.setStyleSheet(Style.get_button_style()) detuning_button.clicked.connect( self.make_handleButton("detuning_button"))