Esempio n. 1
0
    def new_chord(self):
        """ Opens a new chord window """
        self.new_window(ChordScoreWindow(self.score, self), 'Chords')

    def new_notation(self):
        """ Opens a new notation window """
        self.new_window(ScoreWindow(self.score, self), 'Leadsheet')

    def new_lyrics(self):
        """ Opens a new lyrics window """
        self.new_window(LyricsWindow(self.score, self), 'Lyrics')

    def new_window(self, window, title):
        self.keymode = window.keymode
        self.addWidget(window)
        self.setCurrentWidget(window)
        self.removeWidget(self.dial)
        self.title_changed(title)

if __name__ == '__main__':
    from PyQt4.QtGui import QApplication
    from music import Score
    import sys
    app = QApplication(sys.argv)
    score = Score()
    score.add_bars(4, 4, 4, count=6)
    window = SpeedDialWindow(score)
    window.show()
    sys.exit(app.exec_())
Esempio n. 2
0
screen = pygame.display.set_mode(size)

#Flag to check if we're done
should_quit = False
#Set framerate
fps = 30

#Obtain scores
note_img_cache = NoteImgCache()
player = AudioPlayer()
key_input = KeyboardInput()

scores = []
for file_name in os.listdir("./scores"):
    if file_name.endswith(".scr"):
        score = Score("./scores/" + file_name, note_img_cache, player)
        if not score.valid:
            print("{} is invalid. Error: {}".format(file_name, score.reason))
        else:
            scores.append(score)

#Get a training mode score
#main_disp = Screen(TrainingScore(note_img_cache, player, \
#	key_input, score = scores[1]))
#main_disp = Screen(GameScore(note_img_cache, player, \
#	key_input, score = scores[0]))
#main_disp = Screen(ScoreSelect(note_img_cache, player, \
#	key_input, scores, fps, train_mode = False))
main_disp = Screen(MainUI(note_img_cache, player, key_input, scores, fps))
#main_disp = Screen(TrainingScore(note_img_cache, player, \
#	key_input, score = scores[1]))
Esempio n. 3
0
from PyQt4.QtGui import QApplication
from music import Score
from mainwindow import MainWindow
import sys

if __name__ == "__main__":
    app = QApplication(sys.argv)
    app.setApplicationName("Bandleader")

    score = Score()
    score.add_bars(4, 4, 4, count=6)
    score.add_bars(3, 4, 4)
    score.add_bars(4, 4, 4)
    score.add_bars(4, 4, 4, count=8)

    window = MainWindow(score)
    window.show()

    sys.exit(app.exec_())
Esempio n. 4
0
        QWidget.showEvent(self, event)

    def keyPressEvent(self, event):
        handled = self.keymode.keyPressEvent(event)
        if not handled:
            QWidget.keyPressEvent(self, event)

    def oldkeyPressEvent(self, event):
        key = event.key()
        if key == Qt.Key_A:
            widget = self.bar_layout.widget_by_index(1)
            self.bar_layout.removeWidget(widget)
        elif key == Qt.Key_B:
            self.score.insert(1, ScoreBar(2, 4, 4))
            bar = self.create_bar(1)
            self.bar_layout.insert_widget(1, bar)
            bar.show()

if __name__ == '__main__':
    import sys
    import export
    from music import Score
    app = QApplication(sys.argv)
    score = Score()
    score.add_bars(4, 4, 4, 4)
    score.add_bars(3, 4, 4, 4)
    window = ScoreWindow(score)
    window.show()
    app.exec_()
    print export.score_to_mma(score)