attribution_report/main.py

111 lines
3.8 KiB
Python
Raw Normal View History

2015-07-17 18:18:20 +00:00
__author__ = 'tsouza'
import Tkinter as tk
import tkFileDialog
class AttributeGUI(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
self.initialize()
def initialize(self):
self.title('Attribution Report')
self.grid()
2015-07-17 18:40:11 +00:00
self.minsize(width=300, height=200)
# Input
2015-07-17 18:18:20 +00:00
self.input_frame = self.setup_input_frame()
2015-07-17 18:40:11 +00:00
self.input_frame.grid(row=0, column=0)
self.rowconfigure(0, weight=0)
# Output
2015-07-17 18:18:20 +00:00
self.output_frame = self.setup_output_frame()
2015-07-17 18:40:11 +00:00
self.output_frame.grid(row=1, column=0)
self.rowconfigure(1, weight=0)
# Run
2015-07-17 18:18:20 +00:00
self.run_frame = self.setup_run_frame()
2015-07-17 18:40:11 +00:00
self.run_frame.grid(row=2, column=0)
self.rowconfigure(2, weight=0)
2015-07-17 18:18:20 +00:00
self.update()
2015-07-17 18:40:11 +00:00
self.minsize(self.winfo_width(), self.winfo_height())
self.resizable(True, False)
2015-07-17 18:18:20 +00:00
def setup_input_frame(self):
input_frame = tk.LabelFrame(text="Input Files")
input_frame.grid()
row = 0
input_frame.sf_button = tk.Button(input_frame, text=u"Browse", command=self.sf_click)
input_frame.sf_button.grid(column=0, row=row)
input_frame.sf_label_var = tk.StringVar()
input_frame.sf_label = tk.Label(input_frame,
textvariable=input_frame.sf_label_var,
anchor="w")
input_frame.sf_label.grid(column=1, row=row, sticky='nsew')
input_frame.sf_label_var.set(u"<salesforce export file...>")
row += 1
input_frame.dp_button = tk.Button(input_frame, text=u"Browse", command=self.dp_click)
input_frame.dp_button.grid(column=0, row=row)
input_frame.dp_label_var = tk.StringVar()
input_frame.dp_label = tk.Label(input_frame,
textvariable=input_frame.dp_label_var,
anchor="w")
input_frame.dp_label.grid(column=1, row=row, sticky='nsew')
input_frame.dp_label_var.set(u"<deposit export file...>")
input_frame.grid_columnconfigure(1, weight=1)
return input_frame
def setup_output_frame(self):
output_frame = tk.LabelFrame(text="Output Directory")
output_frame.grid()
row = 0
output_frame.output_button = tk.Button(output_frame, text=u"Browse", command=self.output_click)
output_frame.output_button.grid(column=0, row=row)
output_frame.output_label_var = tk.StringVar()
output_frame.sf_label = tk.Label(output_frame,
textvariable=output_frame.output_label_var,
anchor="w")
output_frame.sf_label.grid(column=1, row=row, sticky='nsew')
output_frame.output_label_var.set(u"<Output directory...>")
output_frame.grid_columnconfigure(0, weight=1)
return output_frame
def setup_run_frame(self):
run_frame = tk.LabelFrame(text="Output Directory")
run_frame.grid()
row = 0
run_frame.run_button = tk.Button(run_frame, text=u"Run", command=self.run_click)
run_frame.run_button.grid(column=0, row=row)
run_frame.grid_columnconfigure(0, weight=1)
return run_frame
2015-07-17 18:40:11 +00:00
def sf_click(self):
self.salesforce_filename = tkFileDialog.askopenfilename()
self.input_frame.sf_label_var.set(self.salesforce_filename)
def dp_click(self):
self.deposit_filename = tkFileDialog.askopenfilename()
self.input_frame.dp_label_var.set(self.deposit_filename)
def output_click(self):
self.output_directoryname = tkFileDialog.askdirectory()
self.output_frame.output_label_var.set(self.output_directoryname)
2015-07-17 18:18:20 +00:00
def run_click(self):
pass
def main():
app = AttributeGUI()
app.mainloop()
2015-07-17 18:40:11 +00:00
2015-07-17 18:18:20 +00:00
if __name__ == "__main__":
main()