Пример #1
0
 def discard_changes(self):
     """
     Discards draft changes (which will then re-render the page).
     """
     click_css(self, 'a.action-discard', 0, require_notification=False)
     confirm_prompt(self)
     self.wait_for_ajax()
Пример #2
0
 def discard_changes(self):
     """
     Discards draft changes (which will then re-render the page).
     """
     click_css(self, 'a.action-discard', 0, require_notification=False)
     confirm_prompt(self)
     self.wait_for_ajax()
Пример #3
0
 def delete(self, source_index):
     """
     Delete the item with index source_index (based on vertical placement in page).
     Only visible items are counted in the source_index.
     The index of the first item is 0.
     """
     # Click the delete button
     click_css(self, 'a.delete-button', source_index, require_notification=False)
     # Click the confirmation dialog button
     confirm_prompt(self)
Пример #4
0
 def delete(self, source_index):
     """
     Delete the item with index source_index (based on vertical placement in page).
     Only visible items are counted in the source_index.
     The index of the first item is 0.
     """
     # Click the delete button
     click_css(self, 'a.delete-button', source_index, require_notification=False)
     # Click the confirmation dialog button
     confirm_prompt(self)
Пример #5
0
    def toggle_staff_lock(self):
        """
        Toggles "hide from students" which enables or disables a staff-only lock.

        Returns True if the lock is now enabled, else False.
        """
        was_locked_initially = self.is_staff_locked
        if not was_locked_initially:
            self.q(css='a.action-staff-lock').first.click()
        else:
            click_css(self, 'a.action-staff-lock', 0, require_notification=False)
            confirm_prompt(self)
        self.wait_for_ajax()
        return not was_locked_initially
Пример #6
0
    def toggle_staff_lock(self, inherits_staff_lock=False):
        """
        Toggles "hide from students" which enables or disables a staff-only lock.

        Returns True if the lock is now enabled, else False.
        """
        was_locked_initially = self.is_staff_locked
        if not was_locked_initially:
            self.q(css='a.action-staff-lock').first.click()
        else:
            click_css(self, 'a.action-staff-lock', 0, require_notification=False)
            if not inherits_staff_lock:
                confirm_prompt(self)
        self.wait_for_ajax()
        return not was_locked_initially
Пример #7
0
 def rename_task_monster(self):
     if not len(self.tasks):
         print("No tasks are currently recorded. Please add a task.")
         return
     if self.selected_task is None:
         print("No current task selected.")
         return
     if confirm_prompt("rename the task's monster (" +
                       self.selected_task.monster + ")"):
         new_monster = prompt("Enter new monster name:")
         old_monster = self.selected_task.monster
         self.selected_task.monster = new_monster
         print("Successfully renamed " + old_monster + " to " +
               new_monster + ".")
     else:
         print("Operation aborted.")