Improve Diary photo tools and keep the typing position visible
This commit is contained in:
1 parent
445b4dfbd2
commit
9c7daca4f6
8 files changed
+120
-144
No files matched your search
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## [1.3.21] - 2026-10-28
|
||||
|
||||
- Open each day’s photos from a gallery icon, attach photos with the paperclip, and keep the entry’s layout steady while browsing its gallery.
|
||||
|
||||
## [1.3.20] - 2026-10-28
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.56.
|
||||
|
||||
@@ -18,8 +18,8 @@ DiaryUiFrame :: struct {
|
||||
scroll: s32
|
||||
calendar_scroll: s32
|
||||
page_scroll: s32
|
||||
// How far the day's photos under the entry are scrolled sideways, and
|
||||
// the day whose gallery is open (year * 10000 + month * 100 + day), or 0.
|
||||
// The gallery grid's vertical scroll and the day whose separate
|
||||
// gallery is open (year * 10000 + month * 100 + day), or 0.
|
||||
photos_scroll: s32
|
||||
photos_open_day: s32
|
||||
save_at: float64
|
||||
|
||||
+58
-86
@@ -71,12 +71,10 @@ DIARY_NEXT_ICON :: "S1.8rr:M9 5L16 12L9 19"
|
||||
DIARY_CALENDAR_ICON :: "S1.6rr:M4 5H20V20H4ZM4 10H20M8 3V7M16 3V7"
|
||||
DIARY_TIME_ICON :: "S1.6rr:M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12ZM12 7V12L15.5 14"
|
||||
DIARY_PHOTO_ICON :: "S1.6rr:M3 5H21V19H3ZM3 16L8 11L13 16L16 13L21 18M17.5 8.5C17.5 9.33 16.83 10 16 10C15.17 10 14.5 9.33 14.5 8.5C14.5 7.67 15.17 7 16 7C16.83 7 17.5 7.67 17.5 8.5Z"
|
||||
DIARY_ATTACHMENT_ICON :: "S1.8rr:M21 11L12 20C9.8 22.2 6.2 22.2 4 20C1.8 17.8 1.8 14.2 4 12L14 2C15.66 0.34 18.34 0.34 20 2C21.66 3.66 21.66 6.34 20 8L10 18C8.9 19.1 7.1 19.1 6 18C4.9 16.9 4.9 15.1 6 14L15 5"
|
||||
DIARY_UNDO_ICON :: "S1.8rr:M9 14L4 9L9 4M4 9H14C17.31 9 20 11.69 20 15C20 18.31 17.31 21 14 21H11"
|
||||
DIARY_REDO_ICON :: "S1.8rr:M15 14L20 9L15 4M20 9H10C6.69 9 4 11.69 4 15C4 18.31 6.69 21 10 21H13"
|
||||
DIARY_SPELLING_ICON :: "S2rr:M3 14L7.5 3L12 14M4.8 10H10.2M12 17L15.5 20.5L21.5 13"
|
||||
// The gallery row's chevron points down while the photos are hidden.
|
||||
DIARY_SHOW_ICON :: "S1.8rr:M6 9L12 15L18 9"
|
||||
DIARY_HIDE_ICON :: "S1.8rr:M6 15L12 9L18 15"
|
||||
|
||||
DiaryObservedFrame :: () -> DiaryUiFrame {
|
||||
return frame
|
||||
@@ -153,16 +151,10 @@ DiaryEditorStyle :: (area: *TextAreaProps, text: string, editing: bool) {
|
||||
area.blocks = editor_blocks[:editor_preview.photo_count]
|
||||
}
|
||||
|
||||
// Under the entry, a Show gallery row opens every photo of the day in one
|
||||
// row that scrolls sideways: the media library's photos of that day, newest
|
||||
// first, then the entry's other photos in its order. A tap puts a photo's
|
||||
// embed at the caret. The gallery starts closed whenever a day opens.
|
||||
// The day's gallery is a separate view, opened by its toolbar icon. It
|
||||
// lists the library's photos of that day, then the entry's other photos.
|
||||
// Choosing one inserts it at the saved caret and returns to the entry.
|
||||
DIARY_DAY_PHOTOS :: 64
|
||||
DIARY_TILE :: 88
|
||||
DIARY_GALLERY_ROW :: 44
|
||||
// Room under the photos for the gallery's scrollbar, so it does not cover
|
||||
// them.
|
||||
DIARY_GALLERY_BAR :: 12
|
||||
|
||||
DiaryDayPhoto :: struct {
|
||||
// What an embed of the photo links to.
|
||||
@@ -231,18 +223,6 @@ DiaryGalleryOpen :: () -> bool {
|
||||
return frame.photos_open_day != 0 && frame.photos_open_day == DiaryDayKey()
|
||||
}
|
||||
|
||||
// The room the gallery takes under the entry, or 0 on a day without photos.
|
||||
DiaryDayPhotosHeight :: () -> s32 {
|
||||
if day_photo_count == 0 {
|
||||
return 0
|
||||
}
|
||||
height := Scale(12) + Scale(DIARY_GALLERY_ROW)
|
||||
if DiaryGalleryOpen() {
|
||||
height += Scale(8) + Scale(DIARY_TILE) + Scale(DIARY_GALLERY_BAR)
|
||||
}
|
||||
return height
|
||||
}
|
||||
|
||||
// Puts a photo's embed on its own line at the caret: one edit, saved at once.
|
||||
DiaryInsertPhoto :: (destination: string, name: string) {
|
||||
line := DiaryEmbedLine(destination, name)
|
||||
@@ -255,45 +235,27 @@ DiaryInsertPhoto :: (destination: string, name: string) {
|
||||
frame.save_at = frame.now
|
||||
}
|
||||
|
||||
// The gallery row, a dropdown as Habits' inactive habits are, and under it
|
||||
// the open gallery.
|
||||
DiaryDayGallery :: (left: float32, top: float32, width: float32, editable: bool) {
|
||||
open := DiaryGalleryOpen()
|
||||
row := cast(float32)Scale(DIARY_GALLERY_ROW)
|
||||
label := AppLocale("diary_show_gallery")
|
||||
if open {
|
||||
label = AppLocale("diary_hide_gallery")
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.id = 29017, .bounds = Rectangle.{left, top, width, row},
|
||||
.label = label, .icon_shape = ifx open then DIARY_HIDE_ICON else DIARY_SHOW_ICON,
|
||||
.icon_placement = cast(IconPlacement)IconPlacementTrailing,
|
||||
.content_alignment = cast(ContentAlignment)ContentAlignmentStart,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
|
||||
frame.photos_open_day = ifx open then 0 else DiaryDayKey()
|
||||
frame.photos_scroll = 0
|
||||
}
|
||||
if open {
|
||||
DiaryDayPhotoStrip(left, top + row + cast(float32)Scale(8), width, editable)
|
||||
}
|
||||
}
|
||||
|
||||
DiaryDayPhotoStrip :: (left: float32, top: float32, width: float32, editable: bool) {
|
||||
tile := cast(float32)Scale(DIARY_TILE)
|
||||
DiaryDayGallery :: (left: float32, top: float32, width: float32, height: float32, editable: bool) {
|
||||
gap := cast(float32)Scale(8)
|
||||
content := cast(s32)(cast(float32)day_photo_count * (tile + gap) - gap)
|
||||
bar := cast(float32)Scale(DIARY_GALLERY_BAR)
|
||||
strip := Scroll(frame.session, ScrollProps.{.key = cast(u64)290302, .horizontal = true,
|
||||
.bounds = Rectangle.{left, top, width, tile + bar}, .content_width = content,
|
||||
.content_height = cast(s32)tile, .scroll_offset = frame.photos_scroll})
|
||||
inner := width - cast(float32)Scale(14)
|
||||
columns := cast(s32)((inner + gap) / cast(float32)Scale(112))
|
||||
if columns < 1 {
|
||||
columns = 1
|
||||
}
|
||||
tile := (inner - cast(float32)(columns - 1) * gap) / cast(float32)columns
|
||||
rows := (day_photo_count + columns - 1) / columns
|
||||
strip := Scroll(frame.session, ScrollProps.{.key = cast(u64)290302,
|
||||
.bounds = Rectangle.{left, top, width, height}, .scale = frame.scale,
|
||||
.content_height = cast(s32)(cast(float32)rows * (tile + gap)),
|
||||
.scroll_offset = frame.photos_scroll})
|
||||
frame.photos_scroll = strip.scroll_offset
|
||||
if !strip.opened {
|
||||
return
|
||||
}
|
||||
for index: cast(s32)0..day_photo_count - 1 {
|
||||
photo := day_photos[index]
|
||||
bounds := Rectangle.{strip.content.x + cast(float32)index * (tile + gap),
|
||||
strip.content.y, tile, tile}
|
||||
bounds := Rectangle.{strip.content.x + cast(float32)(index % columns) * (tile + gap),
|
||||
strip.content.y + cast(float32)(index / columns) * (tile + gap), tile, tile}
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)(292000 + index), .bounds = bounds,
|
||||
.fill = Color.{156, 156, 156, 36}, .radius = cast(float32)Scale(6)})
|
||||
if photo.asset.count > 0 {
|
||||
@@ -306,6 +268,7 @@ DiaryDayPhotoStrip :: (left: float32, top: float32, width: float32, editable: bo
|
||||
.disabled = !editable})
|
||||
if press.clicked && !pending {
|
||||
DiaryInsertPhoto(photo.destination, photo.name)
|
||||
frame.photos_open_day = 0
|
||||
}
|
||||
}
|
||||
End(frame.session)
|
||||
@@ -382,6 +345,11 @@ DiaryAction :: ( id: s32, label: string, bounds: Rectangle, enabled: bool = true
|
||||
frame.spelling_requested = true
|
||||
return
|
||||
}
|
||||
if id == 29017 {
|
||||
frame.photos_open_day = ifx DiaryGalleryOpen() then 0 else DiaryDayKey()
|
||||
frame.photos_scroll = 0
|
||||
return
|
||||
}
|
||||
state.action = DIARY_CONTROL
|
||||
state.control = id
|
||||
pending = true
|
||||
@@ -394,6 +362,7 @@ DiaryAction :: ( id: s32, label: string, bounds: Rectangle, enabled: bool = true
|
||||
DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> DiaryMessage {
|
||||
state = message
|
||||
frame = observed
|
||||
pending = false
|
||||
column := CenteredColumnFor(frame.width, Scale(640), Scale(16))
|
||||
left := cast(float32)(column.x + frame.origin_x)
|
||||
width := cast(float32)column.width
|
||||
@@ -424,20 +393,16 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
.align = cast(TextAlign)TextAlignCenter, .vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
|
||||
// Tools: Today and the calendar move between days; undo, redo, spelling,
|
||||
// the time and photos change the entry. Today narrows on phones so every
|
||||
// icon keeps its target.
|
||||
// On phones the editing tools get their own row, keeping every target
|
||||
// at 44 units instead of squeezing the icons beside Today.
|
||||
tools := top + control + gap
|
||||
tool_gap := cast(float32)Scale(4)
|
||||
tool := control
|
||||
today_width := width - 6.0 * tool - 5.0 * tool_gap - gap
|
||||
if today_width < cast(float32)Scale(64) {
|
||||
// The narrowest phones keep Today readable with smaller icon targets.
|
||||
today_width = cast(float32)Scale(64)
|
||||
tool = (width - today_width - gap - 5.0 * tool_gap) / 6.0
|
||||
}
|
||||
if today_width > cast(float32)Scale(128) {
|
||||
today_width = cast(float32)Scale(128)
|
||||
today_width := cast(float32)Scale(96)
|
||||
stacked := width < today_width + gap + 7.0 * tool + 6.0 * tool_gap
|
||||
edit_tools := tools
|
||||
if stacked && !state.calendar {
|
||||
edit_tools += control + tool_gap
|
||||
}
|
||||
DiaryAction(29004, AppLocale("diary_today"), Rectangle.{left, tools, today_width, control})
|
||||
DiaryAction(29003, AppLocale("tab_diary_calendar"),
|
||||
@@ -447,24 +412,37 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
if !state.calendar {
|
||||
idle := editable && !frame.spelling_busy
|
||||
DiaryAction(29014, AppLocale("diary_undo"),
|
||||
Rectangle.{left + width - 5.0 * tool - 4.0 * tool_gap, tools, tool, control},
|
||||
Rectangle.{left + width - 6.0 * tool - 5.0 * tool_gap, edit_tools, tool, control},
|
||||
idle && frame.can_undo, DIARY_UNDO_ICON)
|
||||
DiaryAction(29015, AppLocale("diary_redo"),
|
||||
Rectangle.{left + width - 4.0 * tool - 3.0 * tool_gap, tools, tool, control},
|
||||
Rectangle.{left + width - 5.0 * tool - 4.0 * tool_gap, edit_tools, tool, control},
|
||||
idle && frame.can_redo, DIARY_REDO_ICON)
|
||||
DiaryAction(29016, AppLocale("diary_check_spelling"),
|
||||
Rectangle.{left + width - 3.0 * tool - 2.0 * tool_gap, tools, tool, control},
|
||||
Rectangle.{left + width - 4.0 * tool - 3.0 * tool_gap, edit_tools, tool, control},
|
||||
idle && HasWords(state.text) && AppSupports("text.correct.start"), DIARY_SPELLING_ICON, false, frame.spelling_busy)
|
||||
DiaryAction(29013, AppLocale("diary_insert_time"),
|
||||
Rectangle.{left + width - 2.0 * tool - tool_gap, tools, tool, control},
|
||||
Rectangle.{left + width - 3.0 * tool - 2.0 * tool_gap, edit_tools, tool, control},
|
||||
!frame.spelling_busy, DIARY_TIME_ICON)
|
||||
DiaryAction(29005, AppLocale("diary_attach_photo"),
|
||||
Rectangle.{left + width - tool, tools, tool, control},
|
||||
AppSupports("media.pick"), DIARY_PHOTO_ICON)
|
||||
Rectangle.{left + width - 2.0 * tool - tool_gap, edit_tools, tool, control},
|
||||
AppSupports("media.pick"), DIARY_ATTACHMENT_ICON)
|
||||
DiaryDayPhotos(state.text)
|
||||
gallery_label := AppLocale("diary_show_gallery")
|
||||
if DiaryGalleryOpen() {
|
||||
gallery_label = AppLocale("diary_hide_gallery")
|
||||
}
|
||||
DiaryAction(29017, gallery_label,
|
||||
Rectangle.{left + width - tool, edit_tools, tool, control},
|
||||
editable && day_photo_count > 0, DIARY_PHOTO_ICON, DiaryGalleryOpen())
|
||||
}
|
||||
content := tools + control + cast(float32)Scale(12)
|
||||
content := edit_tools + control + cast(float32)Scale(12)
|
||||
content_height := cast(float32)(frame.height - frame.bottom) - content - cast(float32)Scale(16)
|
||||
|
||||
if !state.calendar && DiaryGalleryOpen() {
|
||||
DiaryDayGallery(left, content, width, content_height, editable && !frame.spelling_busy)
|
||||
return FinishView()
|
||||
}
|
||||
|
||||
if state.calendar {
|
||||
scroll := Scroll(frame.session, ScrollProps.{.key = cast(u64)290300,
|
||||
.bounds = Rectangle.{left, content, width, content_height},
|
||||
@@ -505,20 +483,17 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
End(frame.session)
|
||||
return FinishView()
|
||||
}
|
||||
// The editor reaches the bottom; a notice and the day's photos take room
|
||||
// below it only while they are shown.
|
||||
// The gallery never changes the entry's viewport or line positions.
|
||||
notice := frame.photo_error || state.load_error || frame.spelling_notice != ""
|
||||
notice_room := ifx notice then Scale(60) else 0
|
||||
DiaryDayPhotos(state.text)
|
||||
photos_room := DiaryDayPhotosHeight()
|
||||
editor_height := cast(s32)content_height - notice_room - photos_room
|
||||
editor_height := cast(s32)content_height - notice_room
|
||||
if editor_height < Scale(120) {
|
||||
editor_height = Scale(120)
|
||||
}
|
||||
page := Scroll(frame.session, ScrollProps.{.key = cast(u64)290301,
|
||||
.bounds = Rectangle.{left, content, width, content_height},
|
||||
.content_height = editor_height + notice_room + photos_room,
|
||||
.scroll_offset = frame.page_scroll})
|
||||
.content_height = editor_height + notice_room,
|
||||
.scroll_offset = frame.page_scroll, .scale = frame.scale})
|
||||
frame.page_scroll = page.scroll_offset
|
||||
if !page.opened {
|
||||
return FinishView()
|
||||
@@ -530,6 +505,7 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
area.value = state.text
|
||||
area.label = AppLocale("tab_diary")
|
||||
area.wrap = true
|
||||
area.scale = frame.scale
|
||||
area.cursor = state.cursor
|
||||
area.anchor = state.anchor
|
||||
area.scroll_y = frame.scroll
|
||||
@@ -548,7 +524,7 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
frame.scroll = edited.scroll_y
|
||||
frame.focused = edited.focused
|
||||
frame.selecting = edited.selecting
|
||||
if edited.edit.changed {
|
||||
if edited.edit.changed && !pending {
|
||||
state.action = DIARY_EDIT
|
||||
state.edit_start = edited.edit.start
|
||||
state.edit_end = edited.edit.end
|
||||
@@ -573,10 +549,6 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
area.bounds.y + area.bounds.height + cast(float32)Scale(12), width, cast(float32)Scale(40)},
|
||||
.text = AppLocale(status), .font = frame.font})
|
||||
}
|
||||
if photos_room > 0 {
|
||||
DiaryDayGallery(left, area.bounds.y + area.bounds.height +
|
||||
cast(float32)(notice_room + Scale(12)), width, editable && !frame.spelling_busy)
|
||||
}
|
||||
End(frame.session)
|
||||
return FinishView()
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## [2.1.58] - 2026-10-28
|
||||
|
||||
- Bring Diary’s separate day gallery and attachment toolbar.
|
||||
|
||||
## [2.1.57] - 2026-10-28
|
||||
|
||||
- Bring Lumi 1.5.23, Habits 1.3.11, Practices 1.6.5, Lists 1.1.24, Diary 1.3.20 and Leaderboard 1.0.25 for Inner Breeze 2.1.56.
|
||||
|
||||
+4
-4
@@ -6,8 +6,8 @@
|
||||
"apps": {
|
||||
"inbe": {
|
||||
"id": "inbe",
|
||||
"version": "2.1.57",
|
||||
"sequence": 54,
|
||||
"version": "2.1.58",
|
||||
"sequence": 55,
|
||||
"bundled": true,
|
||||
"host_api": 40,
|
||||
"release": "2.1.56"
|
||||
@@ -40,8 +40,8 @@
|
||||
},
|
||||
"diary": {
|
||||
"id": "inbe.diary",
|
||||
"version": "1.3.20",
|
||||
"sequence": 37,
|
||||
"version": "1.3.21",
|
||||
"sequence": 38,
|
||||
"bundled": true,
|
||||
"host_api": 21,
|
||||
"release": "2.1.56"
|
||||
|
||||
@@ -3,7 +3,7 @@ PackageBundledVersion :: (index: s32) -> string {
|
||||
if index < 0 || index >= 7 {
|
||||
return ""
|
||||
}
|
||||
versions: [7]string = .["2.1.57", "1.1.24", "1.3.11", "1.6.5", "1.3.20", "1.5.23", "1.0.25"]
|
||||
versions: [7]string = .["2.1.58", "1.1.24", "1.3.11", "1.6.5", "1.3.21", "1.5.23", "1.0.25"]
|
||||
return versions[index]
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ PackageBundledSequence :: (index: s32) -> s32 {
|
||||
if index < 0 || index >= 7 {
|
||||
return 0
|
||||
}
|
||||
sequences: [7]s32 = .[54, 32, 34, 34, 37, 41, 26]
|
||||
sequences: [7]s32 = .[55, 32, 34, 34, 38, 41, 26]
|
||||
return sequences[index]
|
||||
}
|
||||
|
||||
|
||||
+32
-36
@@ -120,8 +120,9 @@ def application(profile, label, import_source=None, size=(900, 720)):
|
||||
command("xdotool", "windowsize", window, str(size[0]), str(size[1]))
|
||||
command("xdotool", "windowfocus", window)
|
||||
time.sleep(1.5)
|
||||
# Fresh profiles can show the first-run Lumi guide over the editor.
|
||||
tap(window, size[0] // 2 + 112, 114)
|
||||
if driver.find(label="Close", role="button", visible=True):
|
||||
driver.press(label="Close", role="button")
|
||||
driver.wait_gone(label="Close", role="button")
|
||||
yield window
|
||||
assert app.poll() is None, "Diary crashed"
|
||||
finally:
|
||||
@@ -159,21 +160,22 @@ with tempfile.TemporaryDirectory(prefix="inbe-diary-ui-") as temporary:
|
||||
capture(window, "saved")
|
||||
# Typing within a moment of another change joins its undo step.
|
||||
time.sleep(1.2)
|
||||
tap(window, 700, 86) # Insert current time.
|
||||
driver.wait_gone(contains="Achievement unlocked", timeout=20)
|
||||
driver.press(label="Insert time", role="button")
|
||||
wait_for_text(entry, lambda text: "**" in text, "Time insertion was not saved")
|
||||
with_time = json.loads(entry.read_text())["text"]
|
||||
tap(window, 556, 86) # Undo.
|
||||
driver.press(label="Undo")
|
||||
wait_for_text(entry, lambda text: text == "A saved Diary entry", "Undo did not restore the entry")
|
||||
tap(window, 604, 86) # Redo.
|
||||
driver.press(label="Redo")
|
||||
wait_for_text(entry, lambda text: text == with_time, "Redo did not restore the time")
|
||||
tap(window, 652, 86) # Spelling needs a signed-in account.
|
||||
driver.press(label="Correct spelling")
|
||||
time.sleep(0.5)
|
||||
capture(window, "spelling-without-account")
|
||||
assert json.loads(entry.read_text())["text"] == with_time, "Spelling changed the entry without an account"
|
||||
# The photo button adds the picked photo to the account's photo
|
||||
# library, under the day it was added, and embeds its place there on
|
||||
# its own line at the caret, which is at the entry's end.
|
||||
tap(window, 748, 86)
|
||||
driver.press(label="Attach photo")
|
||||
wait_for_text(entry, lambda text: "](photos/" in text, "A picked photo was not embedded")
|
||||
digest = hashlib.sha256(picked.read_bytes()).hexdigest()
|
||||
place = time.strftime("photos/%Y/%m/%d/") + digest + ".jpg"
|
||||
@@ -223,12 +225,12 @@ with tempfile.TemporaryDirectory(prefix="inbe-diary-ui-") as temporary:
|
||||
settled = ink_bottom(OUTPUT / "typed.png", box)
|
||||
assert max(typed_rows) <= settled + 2, f"A second caret showed under the typed line: {typed_rows} > {settled}"
|
||||
saved = json.loads(entry.read_text())
|
||||
tap(window, 288, 86) # Calendar.
|
||||
driver.press(label="Calendar")
|
||||
capture(window, "calendar")
|
||||
with application(profile, "restart") as window:
|
||||
capture(window, "restored")
|
||||
assert json.loads(entry.read_text()) == saved
|
||||
tap(window, 748, 34) # Next day saves before changing selection.
|
||||
driver.press(label="›")
|
||||
capture(window, "today-limit")
|
||||
assert list((profile / "diary").glob("*/????-??-??.json")) == [entry]
|
||||
assert json.loads(entry.read_text()) == saved
|
||||
@@ -305,12 +307,13 @@ with tempfile.TemporaryDirectory(prefix="inbe-diary-ui-") as temporary:
|
||||
red = red_pixels(OUTPUT / f"sage-{dark}-inline.png")
|
||||
assert len(red) > 20000, "Photo not drawn inside the entry at phone scale"
|
||||
assert phone_entry.read_text() == stored, "Viewing the day rewrote its entry"
|
||||
# The day's gallery opens from its row, closed when the day opens.
|
||||
# The icon opens a separate day gallery without resizing the entry.
|
||||
driver.wait(label="Show gallery")
|
||||
assert not driver.find(label="A photo", role="image"), "The gallery was open when the day opened"
|
||||
driver.press(label="Show gallery")
|
||||
driver.wait(label="Hide gallery")
|
||||
driver.wait(label="A photo", role="image")
|
||||
capture(window, f"sage-{dark}-day-gallery")
|
||||
# The entry's Diary file and its library photo are one picture,
|
||||
# listed once; a tap embeds the library's.
|
||||
assert len(driver.find(label="A photo", role="image")) == 1, "The gallery listed a photo twice"
|
||||
@@ -330,7 +333,6 @@ with tempfile.TemporaryDirectory(prefix="inbe-diary-ui-") as temporary:
|
||||
wait_for_text(phone_entry, lambda text: text == saved_photo["text"], "Redo did not restore the tapped photo")
|
||||
# Another day opens with its gallery closed, and so does this one
|
||||
# when it opens again.
|
||||
driver.press(label="Hide gallery")
|
||||
driver.wait(label="Show gallery")
|
||||
driver.press(label="Show gallery")
|
||||
driver.press(label="‹")
|
||||
@@ -343,16 +345,15 @@ with tempfile.TemporaryDirectory(prefix="inbe-diary-ui-") as temporary:
|
||||
# A day with more photos than the gallery shows at once and an entry
|
||||
# longer than its box, with large photos between its lines. The wheel
|
||||
# over the entry scrolls it, over its photos too, and the page around it
|
||||
# stays, and a sideways swipe leaves it; the gallery's photos show whole
|
||||
# above its scrollbar; the wheel, a sideways swipe and a drag move the
|
||||
# gallery sideways, a drag does not embed the photo it starts on, and a
|
||||
# stays, and a sideways swipe leaves it. The separate gallery scrolls
|
||||
# vertically; a drag does not embed the photo it starts on, and a
|
||||
# tap on a photo scrolled into view embeds it.
|
||||
many_source = profile / "many-source"
|
||||
many_source.mkdir()
|
||||
many_names = [f"many-{index:02d}.png" for index in range(12)]
|
||||
many_names = [f"many-{index:02d}.png" for index in range(24)]
|
||||
lines = []
|
||||
for index, name in enumerate(many_names):
|
||||
Image.new("RGB", (400, 300), (20 * index, 140, 220 - 15 * index)).save(many_source / name)
|
||||
Image.new("RGB", (400, 300), ((29 * index) % 256, 40 + (7 * index) % 180, 220 - (5 * index) % 200)).save(many_source / name)
|
||||
lines += [f"Line {index} of a long day" for _ in range(3)]
|
||||
if index < 4:
|
||||
lines.append(f"")
|
||||
@@ -360,7 +361,7 @@ with tempfile.TemporaryDirectory(prefix="inbe-diary-ui-") as temporary:
|
||||
(many_source / entry.name).write_text(json.dumps(dict(original, text=many_text, photos=[
|
||||
dict(file=name, name=f"Photo {index}") for index, name in enumerate(many_names)])))
|
||||
many = profile / "many-photos"
|
||||
with application(many, "many-photos", many_source) as window:
|
||||
with application(many, "many-photos", many_source, size=(390, 640)) as window:
|
||||
many_entry = next((many / "diary").glob("*/" + entry.name))
|
||||
deadline = time.monotonic() + 20
|
||||
while not all(library_has(many, hashlib.sha256((many_source / name).read_bytes()).hexdigest())
|
||||
@@ -414,35 +415,30 @@ with tempfile.TemporaryDirectory(prefix="inbe-diary-ui-") as temporary:
|
||||
|
||||
def tiles():
|
||||
return sorted((node for node in driver.find(role="image") if node["label"].startswith("Photo ")),
|
||||
key=lambda node: node["x"])
|
||||
key=lambda node: (node["y"], node["x"]))
|
||||
|
||||
assert not driver.find(role="text_area"), "The gallery still shares the entry's viewport"
|
||||
strip = [node for node in driver.tree() if node["kind"] == "scroll" and node["key"] == 290302][0]
|
||||
shown = tiles()
|
||||
assert len(shown) == 12, [node["label"] for node in shown]
|
||||
assert shown[-1]["x"] + shown[-1]["width"] > strip["x"] + strip["width"], "The gallery fits its row"
|
||||
# The gallery's scrollbar sits under its photos, not over them.
|
||||
assert shown[0]["visible_height"] == shown[0]["height"], \
|
||||
f"The scrollbar covers the photos: {shown[0]['visible_height']} of {shown[0]['height']} show"
|
||||
first_x = shown[0]["x"]
|
||||
capture(window, "day-gallery-grid")
|
||||
assert len(shown) == len(many_names), [node["label"] for node in shown]
|
||||
assert shown[-1]["y"] + shown[-1]["height"] > strip["y"] + strip["height"], "The grid has no scrollable rows"
|
||||
assert shown[0]["visible_height"] == shown[0]["height"], "The first grid row is clipped"
|
||||
first_y = shown[0]["y"]
|
||||
over_strip = (strip["x"] + strip["width"] / 2, strip["y"] + strip["height"] / 2)
|
||||
wheel(over_strip, -1.0, 2)
|
||||
assert tiles()[0]["x"] < first_x, "The wheel did not move the gallery sideways"
|
||||
assert tiles()[0]["y"] < first_y, "The wheel did not move the gallery down"
|
||||
wheel(over_strip, 1.0, 4)
|
||||
assert tiles()[0]["x"] == first_x, "The wheel did not move the gallery back"
|
||||
# A sideways swipe to the right shows the photos further right.
|
||||
wheel(over_strip, 1.0, 2, sideways=True)
|
||||
assert tiles()[0]["x"] < first_x, "A sideways swipe did not move the gallery toward its end"
|
||||
wheel(over_strip, -1.0, 4, sideways=True)
|
||||
assert tiles()[0]["x"] == first_x, "A sideways swipe did not move the gallery back"
|
||||
assert tiles()[0]["y"] == first_y, "The wheel did not move the gallery back"
|
||||
before_drag = json.loads(many_entry.read_text())["text"]
|
||||
driver.drag((over_strip[0] + 150, over_strip[1]), (over_strip[0] - 150, over_strip[1]))
|
||||
driver.drag((over_strip[0], over_strip[1] + 150), (over_strip[0], over_strip[1] - 150))
|
||||
driver.wait_idle(frames=3, timeout=3)
|
||||
assert tiles()[0]["x"] < first_x - 100, "A drag did not move the gallery"
|
||||
assert tiles()[0]["y"] < first_y - 100, "A drag did not move the gallery"
|
||||
time.sleep(0.5)
|
||||
assert json.loads(many_entry.read_text())["text"] == before_drag, "A drag embedded a photo"
|
||||
wheel(over_strip, -3.0, 20)
|
||||
last = tiles()[-1]
|
||||
assert last["visible"] and last["visible_x"] + last["visible_width"] <= strip["x"] + strip["width"], \
|
||||
assert last["visible"] and last["visible_y"] + last["visible_height"] <= strip["y"] + strip["height"], \
|
||||
"The wheel did not reach the gallery's end"
|
||||
driver.press(label=last["label"])
|
||||
number = int(last["label"].split()[-1])
|
||||
@@ -451,5 +447,5 @@ with tempfile.TemporaryDirectory(prefix="inbe-diary-ui-") as temporary:
|
||||
|
||||
print("Standalone Diary: native editing, delayed save, time insertion, undo, redo, spelling without an account, a picked photo in the photo library and inside the entry, text typed right after the photo, one caret while typing, calendar, restart and day navigation passed")
|
||||
print("Harmony import: text and photo bytes copied, originals preserved, symlinks skipped and existing entries retained")
|
||||
print("Diary photos: older photo lists inside the entry and in the photo library, a missing file, no writes on viewing, the gallery dropdown closed on every day it opens, each picture listed once, a tapped photo embedded and undone, and restart at phone width in light/dark sage passed")
|
||||
print("Diary scrolling: the wheel scrolls a long entry through its photos and back without moving the page, a sideways swipe leaves it, and the wheel, a sideways swipe and a drag move a full gallery, whose photos show whole above its scrollbar, where a drag embeds nothing and a tap on a photo scrolled into view embeds it")
|
||||
print("Diary photos: older photo lists inside the entry and in the photo library, a missing file, no writes on viewing, the separate day gallery closed on every day it opens, each picture listed once, a tapped photo embedded and undone, and restart at phone width in light/dark sage passed")
|
||||
print("Diary scrolling: the wheel scrolls a long entry through its photos and back without moving the page, a sideways swipe leaves it, and the wheel and a vertical drag move the separate gallery grid, where a drag embeds nothing and a tap on a photo scrolled into view embeds it")
|
||||
+14
-14
@@ -20,7 +20,7 @@
|
||||
},
|
||||
{
|
||||
"commit": "1cb9df183089a77c8a16448a556186f30b261a98",
|
||||
"dependencies": {"kryon": "pe41f6b4f7297cb1c"},
|
||||
"dependencies": {"kryon": "p7213416dd56f3a5c"},
|
||||
"id": "p1b13dda539ed2a39",
|
||||
"name": "Kss",
|
||||
"ref": "master",
|
||||
@@ -28,7 +28,7 @@
|
||||
},
|
||||
{
|
||||
"commit": "bad2caaa84ef3eae61e40c99bf572d2b060d0ca2",
|
||||
"dependencies": {"kryon": "pe41f6b4f7297cb1c"},
|
||||
"dependencies": {"kryon": "p7213416dd56f3a5c"},
|
||||
"id": "p20eb23d3e6db3711",
|
||||
"name": "Game2D",
|
||||
"ref": "master",
|
||||
@@ -36,7 +36,7 @@
|
||||
},
|
||||
{
|
||||
"commit": "b1e4ed4b0f7283e2b7a8ae7740f283d5729b3b04",
|
||||
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "pe41f6b4f7297cb1c"},
|
||||
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "p7213416dd56f3a5c"},
|
||||
"id": "p4158fd507db6061e",
|
||||
"name": "Apps",
|
||||
"ref": "b1e4ed4b0f7283e2b7a8ae7740f283d5729b3b04",
|
||||
@@ -44,7 +44,7 @@
|
||||
},
|
||||
{
|
||||
"commit": "2f4b01e4e4a43c30da4f6ecdd1af1ba8936a9380",
|
||||
"dependencies": {"daochi_client": "p9972fcdd2d5ba999", "kryon": "pe41f6b4f7297cb1c", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
|
||||
"dependencies": {"daochi_client": "p9972fcdd2d5ba999", "kryon": "p7213416dd56f3a5c", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
|
||||
"id": "p52832b02b35a796d",
|
||||
"name": "Entity",
|
||||
"ref": "master",
|
||||
@@ -67,6 +67,14 @@
|
||||
"ref": "master",
|
||||
"url": "https://github.com/ziranlang/oqs.git"
|
||||
},
|
||||
{
|
||||
"commit": "5b2bfb71fef6111fcbaeb0446ba02ab6b0cd8f89",
|
||||
"dependencies": {"raylib": "p5a77c9c35110e925"},
|
||||
"id": "p7213416dd56f3a5c",
|
||||
"name": "kryon",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/kryonlabs/kryon.git"
|
||||
},
|
||||
{
|
||||
"commit": "f5f0a19a5dc6c14a49adb3cd63ea79a60f6ba77b",
|
||||
"dependencies": {},
|
||||
@@ -95,7 +103,7 @@
|
||||
},
|
||||
{
|
||||
"commit": "3f888653b6b97010163d824c4cc72476be3214f3",
|
||||
"dependencies": {"kryon": "pe41f6b4f7297cb1c"},
|
||||
"dependencies": {"kryon": "p7213416dd56f3a5c"},
|
||||
"id": "pab5377a2950368a2",
|
||||
"name": "plot",
|
||||
"ref": "master",
|
||||
@@ -126,14 +134,6 @@
|
||||
"ref": "master",
|
||||
"url": "https://github.com/kryonlabs/mingcute.git"
|
||||
},
|
||||
{
|
||||
"commit": "cb10924389a7181a633ddcca6423cd286f0cfa6f",
|
||||
"dependencies": {"raylib": "p5a77c9c35110e925"},
|
||||
"id": "pe41f6b4f7297cb1c",
|
||||
"name": "kryon",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/kryonlabs/kryon.git"
|
||||
},
|
||||
{
|
||||
"commit": "58626f682afbc2e3467e8c2e5b37f7f29d89ed99",
|
||||
"dependencies": {},
|
||||
@@ -154,7 +154,7 @@
|
||||
}
|
||||
],
|
||||
"root": {
|
||||
"dependencies": {"apps": "p4158fd507db6061e", "crypto": "pc23fbf455e97614d", "curl": "pd4bcd11b7d623073", "daochi_client": "p9972fcdd2d5ba999", "entity": "p52832b02b35a796d", "game2d": "p20eb23d3e6db3711", "kryon": "pe41f6b4f7297cb1c", "kss": "p1b13dda539ed2a39", "liboqs": "pecdb097af6ab16f7", "mingcute": "pe1027b9d16704793", "monocypher": "p809b4d31a48625a3", "oqs": "p7098ac9cd92f7e5f", "plot": "pab5377a2950368a2", "practices": "p9079dde0fcc11248", "qrcode": "p0dfa70137405b096", "rini": "p09fa77e94b0dfc6c", "sqlite": "peaa43c4b7ef72edf"},
|
||||
"dependencies": {"apps": "p4158fd507db6061e", "crypto": "pc23fbf455e97614d", "curl": "pd4bcd11b7d623073", "daochi_client": "p9972fcdd2d5ba999", "entity": "p52832b02b35a796d", "game2d": "p20eb23d3e6db3711", "kryon": "p7213416dd56f3a5c", "kss": "p1b13dda539ed2a39", "liboqs": "pecdb097af6ab16f7", "mingcute": "pe1027b9d16704793", "monocypher": "p809b4d31a48625a3", "oqs": "p7098ac9cd92f7e5f", "plot": "pab5377a2950368a2", "practices": "p9079dde0fcc11248", "qrcode": "p0dfa70137405b096", "rini": "p09fa77e94b0dfc6c", "sqlite": "peaa43c4b7ef72edf"},
|
||||
"name": "Inbe"
|
||||
},
|
||||
"toolchain": {
|
||||
|
||||
Reference in new issue
Block a user