From 5f9d287871de9e6f8ea6b8098fb04525e56ef8bc Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Fri, 17 Jul 2015 14:18:20 -0400 Subject: [PATCH] added gu8i --- attribution.py | 2 +- main.py | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 main.py diff --git a/attribution.py b/attribution.py index ddf6044..bc4b80a 100644 --- a/attribution.py +++ b/attribution.py @@ -202,7 +202,7 @@ class AttributionReport(object): filtered_df = deposit_df.ix[start:end] # Variables for short names, and not having to type index a lot. - pi_name = unicode(sf_row['First Name'] + " " + sf_row['Last Name']) + pi_name = unicode(sf_row['First Name'].map(unicode) + " " + sf_row['Last Name']) pi_org = sf_row['Account Name'] # Get matches by the PI's name diff --git a/main.py b/main.py new file mode 100644 index 0000000..04c04b9 --- /dev/null +++ b/main.py @@ -0,0 +1,95 @@ +__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() + self.input_frame = self.setup_input_frame() + self.output_frame = self.setup_output_frame() + self.run_frame = self.setup_run_frame() + + self.update() + self.resizable(True, False) + + + 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"") + + 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"") + input_frame.grid_columnconfigure(1, weight=1) + return input_frame + + def sf_click(self): + f = tkFileDialog.askopenfilename() + self.input_frame.sf_label_var.set(f) + + def dp_click(self): + f = tkFileDialog.askopenfilename() + self.input_frame.dp_label_var.set(f) + + 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_frame.grid_columnconfigure(0, weight=1) + return output_frame + + def output_click(self): + f = tkFileDialog.askdirectory() + self.output_frame.output_label_var.set(f) + + 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 + + def run_click(self): + pass + + +def main(): + app = AttributeGUI() + app.mainloop() + +if __name__ == "__main__": + main()