コード例 #1
0
ファイル: controller.py プロジェクト: ReticulatedSpline/aulos
 def handle_home_select(self):
     display = self.view.menu_stack[-1]
     index = display.index + display.start_index
     if index == HomeOptions.EXIT:
         return False
     elif index == HomeOptions.PLAYLISTS:
         path = cfg.home_menu_items[HomeOptions.PLAYLISTS]
         items = self.library.get_disk_items(cfg.playlist_dir)
         display = Display(items, path)
         self.view.menu_stack.append(display)
     elif index == HomeOptions.TRACKS:
         path = cfg.home_menu_items[HomeOptions.TRACKS]
         display = Display(self.library.get_tracks(), path)
         self.view.menu_stack.append(display)
     elif index == HomeOptions.ALBUMS:
         self.handle_album_select()
     elif index == HomeOptions.ARTISTS:
         self.handle_artist_select()
     elif index == HomeOptions.GENRES:
         self.handle_genre_select()
     elif index == HomeOptions.QUEUE:
         self.handle_queue_select()
     elif index == HomeOptions.SETTINGS:
         self.view.notify(cfg.not_implemented_str)
     return True
コード例 #2
0
ファイル: controller.py プロジェクト: ReticulatedSpline/aulos
 def handle_queue_select(self):
     display_path = cfg.home_menu_items[HomeOptions.QUEUE]
     display_items = []
     for item in self.player.next_tracks:
         display_items.append(DisplayItem(ItemType.Track, item))
     new_display = Display(display_items, display_path)
     self.view.menu_stack.append(new_display)
コード例 #3
0
ファイル: controller.py プロジェクト: ReticulatedSpline/aulos
 def handle_genre_select(self):
     path = cfg.home_menu_items[HomeOptions.GENRES]
     display_items = []
     for key in self.library.genres:
         display_items.append(DisplayItem(ItemType.Directory, key))
     display = Display(display_items, path)
     self.view.menu_stack.append(display)
コード例 #4
0
ファイル: controller.py プロジェクト: ReticulatedSpline/aulos
 def handle_artist_select(self):
     path = cfg.home_menu_items[HomeOptions.ARTISTS]
     display_items = []
     for key in self.library.artists.keys():
         display_items.append(DisplayItem(ItemType.Directory, key))
     display = Display(display_items, path)
     self.view.menu_stack.append(display)
コード例 #5
0
ファイル: game.py プロジェクト: green-fox-academy/Kucika14
 def __init__(self):
     self.my_view = Display()
     self.game_map = Map()
     self.my_view.draw_map(self.game_map.game_map_source)
     self.chars_on_screen = []
     self.enemies_on_screen = []
     self.create_hero(0, 0)
     self.create_enemy()
     self.my_view.root.bind("<KeyPress>", self.on_key_press)
     self.my_view.root.bind("<space>", self.on_space_press)
     self.my_view.starter()
コード例 #6
0
ファイル: controller.py プロジェクト: ReticulatedSpline/aulos
    def handle_lib_subset(self):
        curr_display = self.view.menu_stack[-1]
        menu_path = curr_display.menu_path
        key = curr_display.get_selected_item().path
        if cfg.home_menu_items[HomeOptions.ALBUMS] in menu_path:
            key_items = self.library.albums.get(key)
        elif cfg.home_menu_items[HomeOptions.ARTISTS] in menu_path:
            key_items = self.library.artists.get(key)
        elif cfg.home_menu_items[HomeOptions.GENRES] in menu_path:
            key_items = self.library.genres.get(key)

        if not key_items:
            self.view.notify(cfg.load_error_str)
            return
        else:
            new_item_list = []
            for item in key_items:
                new_item_list.append(DisplayItem(ItemType.Track, item))
            new_path = os.path.join(curr_display.menu_path, key)
            new_display = Display(new_item_list, new_path)
        self.view.menu_stack.append(new_display)
コード例 #7
0
ファイル: controller.py プロジェクト: ReticulatedSpline/aulos
    def handle_playlist_select(self, item, ext, display):
        tracks = self.library.get_playlist_tracks(display.menu_path)
        playlist = os.path.basename(display.menu_path)
        items = []
        for track in tracks:
            items.append(DisplayItem(ItemType.Track, track))

        if item.path == cfg.media_option_items[MediaOptions.VIEW]:
            new_display = Display(items, display.menu_path)
            self.view.menu_stack.append(new_display)
        elif item.path == cfg.media_option_items[MediaOptions.PLAY]:
            if not self.player.play(display.menu_path):
                self.view.notify(cfg.play_error_str)
            else:
                self.view.notify(cfg.playing_str)
            self.view.menu_stack.pop()
        elif item.path == cfg.media_option_items[MediaOptions.QUEUE_NEXT]:
            self.player.queue_next(tracks)
            self.view.menu_stack.pop()
            self.view.notify(playlist + cfg.play_next_str)
        elif item.path == cfg.media_option_items[MediaOptions.QUEUE_LAST]:
            self.player.queue_last(tracks)
            self.view.menu_stack.pop()
            self.view.notify(playlist + cfg.play_last_str)
コード例 #8
0
ファイル: controller.py プロジェクト: ReticulatedSpline/aulos
 def handle_dir_select(self, item_path: str, display):
     item_name = item_path.split(os.sep)[-1]
     display_path = display.menu_path + os.sep + item_name
     item_list = self.library.get_disk_items(item_path)
     new_display = Display(item_list, display_path)
     self.view.menu_stack.append(new_display)
コード例 #9
0
ファイル: controller.py プロジェクト: ReticulatedSpline/aulos
 def handle_media_select(self, item_path: str, display: Display):
     items = []
     for opt in cfg.media_option_items:
         items.append(DisplayItem(ItemType.Menu, opt))
     new_display = Display(items, item_path)
     self.view.menu_stack.append(new_display)
コード例 #10
0
ファイル: test_oc-P5.py プロジェクト: oliviernes/oc_P5
def test_display_products():
    database = Db()
    display = Display()
    rec_prod = [
        (
            31,
            "Ice Tea saveur Pêche",
            "d",
            82,
            "Auchan",
            "https://fr-en.openfoodfacts.org/product/7622210601988/yahourt",
        ),
        (
            32,
            "Ice Tea pêche",
            "d",
            82,
            "Auchan",
            "https://fr-en.openfoodfacts.org/product/7622210601988/yahourt",
        ),
        (
            33,
            "Thé glacé pêche intense",
            "d",
            79,
            "Auchan",
            "https://fr-en.openfoodfacts.org/product/7622210601988/yahourt",
        ),
        (
            34,
            "Thé infusé glacé, Thé noir parfum pêche blanche",
            "d",
            84,
            "Auchan",
            "https://fr-en.openfoodfacts.org/product/7622210601988/yahourt",
        ),
        (
            35,
            "Thé vert infusé glacé saveur Menthe",
            "d",
            84,
            "Auchan",
            "https://fr-en.openfoodfacts.org/product/7622210601988/yahourt",
        ),
        (
            36,
            "Thé noir évasion pêche & saveur hibiscus",
            "d",
            79,
            "Auchan",
            "https://fr-en.openfoodfacts.org/product/7622210601988/yahourt",
        ),
        (
            37,
            "Thé glacé pêche intense",
            "d",
            79,
            "Auchan",
            "https://fr-en.openfoodfacts.org/product/7622210601988/yahourt",
        ),
        (
            38,
            "FROSTIES",
            "d",
            1569,
            "Auchan",
            "https://fr-en.openfoodfacts.org/product/7622210601988/yahourt",
        ),
        (
            39,
            "Sucre glace",
            "d",
            1674,
            "Auchan",
            "https://fr-en.openfoodfacts.org/product/7622210601988/yahourt",
        ),
        (
            40,
            "fuze tea pêche intense (thé glacé)",
            "d",
            79,
            "Auchan",
            "https://fr-en.openfoodfacts.org/product/7622210601988/yahourt",
        ),
    ]
    prod_displayed = display.display_products(38, rec_prod)
    for prod in prod_displayed:
        assert prod[0] != 38