Commit 3a7b9032 authored by Thorfin89's avatar Thorfin89

Incrémentation pages ok - pb sur radio suivante ou précédente

parent 42f33525
...@@ -19,42 +19,33 @@ Highlander Radio,DE,Celtic,https://jenny.torontocast.com:2000/stream/highlanderr ...@@ -19,42 +19,33 @@ Highlander Radio,DE,Celtic,https://jenny.torontocast.com:2000/stream/highlanderr
Virgin Rock 70,DE,Rock,http://icy.unitedradio.it/VirginRock70.mp3,virginrock70.png Virgin Rock 70,DE,Rock,http://icy.unitedradio.it/VirginRock70.mp3,virginrock70.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png
Celtic Folk Punk,DE,Celtic-Folk-Punk,https://streamingp.shoutcast.com/JamendoLounge,celtik-folk-punk.png Celtic Folk Punk,DE,Celtic-Folk-Punk,https://streamingp.shoutcast.com/JamendoLounge,celtik-folk-punk.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio21,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio22,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio23,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio24,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio25,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio26,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio27,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio28,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio29,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio30,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio31,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio32,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio33,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio34,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio35,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio36,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio37,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio38,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio39,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio40,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio41,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio42,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,france-inter.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio43,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio44,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio45,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio46,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio47,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio48,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio49,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png Radio50,FR,Généraliste,http://direct.franceinter.fr/live/franceinter-midfi.mp3,
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png \ No newline at end of file
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png
Boom FM_Ottawa,CA,Rock,http://live.leanstream.co/CJOTFM-MP3,boom-ottawa.png
\ No newline at end of file
...@@ -26,7 +26,7 @@ class Pupitre: ...@@ -26,7 +26,7 @@ class Pupitre:
def __init__(self): def __init__(self):
# calcul du nombre de radios contenues dans le fichier CSV # calcul du nombre de radios contenues dans le fichier CSV
self.nb_radios = len(radios_list) self.nb_radios = len(radios_list)
self.nb_pages = self.nb_radios // 20 # partie entière de la division + 1 self.nb_pages = self.nb_radios // 20 # partie entière de la division + 1
self.current_page = 0 self.current_page = 0
# déclaration de la fenêtre principale # déclaration de la fenêtre principale
...@@ -73,8 +73,6 @@ class Pupitre: ...@@ -73,8 +73,6 @@ class Pupitre:
# affiche du logo de la radio sélectionnée >>> placer ici l'icone de la radio en 200x200 # affiche du logo de la radio sélectionnée >>> placer ici l'icone de la radio en 200x200
self.lbl_radio_selected = ttk.Label(self.menu) self.lbl_radio_selected = ttk.Label(self.menu)
# self.lbl_radio_selected.config(bg="lightgray", fg="black")
self.lbl_radio_selected.place(width=225, height=225, x=38, y=38) self.lbl_radio_selected.place(width=225, height=225, x=38, y=38)
# Position d'origine de la barre de boutons # Position d'origine de la barre de boutons
...@@ -127,27 +125,30 @@ class Pupitre: ...@@ -127,27 +125,30 @@ class Pupitre:
for y_logo in range(4): # 4 lignes for y_logo in range(4): # 4 lignes
for x_logo in range(5): # 5 colonnes for x_logo in range(5): # 5 colonnes
num_radio = y_logo * 5 + x_logo # indexation du numéro de radio num_case = y_logo * 5 + x_logo # indexation des cases de la mosaique de 0 à 19
num_radio = (20 * self.current_page) + num_case # indexation du numéro de radio
if num_radio < self.nb_radios: # si on a bien une radio
try: if radios_list[num_radio]['Logo'] != "": # si un logo est associé à ce flux
if radios_list[num_radio]['Logo'] != "": # si un logo est associé à la radio
img = Image.open("./images/" + radios_list[num_radio]['Logo']) img = Image.open("./images/" + radios_list[num_radio]['Logo'])
else: # s'il n'y a pas de logo pour la radio else: # s'il n'y a pas de logo pour la radio
img = Image.open("./images/radio.png") img = Image.open("./images/radio.png")
# on redimensionne le logo
img = img.resize((logo_size, logo_size), Image.ANTIALIAS) img = img.resize((logo_size, logo_size), Image.ANTIALIAS)
self.logo[num_radio] = ImageTk.PhotoImage(img) self.logo[num_case] = ImageTk.PhotoImage(img)
# création du bouton avec le logo de la radio # création du bouton avec le logo de la radio
btn_logo = tk.Button(self.zone_mosaique, image=self.logo[num_radio]) btn_logo = tk.Button(self.zone_mosaique, image=self.logo[num_case])
# utilisation d'une fonction 'lambda' indexée sur la position du logo # utilisation d'une fonction 'lambda' indexée sur la position du logo
btn_logo.config( btn_logo.config(command=lambda flux=radios_list[num_radio]['Url'],
command=lambda flux=radios_list[num_radio]['Url'], num_radio=num_radio: self.radio_selected(num_radio))
num_radio=num_radio: self.radio_selected(num_radio))
btn_logo.place(width=100, height=100, x=x_logo * 100, y=y_logo * 100) btn_logo.place(width=100, height=100, x=x_logo * 100, y=y_logo * 100)
except: # quand le nombre de radios est < 20 on ne crée pas de bouton else:
pass pass
def radio_stop(self): def radio_stop(self):
...@@ -209,13 +210,15 @@ class Pupitre: ...@@ -209,13 +210,15 @@ class Pupitre:
self.current_page -= 1 self.current_page -= 1
if self.current_page < 0: if self.current_page < 0:
self.current_page = self.nb_pages self.current_page = self.nb_pages
print(self.current_page)
self.mosaique()
def page_forward(self): def page_forward(self):
self.current_page += 1 self.current_page += 1
if self.current_page > self.nb_pages: if self.current_page > self.nb_pages:
self.current_page = 0 self.current_page = 0
print(self.current_page)
self.mosaique()
def boucle(self): def boucle(self):
self.root.mainloop() self.root.mainloop()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment