Esempio n. 1
0
    def done(self):
        '''
        create formula, update table,
        create new assignment table->add row for each user
        '''
        self.create_formula()
        num = self.update_assignments_table()
        # create the assignment table with it's proper name in the format: a#
        db.create_assignment_table(num, conn)

        # get a list of currently existing user ids in the system
        ids = db.get_user_ids(conn)

        progress = ''
        grade = 0
        sub_date = 0

        # for each user id, create a first attempt entry using a unique set
        # of questions
        for uid in ids:
            # unique set of questions
            quests = self.create_problem_set(self.formula)
            # ectract a list of problem ids
            prob_ids = []
            # add all ids to the list
            for quest in quests:
                prob_ids.append(quest[0])
            # create the user attempt entry
            db.add_attempt("a" + str(num), uid, prob_ids, progress, grade,
                           sub_date, conn)

        self.refresh()
Esempio n. 2
0
File: user.py Progetto: gsteinb/ace
 def enable_buttons(self):
     # get a list of all existing user ids
     user_ids = db.get_user_ids(conn)        
     # configure clicking function for all the delete buttons
     for uid in user_ids:
         self.deletes[uid].config(command=lambda j=uid: self.del_user(j))
     # configure clicking function for all the update buttons
     for uid in user_ids:
         self.updates[uid].config(command=lambda j=uid: self.up_user(j))
Esempio n. 3
0
 def init_users_in_lb(self):
     '''initialises the users and puts them in the list box'''
     lb = self.list_box["users"]
     # create a label_string
     label_string = "uid    role    name    email"
     lb.insert(END, label_string)
     # get all the user ids
     ids = db.get_user_ids(conn)
     for uid in ids:
         user_string = self.string_uid(uid)
         lb.insert(END, user_string)
Esempio n. 4
0
 def init_users_in_lb(self):
     '''initialises the users and puts them in the list box'''
     lb = self.list_box["users"]
     # create a label_string
     label_string = "{:<3}    {:<7}    {:<10}    {:<15}"
     label_string = label_string.format("uid", "role", "name", "email")
     lb.insert(END, label_string)
     # get all the user ids
     ids = db.get_user_ids(conn)
     for uid in ids:
         user_string = self.string_uid(uid)
         lb.insert(END, user_string)
Esempio n. 5
0
	def create_student_box(self, location):
		'''creates a student listbox in the given location'''
		list_box = self.create_list_box_loc(location, "students", 10, 5,
		                                    mode="multiple")
		users = db.get_user_ids(conn)
		for user in users:
			info = db.get_user_details(conn, user)
			# check that a user is a student
			if (info[0][1] == "student"):
				result = "{:>3} {:<12}"
				result = result.format(info[0][0], info[0][2])
				self.list_box["students"].insert(END, result)
		list_box.grid(row=0, column=2, rowspan=8, padx=5)
Esempio n. 6
0
 def table_functions(self, num, formula):
     '''
     create formula, update table, 
     create new assignment table->add row for each user
     '''
     # create the assignment table with it's proper name in the format: a#
     db.create_assignment_table(num, conn)
     # get a list of currently existing user ids in the system
     ids = db.get_user_ids(conn)
     # for each user id, create a first attempt entry using a unique set
     # of questions
     for uid in ids:
         # unique set of questions
         quests = self.create_problem_set(formula)
         # extract a list of problem ids
         prob_ids = []
         # add all ids to the list
         for quest in quests:
             prob_ids.append(quest[0])
         # create the user attempt entry
         db.add_attempt("a" + str(num), uid, prob_ids, "", "", "", conn)
Esempio n. 7
0
File: user.py Progetto: gsteinb/ace
 def gen_rows(self):
     # get a list of all the user ids in the database
     ids = db.get_user_ids(conn)
     # set iterator for grid rows
     i = 0
     # for each id create a row
     for uid in ids:
         # create new entries 
         role_entry = ttk.Entry(self, font=REGULAR_FONT)
         name_entry = ttk.Entry(self, font=REGULAR_FONT)
         email_entry = ttk.Entry(self, font=REGULAR_FONT)
         # add to corresponding dictonaries with user ids as keys
         self.roles[uid] = role_entry
         self.names[uid] = name_entry    
         self.emails[uid] = email_entry
       
         # create new buttons
         update_button = self.create_button(self, "Update")
         delete_button = self.create_button(self, "Delete")
         # add to corresponding dictonaries with user ids as keys        
         self.deletes[uid] = delete_button
         self.updates[uid] = update_button
         
         # set everything nicely on the grid using an iterator i
         role_entry.grid(row=i+3, column=0)
         name_entry.grid(row=i+3, column=1)
         email_entry.grid(row=i+3, column=2)
         update_button.grid(row=i+3, column=3)
         delete_button.grid(row=i+3, column=4)
         i += 1
         
         # create new user object to contain user info
         user = User(uid)
         # set each entry with the corresponding value from the user object
         role_entry.insert(0, user.get_role())
         name_entry.insert(0, user.get_name())
         email_entry.insert(0, user.get_email())
Esempio n. 8
0
 def enable_buttons(self):
     # get a list of all existing user ids
     user_ids = db.get_user_ids(conn)
Esempio n. 9
0
File: user.py Progetto: gsteinb/ace
        delete_button.grid(row=3, column=1, stick="E")
        
        
    def init_users_in_lb(self):
        '''initialises the users and puts them in the list box'''
        lb = self.list_box["users"]
        # create a label_string
<<<<<<< HEAD
        label_string = "uid    role    name    email"
=======
        label_string = "{:<3}    {:<7}    {:<10}    {:<15}"
        label_string = label_string.format("uid", "role", "name", "email")
>>>>>>> working_final
        lb.insert(END, label_string)
        # get all the user ids
        ids = db.get_user_ids(conn)
        for uid in ids:
            user_string = self.string_uid(uid)
            lb.insert(END, user_string)
    
    
    def string_uid(self, uid):
        '''creates a string to add to list box based on the uid'''
        user_string = "{:<3}    {:<7}    {:<10}    {:<15}"
        # get the user from the id
        user = User(uid)
        # create a string to hold the result of the user
        user_string = user_string.format(uid, user.get_role(), 
                           user.get_name(), user.get_email())
        # place the string inside the list_box
        return user_string