From 4271515e50671c4fdc9b4cc4b437c7c0a4937aa3 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sat, 9 Jan 2021 08:06:31 -0800 Subject: [PATCH] Put the puzzle's name into the first tab of the sheet Just to make it that much easier to tell apart multiple sheet windows that a user might have to juggle. --- TODO | 2 -- turbot/sheets.py | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 72bb4b3..c0f82e9 100644 --- a/TODO +++ b/TODO @@ -78,8 +78,6 @@ Sheet-related fixes have backup access to all of them on the off chance of Slack not being available.) -• Put the puzzle's name into the primary tab of the sheet - • Do something to make it more clear which tabs exist just as backup/reference from the original template vs. any new tab a user has created during the hunt. (Perhaps color the reference tabs diff --git a/turbot/sheets.py b/turbot/sheets.py index 37bd363..df2e4e9 100644 --- a/turbot/sheets.py +++ b/turbot/sheets.py @@ -66,9 +66,12 @@ def sheets_create_for_puzzle(turb, puzzle): body={ "destinationSpreadsheetId": spreadsheet_id }).execute() - # Rename each copied sheet to match original name - rename_sheet(turb, spreadsheet_id, res['sheetId'], - sheet["properties"]["title"]) + # Rename each copied sheet to match the name from the template + sheet_name = sheet["properties"]["title"] + # Except for "Text" which we rename to the puzzle name + if sheet_name == "Text": + sheet_name = puzzle['name'] + rename_sheet(turb, spreadsheet_id, res['sheetId'], sheet_name) # Next, delete the blank sheet that's was created before the template sheet_id = spreadsheet['sheets'][0]['properties']['sheetId'] -- 2.43.0