2026-11-10 19:02:46 -06:00
|
|
|
class_name BookPage
|
|
|
|
|
extends RefCounted
|
|
|
|
|
## A Page in the spread's Book: a reusable result (its text with any BBCode,
|
|
|
|
|
## its details tooltip and tags). Results linked to a page (TableEntry.page)
|
|
|
|
|
## show its text and details; editing the page updates every linked result
|
|
|
|
|
## (TowerBoard.sync_page). Saved in the spread file under "book".
|
|
|
|
|
|
|
|
|
|
var id: String = ""
|
|
|
|
|
## The page's name in the Book's list ("" = its text without formatting).
|
|
|
|
|
var name: String = ""
|
|
|
|
|
var text: String = ""
|
|
|
|
|
var details: String = ""
|
|
|
|
|
var tags: Array[String] = []
|
Pictures on results and Book pages; export/import keeps everything new
A result or page can have a picture (TableEntry.image, BookPage.image),
chosen from a file, shrunk to 512 px and kept in the spread file as WebP
under "images" (BoardImages; only used pictures are saved). It shows as
a thumbnail on the card row and in the details pop-up, and comes with a
page. Imported BBCode still can't point at files.
Fix: the Table Tarot JSON export and import (JsonIO.canonical) dropped
every key it didn't know, losing the Book, pictures, card colours and
sizes, limits, nesting, costs and thread options. They now pass through;
a round-trip test covers them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 19:21:05 -06:00
|
|
|
## A picture (BoardImages id). "" = none.
|
|
|
|
|
var image: String = ""
|
Sheets phase E: export/import, text toolbar and Lore links, Lore library and items, phone view
- E1: Export ▾ (share file with embedded pictures, print/PDF web page,
PNG of the tab); Import a sheet file from Sheets and New sheet.
- E2: formatting toolbar (FormatMenu) in sheet text boxes; Lore links
([url=lore:ID]) with hover excerpt and the details panel.
- E3: Lore Index in Play and in sheets (shared LoreList); This spread |
My library; item sheets on Lore Entries; drag entries into lists,
slots and notes (copy, Shift keeps linked).
- E4: phone stacked view in phone order, Stacked | Canvas switch, 44 px
touch sizes, bottom panels; sheet CLI flags split out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:25:09 -06:00
|
|
|
## Its item sheet (a SheetStore sheet id, e.g. a sword's Damage and Charges).
|
|
|
|
|
## "" = none. Saved as "sheet".
|
|
|
|
|
var sheet: String = ""
|
2026-11-10 19:02:46 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func label() -> String:
|
|
|
|
|
return name if name.strip_edges() != "" else Formatter.strip_tags(text).strip_edges()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func to_dict() -> Dictionary:
|
|
|
|
|
var d := {"id": id, "text": text}
|
|
|
|
|
if name != "":
|
|
|
|
|
d["name"] = name
|
|
|
|
|
if details != "":
|
|
|
|
|
d["details"] = details
|
|
|
|
|
if not tags.is_empty():
|
|
|
|
|
d["tags"] = tags.duplicate()
|
Pictures on results and Book pages; export/import keeps everything new
A result or page can have a picture (TableEntry.image, BookPage.image),
chosen from a file, shrunk to 512 px and kept in the spread file as WebP
under "images" (BoardImages; only used pictures are saved). It shows as
a thumbnail on the card row and in the details pop-up, and comes with a
page. Imported BBCode still can't point at files.
Fix: the Table Tarot JSON export and import (JsonIO.canonical) dropped
every key it didn't know, losing the Book, pictures, card colours and
sizes, limits, nesting, costs and thread options. They now pass through;
a round-trip test covers them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 19:21:05 -06:00
|
|
|
if image != "":
|
|
|
|
|
d["image"] = image
|
Sheets phase E: export/import, text toolbar and Lore links, Lore library and items, phone view
- E1: Export ▾ (share file with embedded pictures, print/PDF web page,
PNG of the tab); Import a sheet file from Sheets and New sheet.
- E2: formatting toolbar (FormatMenu) in sheet text boxes; Lore links
([url=lore:ID]) with hover excerpt and the details panel.
- E3: Lore Index in Play and in sheets (shared LoreList); This spread |
My library; item sheets on Lore Entries; drag entries into lists,
slots and notes (copy, Shift keeps linked).
- E4: phone stacked view in phone order, Stacked | Canvas switch, 44 px
touch sizes, bottom panels; sheet CLI flags split out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:25:09 -06:00
|
|
|
if sheet != "":
|
|
|
|
|
d["sheet"] = sheet
|
2026-11-10 19:02:46 -06:00
|
|
|
return d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func from_dict(d: Dictionary) -> BookPage:
|
|
|
|
|
var p := BookPage.new()
|
|
|
|
|
p.id = str(d.get("id", ""))
|
|
|
|
|
p.name = str(d.get("name", ""))
|
|
|
|
|
p.text = str(d.get("text", ""))
|
|
|
|
|
p.details = str(d.get("details", ""))
|
Pictures on results and Book pages; export/import keeps everything new
A result or page can have a picture (TableEntry.image, BookPage.image),
chosen from a file, shrunk to 512 px and kept in the spread file as WebP
under "images" (BoardImages; only used pictures are saved). It shows as
a thumbnail on the card row and in the details pop-up, and comes with a
page. Imported BBCode still can't point at files.
Fix: the Table Tarot JSON export and import (JsonIO.canonical) dropped
every key it didn't know, losing the Book, pictures, card colours and
sizes, limits, nesting, costs and thread options. They now pass through;
a round-trip test covers them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 19:21:05 -06:00
|
|
|
p.image = str(d.get("image", ""))
|
Sheets phase E: export/import, text toolbar and Lore links, Lore library and items, phone view
- E1: Export ▾ (share file with embedded pictures, print/PDF web page,
PNG of the tab); Import a sheet file from Sheets and New sheet.
- E2: formatting toolbar (FormatMenu) in sheet text boxes; Lore links
([url=lore:ID]) with hover excerpt and the details panel.
- E3: Lore Index in Play and in sheets (shared LoreList); This spread |
My library; item sheets on Lore Entries; drag entries into lists,
slots and notes (copy, Shift keeps linked).
- E4: phone stacked view in phone order, Stacked | Canvas switch, 44 px
touch sizes, bottom panels; sheet CLI flags split out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:25:09 -06:00
|
|
|
p.sheet = str(d.get("sheet", ""))
|
2026-11-10 19:02:46 -06:00
|
|
|
for t: Variant in d.get("tags", []):
|
|
|
|
|
p.tags.append(str(t))
|
|
|
|
|
return p
|
Sheets phase E: export/import, text toolbar and Lore links, Lore library and items, phone view
- E1: Export ▾ (share file with embedded pictures, print/PDF web page,
PNG of the tab); Import a sheet file from Sheets and New sheet.
- E2: formatting toolbar (FormatMenu) in sheet text boxes; Lore links
([url=lore:ID]) with hover excerpt and the details panel.
- E3: Lore Index in Play and in sheets (shared LoreList); This spread |
My library; item sheets on Lore Entries; drag entries into lists,
slots and notes (copy, Shift keeps linked).
- E4: phone stacked view in phone order, Stacked | Canvas switch, 44 px
touch sizes, bottom panels; sheet CLI flags split out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:25:09 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## A copy with the same fields (the caller gives it a new id).
|
|
|
|
|
func copy() -> BookPage:
|
|
|
|
|
return BookPage.from_dict(to_dict())
|