Exemplo n.º 1
0
    def pressPopups(self, x, y):
        if self.popUpup.type == "Yes/No":
            if self.popUpup.button == '<--':
                if self.popUpup.whatPressed(x, y) == "Yes":
                    pickletest.saveProject(self.project)
                    self.init()
                elif self.popUpup.whatPressed(x, y) == "No":
                    self.init()
            elif self.popUpup.button == "title":
                if self.popUpup.whatPressed(x, y) == "No":
                    self.popUpup = None
                elif self.popUpup.whatPressed(x, y) == "Yes":
                    question = "Would you like to change the name of your score?"
                    self.popUpup = PopUpBox((self.width / 2, self.height / 2),
                                            question, "input", "title")

        elif self.popUpup.type == "input":
            if self.popUpup.button == "title":
                if self.popUpup.whatPressed(x, y) == "enter":
                    self.project.scoreTitle = self.popUpup.input
                    self.project.titleButton.text = self.project.scoreTitle
                    self.popUpup = None
            elif self.popUpup.button == "Timebox":
                if self.popUpup.whatPressed(x, y) == "enter":
                    time = self.popUpup.input
                    self.popUpup = None
                    newBox = TextBox(
                        time,
                        (self.width / 2 - 40, self.height / 2 - 40, 80, 80))
                    self.project.textBoxes.append(newBox)
            elif self.popUpup.button == "Lyrics":
                if self.popUpup.whatPressed(x, y) == "enter":
                    words = self.popUpup.input
                    self.popUpup = None
                    newBox = TextBox(
                        words,
                        (self.width / 2 - 40, self.height / 2 - 40, 80, 80))
                    self.project.textBoxes.append(newBox)

        elif self.popUpup.type == "ok":
            if self.popUpup.whatPressed(x, y) == "ok":
                if self.popUpup.button == 'sing':
                    question = "*Recording*"
                    self.popUpup = (PopUpBox((self.width / 2, self.height / 2),
                                             question, "display", "recording"))
                elif self.popUpup.button == "notesSung":
                    self.popUpup = None
                elif self.popUpup.button == "direc":
                    self.popUpup = None
    def pressPopups(self, x, y):
        if self.popUpup.type == "Yes/No":
            if self.popUpup.button == '<--':
                if self.popUpup.whatPressed(x,y) == "Yes":
                    if self.scoreTitle == None:
                        question = "Enter a name for your score"
                        self.popUpup = PopUpBox((self.width/2, self.height/2), question, "input", "<--")
                    else:
                        #SAVE SOME SHIT
                        self.init()
                elif self.popUpup.whatPressed(x,y) == "No":
                    self.init()
            elif self.popUpup.button == "title":
                
                if self.popUpup.whatPressed(x,y) == "No":
                    self.popUpup = None
                elif self.popUpup.whatPressed(x,y) == "Yes":
                    question = "Would you like to change the name of your score?"
                    self.popUpup = PopUpBox((self.width/2, self.height/2), question, "input", "title")

        elif self.popUpup.type == "input":
            if self.popUpup.button == "<--":
                if self.popUpup.whatPressed(x,y) == "enter":
                    print(self.popUpup.input)
                    #SAVE NAME!
                    self.popUpup = None
                    self.init()
            elif self.popUpup.button == "title":
                if self.popUpup.whatPressed(x,y) == "enter":
                    self.scoreTitle = self.popUpup.input
                    self.titleButton.text = self.scoreTitle
                    self.popUpup = None
            elif self.popUpup.button == "spec":
                if self.popUpup.whatPressed(x,y) == "enter":
                    print("hehe")
                    try:
                        welcome.correctFormTimeSig(self.popUpup.input)
                        self.timeSig = self.popUpup.input
                        self.popUpup = None
                    except:
                        question = "Please enter a valid time signature"
                        prev = "Please enter the time signature for your score (ex. 4/4)"
                        self.popUpup = PopUpBox((self.width/2, self.height/2), question, "ok", "spec", (prev, "input", "spec"))
        elif self.popUpup.type == "ok":
            if self.popUpup.whatPressed(x,y) == "ok":
                print("hehe")
                question, typ, button = self.popUpup.previous
                self.popUpup = PopUpBox((self.width/2, self.height/2), question, typ, button)
 def directCreatingKeys(self, keyCode, modifier):
     if self.popUpup != None and self.popUpup.type == "input":
         char = self.getKey(keyCode)
         if char == '\r':
             if self.popUpup.button == 'title':
                 self.scoreTitle = self.popUpup.input
                 self.titleButton.text = self.scoreTitle
                 self.popUpup = None
             elif self.popUpup.button == "<--":
                 print(self.popUpup.input)
                 #SAVE NAME!
                 self.popUpup = None
                 self.init()
             elif self.popUpup.button == 'spec':
                 try:
                     welcome.correctFormTimeSig(self.popUpup.input)
                     self.timeSig = self.popUpup.input
                     self.popUpup = None
                 except:
                     question = "Please enter a valid time signature"
                     prev = "Please enter the time signature for your score (ex. 4/4)"
                     self.popUpup = PopUpBox((self.width/2, self.height/2), question, "ok", "spec", (prev, "input", "spec"))
         elif char == -1:
             self.popUpup.input = self.popUpup.input[:-1]
         elif char == None:
             self.popUpup.input += ""
         else:
             self.popUpup.input += char
     elif self.popUpup == None and self.canAdd:
         pass
Exemplo n.º 4
0
    def pressedButtons(self, x, y):
        self.justSaved = False
        for button in self.buttons:
            if button.pressed(x, y):
                if button.text == "+":
                    maxPages = 8
                    newPage = len(self.pages) + 1
                    if newPage <= maxPages:
                        page = Page(self.properties, newPage)
                        self.pages.append(page)
                        creating.addPageButtons(self)
                    else:
                        pass
                        #popUp
                elif button.text == "Add Music":
                    button.isPressed = not button.isPressed
                    self.canAdd = not self.canAdd

                elif button.text == "<--":
                    if not self.justSaved:
                        question = "Would you like to save?"
                        self.popUpup = PopUpBox(
                            (self.width / 2, self.height / 2), question,
                            "Yes/No", '<--')
                    else:
                        self.init()
                elif button.text == "save":
                    self.justSaved = True
                    pickletest.saveProject(self.project)
                    self.cInit(None, project=self.project, saved=True)
                elif button.text == "Sing":
                    question = "Press OK to record"
                    self.popUpup = PopUpBox((self.width / 2, self.height / 2),
                                            question, "ok", 'sing')
                elif button.text == "Directions":
                    question = "Press 'Add Music' to change the score \n\
Select a measure to change \n drag and drop into the measure\n \n Press\
'Sing' to obtain the notes you sing \n You must sing on the syllable 'Bah'\
 loudly and clearly into the microphone \n For best results, sing slowly"

                    self.popUpup = PopUpBox((self.width / 2, self.height / 2),
                                            question, "ok", 'direc')
Exemplo n.º 5
0
    def checkMenu(self, x, y):
        for button in self.menuButtons:
            if not button.text == "Time" and not button.text == "Lyrics":
                if not self.oneOpened and button.pressed(x, y):
                    button.isPressed = not button.isPressed
                    button.openMenu()
                    self.oneOpened = not self.oneOpened
                    self.openedMenu = button
                    self.collapseAndOpen()
                elif self.oneOpened and button is self.openedMenu and button.pressed(
                        x, y):
                    button.isPressed = not button.isPressed
                    button.openMenu()  #actually closes it
                    self.oneOpened = not self.oneOpened  #False
                    self.openedMenu = None
                    self.collapseAndOpen(False)
                elif self.oneOpened and button is not self.openedMenu and button.pressed(
                        x, y):
                    button.isPressed = not button.isPressed
                    self.openedMenu.isPressed = not self.openedMenu.isPressed
                    self.openedMenu.openMenu()  #close the open one
                    self.openedMenu = button  #open this one
                    self.openedMenu.openMenu()
                    self.collapseAndOpen()
            elif button.text == "Time":
                if button.pressed(x, y):
                    name = self.project.timeSig
                    answer = ""
                    for c in name:
                        if c != "\n":
                            answer += c
                    question = "Your current time signature is %s, enter a time signature" % (
                        answer)
                    self.popUpup = PopUpBox((self.width / 2, self.height / 2),
                                            question, "input", "Timebox")

            elif button.text == "Lyrics":
                if button.pressed(x, y):
                    question = "Enter lyrics or instrument names to add to the score"
                    self.popUpup = PopUpBox((self.width / 2, self.height / 2),
                                            question, "input", "Lyrics")
Exemplo n.º 6
0
 def timerFired(self, dt):
     if self.creating:
         if self.startRecording:
             i = 0
             while i < 200:  #to get a delay so the popUp is drawn
                 i += 1
             notesSung = TT.inputSound()
             notesSung = str(notesSung)
             self.popUpup = None
             self.startRecording = False
             question = "You sang %s" % notesSung
             self.popUpup = PopUpBox((self.width / 2, self.height / 2),
                                     question, "ok", "notesSung")
 def pressingButtons(self, x, y):
     for button in self.buttons:
         if button.pressed(x,y):
             if button.text == "<--":
                 if not self.justSaved:
                     question = "Would you like to save?"
                     self.popUpup = PopUpBox((self.width/2, self.height/2), question, "Yes/No", '<--')
                 else:
                     self.init()
             elif button.text == "Sing":
                 #import testtiming
                 pass
             elif button.text == "Add Music":
                 self.canAdd = not self.canAdd
             elif button.text == "+":
                 pass
             elif button.text == "save":
                 self.justSaved = True
                 button.isPressed = False
             else:
                 #the title box
                 question = "Would you like to change the name of your score?"
                 self.popUpup = PopUpBox((self.width/2, self.height/2), question, "Yes/No", "title")
Exemplo n.º 8
0
 def mousePressed(self, x, y):
     if self.creating:
         if self.popUpup == None:
             if self.project.titleButton.pressed(x, y):
                 question = "Would you like to change the name of your score?"
                 self.popUpup = PopUpBox((self.width / 2, self.height / 2),
                                         question, "Yes/No", "title")
             self.pressedButtons(x, y)
             self.switchedPages(x, y)
             self.pickFromMenu(x, y)
             selectMeasure = self.rearrangeMusic(x, y)
             if selectMeasure:
                 self.selectMeasures(x, y)
             self.checkMenu(x, y)
         else:
             self.pressPopups(x, y)
     elif self.welcome:
         welcome.directWelMouse(self, x, y)
     elif self.editing:
         edit.directEditMouse(self, x, y)