Esempio n. 1
0
 def test_lookfor(cls):
     path = look_for_file_or_directory(prompt="Please find 'Vera.ttf'",
                                       target="Vera.ttf")
     if path:
         alert(f"You chose {path}.")
     else:
         alert("Cancelled.")
Esempio n. 2
0
 def test_new(cls):
     path = request_new_filename(prompt="Save booty as:",
                                 filename="treasure",
                                 suffix=".dat")
     if path:
         alert(f"You chose {path}.")
     else:
         alert("Cancelled.")
Esempio n. 3
0
    def testLoadMusic():

        path1 = MusicUtilities.get_music("ElecPiK04 75E-01.mp3")
        path2 = MusicUtilities.get_music("ElecPiK04 75E-02.mp3")
        path3 = MusicUtilities.get_music("ElecPiK04 75E-03.mp3")
        path4 = MusicUtilities.get_music("ElecPiK04 75E-04.mp3")

        MusicUtilities.set_music_enabled(False)
        paths = {path1, path2, path3, path4}
        playList = PlayList(items=paths, random=True, repeat=True)
        MusicUtilities.change_playlist(new_playlist=playList)

        alert("Music Loaded")
Esempio n. 4
0
    def drawAction(self):
        self.logger.info(f"Button pressed")
        if self.selectedSprite is None:
            alert("Please select a sprite type")
        else:
            self.logger.info(f"vX: {self.vXvalue} vY: {self.vYvalue}")
            spriteDigit: int = self.selectedSprite.value
            spriteStartAddress: int = Chip8.SPRITE_START_ADDRESS + (
                spriteDigit * Chip8.BYTES_PER_SPRITE)

            self.chip8.indexRegister = spriteStartAddress
            self.chip8.drawOnVirtualScreen(xCoord=self.vXvalue,
                                           yCoord=self.vYvalue,
                                           nBytes=Chip8.BYTES_PER_SPRITE)
Esempio n. 5
0
    def update(self):
        client    = self.client
        directory = client.directory

        def aFilter(name):
            path = os.path.join(directory, name)
            return os.path.isdir(path) or self.client.filter(path)

        try:
            names = [name for name in os.listdir(directory)
                     if not name.startswith(".") and aFilter(name)]
        except EnvironmentError as e:
            alert("%s: %s" % (directory, e))
            names = []
        self.names = names
        self.selection = None
Esempio n. 6
0
    def playMusic():

        if MusicUtilities.get_current_playlist() is None:

            alert("Demo music not loaded. Loading my favorite track")

            favPath = MusicUtilities.get_music(
                "Zoe_Poledouris_-_I_Have_Not_Been_To_Paradise_David_Bowie_Cover.mp3"
            )
            paths = {favPath}
            favPlayList = PlayList(items=paths, random=True, repeat=True)
            favPlayList.repeat = False
            favPlayList.random = False
            MusicUtilities.change_playlist(new_playlist=favPlayList)

        else:
            MusicUtilities.set_music_enabled(True)
            MusicUtilities.start_next_music()
Esempio n. 7
0
    def testTitledDialog(cls):

        longMsg: str = (
            f'[.. to disarm the people; that it was the best and most effectual way to enslave them.'
            f'  but that they should not do it openly, but weaken them, and let them sink gradually, '
            f' by totally disusing and neglecting the militia.  -- George Mason]'
        )

        ttlDlg = TitledDialog(title='Three Button',
                              thirdButtTxt='Just Quit',
                              message='Three buttons with custom text')
        response = ttlDlg.present()
        alert(f'You responded: {response}')

        ttlDlg: TitledDialog = TitledDialog(title='Long wrapped message',
                                            message=longMsg)
        response = ttlDlg.present()
        alert(f'You responded: {response}')

        ttlDlg = TitledDialog(title='Chip8 Python',
                              message='Version 0.5, by Humberto A. Sanchez II')
        response = ttlDlg.present()
        alert(f'You responded: {response}')
Esempio n. 8
0
 def test_old(cls):
     path = request_old_filename()
     if path:
         alert(f"You chose {path}.")
     else:
         alert("Cancelled.")
Esempio n. 9
0
 def test_ask(cls):
     response = ask("Do you like mustard and avocado ice cream?",
                    ["Yes", "No", "Undecided"])
     alert(f"You chose {response}.")