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.")
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.")
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")
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)
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
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()
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}')
def test_old(cls): path = request_old_filename() if path: alert(f"You chose {path}.") else: alert("Cancelled.")
def test_ask(cls): response = ask("Do you like mustard and avocado ice cream?", ["Yes", "No", "Undecided"]) alert(f"You chose {response}.")