Skip to content
This repository has been archived by the owner on Aug 6, 2021. It is now read-only.

Commit

Permalink
GradePuller: Create default name for upload file
Browse files Browse the repository at this point in the history
  • Loading branch information
cs142ta committed Jul 31, 2020
1 parent 80941ae commit 77dc2c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion zygrader/grade_puller.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ def fetch_completion_reports(self, zybook_sections, class_sections, due_times):
wait_controller.close()

def write_upload_file(self, selected_canvas_assignment):
path = filename_input(purpose="the upload file")
default_path_str = "~/" + "&".join(self.selected_assignments)
default_path_str = default_path_str.replace(" ","")
path = filename_input(purpose="the upload file", text=default_path_str)
if path is None:
raise GradePuller.StoppingException()

Expand Down
6 changes: 4 additions & 2 deletions zygrader/ui/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@ def select_zybook_sections(self, return_just_numbers=False):
res.append(self.zybooks_sections[section_numbers])
return res

def filename_input(purpose):
def filename_input(purpose, text=""):
"""Get a valid filename from the user"""
window = Window.get_window()
full_prompt = f"Enter the path and filename for {purpose} [~ is supported]"

while True:
path = window.create_text_input("Filepath Entry", full_prompt)
path = window.create_text_input("Filepath Entry",
full_prompt,
text=text)
if path == Window.CANCEL:
return None

Expand Down

0 comments on commit 77dc2c7

Please sign in to comment.