Compare commits
No commits in common. "master" and "dev" have entirely different histories.
@ -1,6 +1,2 @@
|
|||||||
# chainetv
|
# chainetv
|
||||||
|
|
||||||
## to do
|
|
||||||
* finish class json
|
|
||||||
* crée class emission
|
|
||||||
* crée class cli?
|
|
||||||
|
18
chaineTV.py
18
chaineTV.py
@ -35,7 +35,7 @@ class ScrollableCanvas(Frame):
|
|||||||
def __init__(self, parent, *args, **kw):
|
def __init__(self, parent, *args, **kw):
|
||||||
Frame.__init__(self, parent, *args, **kw)
|
Frame.__init__(self, parent, *args, **kw)
|
||||||
|
|
||||||
self.canvas=canvas=Canvas(self,width=300,height=300,scrollregion=(0,0,500,500))
|
canvas=Canvas(self,width=300,height=300,scrollregion=(0,0,500,500))
|
||||||
|
|
||||||
vbar=Scrollbar(self,orient=VERTICAL)
|
vbar=Scrollbar(self,orient=VERTICAL)
|
||||||
vbar.pack(side=RIGHT, fill=Y)
|
vbar.pack(side=RIGHT, fill=Y)
|
||||||
@ -54,6 +54,7 @@ class ScrollableCanvas(Frame):
|
|||||||
# update the scrollbars to match the size of the inner frame
|
# update the scrollbars to match the size of the inner frame
|
||||||
size = (interior.winfo_reqwidth(), interior.winfo_reqheight())
|
size = (interior.winfo_reqwidth(), interior.winfo_reqheight())
|
||||||
canvas.config(scrollregion="0 0 %s %s" % size)
|
canvas.config(scrollregion="0 0 %s %s" % size)
|
||||||
|
canvas.yview_moveto(1)
|
||||||
if interior.winfo_reqwidth() != canvas.winfo_width():
|
if interior.winfo_reqwidth() != canvas.winfo_width():
|
||||||
# update the canvas's width to fit the inner frame
|
# update the canvas's width to fit the inner frame
|
||||||
canvas.config(width=interior.winfo_reqwidth())
|
canvas.config(width=interior.winfo_reqwidth())
|
||||||
@ -66,9 +67,8 @@ class ScrollableCanvas(Frame):
|
|||||||
canvas.bind('<Configure>', _configure_canvas)
|
canvas.bind('<Configure>', _configure_canvas)
|
||||||
|
|
||||||
def _MouseWhell(event):
|
def _MouseWhell(event):
|
||||||
print (event.delta/120)
|
|
||||||
canvas.yview_scroll(-1*(event.delta/120), "units")
|
canvas.yview_scroll(-1*(event.delta/120), "units")
|
||||||
self.bind("<MouseWheel>",_MouseWhell)
|
self.bind_all("<MouseWheel>",_MouseWhell)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -143,13 +143,12 @@ class Interface:
|
|||||||
emmisionGUI(self.resultframe.interior,**emision).pack()
|
emmisionGUI(self.resultframe.interior,**emision).pack()
|
||||||
else:
|
else:
|
||||||
Label(self.resultframe.interior,text="pas de connection internet impossible de determiner l'émission du soir").pack()
|
Label(self.resultframe.interior,text="pas de connection internet impossible de determiner l'émission du soir").pack()
|
||||||
|
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print("numero de chaine inconnue")
|
print("numero de chaine inconnue")
|
||||||
unknow=Label(self.resultframe.interior, text="numero de chaine inconnue")
|
unknow=Label(self.resultframe.interior, text="numero de chaine inconnue")
|
||||||
unknow.pack()
|
unknow.pack()
|
||||||
self.resultframe.canvas.yview_moveto(1)
|
|
||||||
|
|
||||||
self.value.set("")
|
self.value.set("")
|
||||||
|
|
||||||
@ -161,7 +160,7 @@ class Interface:
|
|||||||
|
|
||||||
def click_update(self):
|
def click_update(self):
|
||||||
self.data.parsechaine()
|
self.data.parsechaine()
|
||||||
labelupdate = Label(self.resultframe.interior, text="update chaine done"+"\r")
|
labelupdate = Label(self.resultframe, text="update chaine done"+"\r")
|
||||||
labelupdate.pack()
|
labelupdate.pack()
|
||||||
|
|
||||||
def _openlink(self,link):
|
def _openlink(self,link):
|
||||||
@ -171,6 +170,7 @@ class Interface:
|
|||||||
class JSONfile:
|
class JSONfile:
|
||||||
|
|
||||||
def __init__(self,filename):
|
def __init__(self,filename):
|
||||||
|
import os,json
|
||||||
self.datafilepath=os.path.dirname(os.path.realpath(__file__))+"/"+filename
|
self.datafilepath=os.path.dirname(os.path.realpath(__file__))+"/"+filename
|
||||||
try:
|
try:
|
||||||
with open(self.datafilepath, 'r', encoding='utf-8') as f:
|
with open(self.datafilepath, 'r', encoding='utf-8') as f:
|
||||||
@ -198,17 +198,17 @@ class JSONfile:
|
|||||||
|
|
||||||
if RepresentsInt(firstTD.find_next().string):
|
if RepresentsInt(firstTD.find_next().string):
|
||||||
#print(firstTD.find_next().find_next().text)
|
#print(firstTD.find_next().find_next().text)
|
||||||
liste_chaine[str(int(num))] = firstTD.find_next().find_next().text
|
liste_chaine[int(num)] = firstTD.find_next().find_next().text
|
||||||
else:
|
else:
|
||||||
#print(firstTD.find_next().string)
|
#print(firstTD.find_next().string)
|
||||||
liste_chaine[str(int(num))] = firstTD.find_next().text
|
liste_chaine[int(num)] = firstTD.find_next().text
|
||||||
print(json.dumps(liste_chaine, indent=4))
|
print(json.dumps(liste_chaine, indent=4))
|
||||||
self.data=liste_chaine
|
self.data=liste_chaine
|
||||||
with open(self.datafilepath, 'w', encoding='utf-8') as f:
|
with open(self.datafilepath, 'w', encoding='utf-8') as f:
|
||||||
json.dump(liste_chaine, f, indent=4)
|
json.dump(liste_chaine, f, indent=4)
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return str(self.data)
|
return str(self.data)
|
||||||
|
|
||||||
def RepresentsInt(s):
|
def RepresentsInt(s):
|
||||||
try:
|
try:
|
||||||
int(s)
|
int(s)
|
||||||
|
Loading…
Reference in New Issue
Block a user