Update interface.py
This commit is contained in:
parent
5fc9c15b1d
commit
6891bcaded
37
interface.py
37
interface.py
|
@ -1,4 +1,5 @@
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
import os
|
||||||
|
|
||||||
class Interface(tk.Frame):
|
class Interface(tk.Frame):
|
||||||
def __init__(self, master=None):
|
def __init__(self, master=None):
|
||||||
|
@ -6,10 +7,24 @@ class Interface(tk.Frame):
|
||||||
self.master = master
|
self.master = master
|
||||||
self.create_widgets()
|
self.create_widgets()
|
||||||
|
|
||||||
def process(self):
|
def create_command(self):
|
||||||
self.vars = {'simulate': self.simulate.get(), 'feed' :
|
command = 'python core.py'
|
||||||
self.feed.get(),'video':self.video.get()}
|
for key in self.args:
|
||||||
print(self.vars)
|
if bool(self.args[key].get()):
|
||||||
|
print('{}: Option non vide'.format(key))
|
||||||
|
else:
|
||||||
|
print('{}: Option vide'.format(key))
|
||||||
|
|
||||||
|
print(command)
|
||||||
|
return command
|
||||||
|
|
||||||
|
def process_window(self,command):
|
||||||
|
term_window = tk.Toplevel(self.master,height='600',width='600')
|
||||||
|
term_window.title("Process in progress")
|
||||||
|
wid = term_window.winfo_id()
|
||||||
|
for key,value in self.args.items():
|
||||||
|
print('{} : {}'.format(key,value.get()))
|
||||||
|
os.system('xterm -into {} -geometry 400x200 -hold -sb -e \'{}\' &'.format(wid,command))
|
||||||
|
|
||||||
def create_widgets(self):
|
def create_widgets(self):
|
||||||
#
|
#
|
||||||
|
@ -17,22 +32,26 @@ class Interface(tk.Frame):
|
||||||
tk.Label(self.master, padx=10,text="Folder").grid(row=1)
|
tk.Label(self.master, padx=10,text="Folder").grid(row=1)
|
||||||
tk.Label(self.master, padx=10,text="Podcast website root").grid(row=2)
|
tk.Label(self.master, padx=10,text="Podcast website root").grid(row=2)
|
||||||
|
|
||||||
tk.Entry(self.master,width=70).grid(row=0, column=1,columnspan='8')
|
self.youtube_url = tk.StringVar()
|
||||||
tk.Entry(self.master,width=70).grid(row=1, column=1,columnspan='8')
|
self.dir = tk.StringVar()
|
||||||
tk.Entry(self.master,width=70).grid(row=2, column=1,columnspan='8')
|
self.url = tk.StringVar()
|
||||||
|
|
||||||
|
tk.Entry(self.master,width=70, textvariable = self.youtube_url).grid(row=0, column=1,columnspan='8')
|
||||||
|
tk.Entry(self.master,width=70, textvariable = self.dir).grid(row=1, column=1,columnspan='8')
|
||||||
|
tk.Entry(self.master,width=70, textvariable = self.url).grid(row=2, column=1,columnspan='8')
|
||||||
|
|
||||||
self.simulate = tk.IntVar()
|
self.simulate = tk.IntVar()
|
||||||
self.feed = tk.IntVar()
|
self.feed = tk.IntVar()
|
||||||
self.video = tk.IntVar()
|
self.video = tk.IntVar()
|
||||||
|
|
||||||
|
|
||||||
tk.Checkbutton(self.master, text="simulate", variable=self.simulate).grid(row=3,column=1,sticky='WE')
|
tk.Checkbutton(self.master, text="simulate", variable=self.simulate).grid(row=3,column=1,sticky='WE')
|
||||||
tk.Checkbutton(self.master, text="feed", variable=self.feed).grid(row=3,column=2,sticky='WE')
|
tk.Checkbutton(self.master, text="feed", variable=self.feed).grid(row=3,column=2,sticky='WE')
|
||||||
tk.Checkbutton(self.master, text="video only", variable=self.video).grid(row=3,column=3,sticky='WE')
|
tk.Checkbutton(self.master, text="video only", variable=self.video).grid(row=3,column=3,sticky='WE')
|
||||||
|
|
||||||
|
self.args = {'youtube_url':self.youtube_url,'dir':self.dir,'url':self.url,'simulate':self.simulate,'feed':self.feed,'video':self.video}
|
||||||
|
|
||||||
tk.Button(self.master,text='Interrupt').grid(row=4,column=7,sticky='WE')
|
tk.Button(self.master,text='Interrupt').grid(row=4,column=7,sticky='WE')
|
||||||
tk.Button(self.master,text='Process', command = self.process).grid(row=4,column=8,sticky='WE')
|
tk.Button(self.master,text='Process', command = lambda: self.process_window(self.create_command())).grid(row=4,column=8,sticky='WE')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue