コード例 #1
0
 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)
コード例 #2
0
 def find_users_by_doc(self, *args):
     new_choices = TaskManager.get_all_users_by_doc(self.did.get(), self.data)
     self.users = new_choices
     self.user_options['values'] = [""] + new_choices