def main(): # command line argument parser parser = argparse.ArgumentParser() parser.add_argument("-u") parser.add_argument("-d") parser.add_argument("-t") parser.add_argument("-g") parser.add_argument("-f") args = vars(parser.parse_args()) # parses user id from command line user_id = args["u"] # parses document id from command line doc_id = args["d"] # parses task id from command line task_id = args["t"] # parses if you want gui argument from command line display = args["g"] # parses file name from command line file = args["f"] cmd = True g = None data = TaskManager.load_file(file) # loads gui if display == "yes": g = GUI(data) g.main.mainloop() # uses command line interface else: TaskManager.task_handler(doc_id, user_id, task_id, data, g, cmd) return
def btn_click_search(self): tasks = {"2a": "Viewers by Country", "2b": "Viewers by Continent", "3a": "All Browsers Simple", "3b": "All Browsers Sorted", "4": "Top 10 Readers", "5a": "Users Who Read Document", "5b": "Documents That User Read", "5c": "Also Likes", "5d": "Also Likes Sorted by Reader Profile", "5e": "Also Likes Sorted By Readership"} # check if input the task textbox is valid if self.tid.get() not in tasks.keys(): showerror("Input Error", "Please Enter a Valid Task") return # check if it requires a document id and user id inputs if self.tid.get() not in ["3a", "3b", "4"]: if self.tid.get() == "5a" and self.did.get() not in self.docs: showerror("Input Error", "Please Enter a Valid Document ID") return if self.tid.get() == "5b" and self.uid.get() not in self.users: showerror("Input Error", "Please Enter a Valid User ID") return if self.tid.get() not in ["5a", "5b"] and self.did.get() not in self.docs: showerror("Input Error", "Please Enter a Valid Document ID") return if self.tid.get() not in ["5a", "5b"] and self.uid.get() not in TaskManager.get_all_users_by_doc(self.did.get(), self.data): showerror("Input Error", "Please Enter a Valid User ID") return self.test.set(tasks[self.tid.get()]) TaskManager.task_handler(self.did.get(), self.uid.get(), self.tid.get(), self.data, self, False)