NT Device: BookMap and PageBrowser - #12579
Conversation
|
I think this may be based on a slightly older version of a PR (or at least includes its commits) that changed slightly before it was merged? |
is this about the home event? I forgot about it. I'll remove it later. |
|
That jumps out, but as such I don't know what else might be slightly outdated, which isn't good. ;-) |
|
Then i am not sure what you are referring to. |
|
That's exactly the point. I don't know. Or are you trying to say that none of these commits come from other PRs and they merely happen to look similar? |
|
well I guess I am going to have to plead ignorance here because I am completely baffled.
I suppose so, what do they look similar to? I mean besides, the home event (which incidentally predates the other one) nothing (as far as I know), comes from anywhere else. |
|
You can base a branch on another branch, or import (cherry pick) commits from another branch. I thought that's what had happened here. |
| Under the pages, these indicators may be shown: | ||
| If statistics are enabled, black bars indicate pages that have already been read (gray bars for pages read in the current session). The height of these bars varies based on the time spent reading each page. | ||
| Chapters are indicated above the pages they cover. | ||
| Below the pages, the following indicators may appear |
| Any multiswipe will close the page browser.]]) | ||
| elseif Device:hasKeyboard() then | ||
| text = _([[ | ||
| Use settings in this menu to change the number of columns and rows to be shown, whether to display page numbers and, different chapter-levels in bottom ribbon. |
There was a problem hiding this comment.
| Use settings in this menu to change the number of columns and rows to be shown, whether to display page numbers and, different chapter-levels in bottom ribbon. | |
| The settings can be used to change the number of rows and columns, whether to display page numbers, and to display different chapter-levels in the bottom ribbon. |
| text = _([[ | ||
| Use settings in this menu to change the number of columns and rows to be shown, whether to display page numbers and, different chapter-levels in bottom ribbon. | ||
|
|
||
| Press Shift+Up to move up by one row, or LPgBack/RPgBack to move one screen. |
There was a problem hiding this comment.
Are those the going user friendly(ish) terms as will also be used in the user guide by @offset-torque?
There was a problem hiding this comment.
We only use the specific terms "rows" and "columns" in the page browser section of the guide. As they are kept here, I don't see a problem. Please point out if I missed something Frenzie, this PR view is still a bit foreign to me.
There was a problem hiding this comment.
I meant the LPgBack/RPgBack in the line I commented on. It's somewhat self-explanatory as left page back and right page back, but I'm not sure if it's sufficiently so.
There was a problem hiding this comment.
Ok now I see. So we are still playing the "cryptic buttons" game. Those buttons have much more clearer official names and I will use these names in our guide of course. I can't say what to do here but I suggest avoiding this camel-case-variable-like naming especially in a help text. When I searched for "LPgBack" to check, Google brought me "liquefied petroleum gas back pressure check valves" so that's not even a searchable word.
There was a problem hiding this comment.
Agreed. I figured maybe they came from the Kindle manual.
| Select a thumbnail to read this page.]]) | ||
| elseif Device:hasScreenKB() then | ||
| text = _([[ | ||
| Use settings in this menu to change the number of columns and rows to be shown, whether to display page numbers and, different chapter-levels in bottom ribbon. |
There was a problem hiding this comment.
|
|
||
| Press Shift+Down to move down by one row, or LPgFwd/RPgFwd to move one screen. | ||
|
|
||
| Select a thumbnail to read this page.]]) |
There was a problem hiding this comment.
It feels like more of a "that page" than a "this page," doesn't it?
|
There are a bunch of English typos, ie. invisiable or foucs (yes, I do give a fouc :)) Also, on devices/platforms where we won't be using keyboard navigation, I'd like to request the focus_layout to not be populated at all. |
| local toc_title = FrameContainer:new{ | ||
| margin = 0, | ||
| padding = Size.border.thin * 3, |
There was a problem hiding this comment.
Perhaps we should indeed look into this codespell thing, so obvious ones like invisible will be caught by the machine (cf. #12566) |
References koreader#12579 (comment)
|
hey @comphilip I understand that you might not have time to make this better but, could you look at fixing the issues pointed out here? also the one about the sticky focus I mentioned in #11908 (comment) (the first screenshot). Again thanks for everything. |
|
@Commodore64user Take a look. I can't think out a better solution yet. |
|
I expect @NiLuJe could provide better advice de637d0 😊😜 Also, not sure if you have seen this one as well #12579 (comment) @comphilip |
| -- NT: update layout | ||
| -- remove existing BookMapRow from layout | ||
| if #self.layout > self.nb_rows then | ||
| for i = self.nb_rows + 1, #self.layout do | ||
| self.layout[i] = nil | ||
| end | ||
| end | ||
| -- add new BookMapRow layout | ||
| for _, focus_row in ipairs(row.focus_layout) do | ||
| table.insert(self.layout, focus_row) | ||
| end | ||
|
|
There was a problem hiding this comment.
@poire-z is this the bit you say you would prefer not to be loaded on touch devices? i.e would this do?
-- NT: update layout
if not Device:isTouchDevice() then
-- remove existing BookMapRow from layout
if #self.layout > self.nb_rows then
for i = self.nb_rows + 1, #self.layout do
self.layout[i] = nil
end
end
-- add new BookMapRow layout
for _, focus_row in ipairs(row.focus_layout) do
table.insert(self.layout, focus_row)
end
endThere was a problem hiding this comment.
One of the bitS.
Yes, this and its brothers would do.
Rather create a self.build_focus_layout = true/false early, so if we ever need to change the condition, it will be in a single place.
There was a problem hiding this comment.
If you could single them out, it would make my job easier ;)
There was a problem hiding this comment.
Well, I'm not re-reading the whole thing.
I'd like anything that build some stuff and table.insert() it into a something_layout to be wrapped by this if self.build_focus_layout then.
Also, I think the rendering/shifting issue with using the border to highlight the focused item - cf #12583 (comment) - should be fixed.
ie FrameContainer could have a draw_only_border that would not interact with the sizing, but would just be drawn - outside or inside, I dunno, possibly overflowing on the inner content or outer neighbours, avoiding that being the job of the designer to provide some extra margin or padding.
There was a problem hiding this comment.
The VirtualKeyboard keys have a highlight frame that's drawn inside, as a point of reference (hell, that might even be a FrameContainer feature, can't recall ;p).
There was a problem hiding this comment.
that might be the (your) inner_border I mentionned yesterday :)
There was a problem hiding this comment.
I believe the whole wrap business is done (I hope I didn't miss anything), could you look into that border thing @poire-z, I have no clue what's going on there... please. ;)
There was a problem hiding this comment.
I spent a few hours today working on adjusting the bookmapwidget from this PR, I fixed the border thing (you'll have to tell later if and how thiner we can go than 3*Size.border.thin).
Haven't yet looked at the PageBrowser widget.
So, good if you're done - don't add stuff to this PR so we don't conflict.
cfd8a0c to
34cfca3
Compare
|
Been trying it to see how much I could help without drowning. Just some notes for now:
|
|
@poire-z right now I can only answer your last point
mmm, using a touch screen? The thing to remember is that, this is not adding support for non-touch devices in general, it is adding it to non-touch devices that have D-Pads and can spare them to be used for other stuff besides core functionality (i.e |
|
What I see in the changes to bookmapwidget.lua is that: My question is: are there devices/configurations where people will get the first but not the second ? |
This comment was marked as off-topic.
This comment was marked as off-topic.
Well, let's not do that yet. |
|
Dear @poire-z, we are all in tenterhooks waiting for your contribution, in the meantime, could you please rebase this (I don't want to do it so as not to mess up with your stuff) so I can easily re-apply these changes to a 2024.11-44 build? |
|
Well, I have no real idea how this could happen. koreader/frontend/ui/widget/buttondialog.lua Lines 281 to 285 in 9dbcde4 |
neither makes a difference, I also don't think it calls that anyway, as the key event used is koreader/frontend/ui/widget/buttondialog.lua Lines 287 to 293 in 9dbcde4 |
|
|
in any case, "ui" or "fast" don't change anything. |
Check if the extra bits make it into a screenshot (that'll rule out a simpler paint snafu). |
|
Nope, it clears itself when one tries to capture a screenshot (to be more precise, it clears with any non-modifier key press), which is why i had to take a real photograph of the screen in #12579 (comment) |
|
Check the logs (and possibly pepper some good old printf around to help) to compare the widget's position and dimensions against the requested refresh region; there might be a rounding error somewhere (or a float that gets truncated somewhere). On which device is that? (And what's the screen resolution?) |
kindle 3/4 #12579 (comment) 600x800 |
self.movable.dimen = self.movable:getSize()
logger.dbg("ButtonDialog dimensions:",
self.movable.dimen.x,
self.movable.dimen.y,
self.movable.dimen.w,
self.movable.dimen.h
)why is |
|
Where are they 0 ? means x=104.5 and y=155.5 |
Not familiar with the widget OTOH, but some widgets plain don't update their positions at all (pet peeve of mine). Although it's more likely this falls in the other, predominant category, where dimensions are updated during painTo, which is why In any case, as @poire-z just said, you just have to find what's missing a floor call on positions ;) |
|
Given the |
|
had a single bathroom eureka moment... sorted now edit: for those of you, loo-connoisseurs out there #12951 (comment) |
|
thank you @NiLuJe for fixing the certificates (how long will those last?), working now on both k3 and k4. now only waiting on an awesome code review here... ;) |
| -- We will only let them run on useDPadAsActionKeys devices. | ||
| if not Device:hasKeyboard() then |
There was a problem hiding this comment.
Aren't the comment and the check contradictory?
There was a problem hiding this comment.
this was added by comphillip for testing i believe, removing it as no longer needed
| -- PageBrowser still needs some work before we can let it run on non-touch devices with useDPadAsActionKeys | ||
| if Device:hasDPad() and Device:useDPadAsActionKeys() then return end |
There was a problem hiding this comment.
No condition at all ?
In dispatcher just below, you have condition=Device:isTouchDevice() or (Device:hasDPad() and Device:useDPadAsActionKeys())},
There was a problem hiding this comment.
we don't need this stop anymore... or perhaps i don't understand your point.
There was a problem hiding this comment.
Every device will get this menu item ? (= "no condition at all")
What about non-touch but not have/use dpadasactionkeys (which is the condition elsewhere for enabling focus layout).
(My point is the same as all along: all these device caps checks need to be consistent.)
There was a problem hiding this comment.
this was only here when BookMap was available but not PageBrowser on kindle, nobody else enters this realm. we don't need this check anymore since kindle goes all in now. and noone else enters partially.
What about non-touch but not have/use dpadasactionkeys
such device would not be running this code because it would have been already stopped at the door (by the early return)
(My point is the same as all along: all these device caps checks need to be consistent.)
they are, not the exact same, but consistent.
| function BookMapWidget:init() | ||
| -- On touch devices (with keys), we don't really need to navigate focus with keys, | ||
| -- so we should avoid allocating memory to huge data structures. | ||
| self.enable_focus_navigation = not Device:isTouchDevice() and Device:hasDPad() and Device:useDPadAsActionKeys() |
There was a problem hiding this comment.
This condition expects Device:hasDPad() , more than the ones mentionned in a previous comment.
Is that ok ? (if hadDPad is always true when useDPadAsActionKeys, remove it, so all conditions look consistent.)
There was a problem hiding this comment.
mmm... this has been @Frenzie's preference to always use hasDPad and useDPad...
There was a problem hiding this comment.
It is true that useDPadAsActionKeys implies hasDPad but presumably I preferred to have the overview.
| self.key_events = {} | ||
| self.key_events.ScrollRowUp = { { "Up" } } | ||
| self.key_events.ScrollRowDown = { { "Down" } } | ||
| elseif Device:hasScreenKB() or Device:hasKeyboard() then |
There was a problem hiding this comment.
Different from useDPadAsActionKeys here, is that correct ?
(Same in PageBrowser.)
There was a problem hiding this comment.
it is correct. note that if a device is neither isTouchDevice nor useDPad..., it would not be running any of this code, let alone registering key events.
| -- The user has scrolled one page or one row, and the focused widget moved out | ||
| -- of the updated view: forget that focused widget and change it to a widget | ||
| -- in the middle of the new view. | ||
| logger.warn(" scrolled out of view, finding a new focus widget") |
There was a problem hiding this comment.
You can remove my debugging logger.warn() (and their else branch if I added it just for that), there are 4 of them.
| focus_inner_border = true, | ||
| Widget:new{ | ||
| dimen = Geom:new{ | ||
| w = w, -- + 2*self.focus_nav_border, |
There was a problem hiding this comment.
I guess the commented stuff was done while I was experimenting, you can remove it.
| focusable = true, | ||
| focus_border_size = focus_nav_border, | ||
| focus_inner_border = true, | ||
| -- background = Blitbuffer.COLOR_WHITE, |
There was a problem hiding this comment.
I guess the commented stuff was done while I was experimenting, you can remove it.
| return true | ||
| end | ||
|
|
||
| function PageBrowserWidget:_wrapAroundY(dy) |
There was a problem hiding this comment.
May be add a comment above, something like:
-- Override FocusManager internal methods, so we can scroll the view instead of wrap around
|
To be added to the squashed commit message: |
| text = _([[ | ||
| The settings (in this menu) can be used to change the number of rows and columns, whether to display page numbers, and to display different chapter-levels in the bottom ribbon. | ||
|
|
||
| Press Shift+Up to move up by one row, or either previous-page-turn-button to move one screen. | ||
|
|
||
| Press Shift+Down to move down by one row, or either next-page-turn-button to move one screen. | ||
|
|
||
| Press Shift+Press on a thumbnail, to open more options. | ||
|
|
||
| Press Shift+Back closes all instances of Page Browser and Book Map. | ||
|
|
||
| Select a thumbnail to read that page.]]) | ||
| elseif Device:hasScreenKB() then | ||
| text = _([[ | ||
| The settings (in this menu) can be used to change the number of rows and columns, whether to display page numbers, and to display different chapter-levels in the bottom ribbon. | ||
|
|
||
| Press ScreenKB+Up to move up by one row, or either previous-page-turn-button to move one screen. | ||
|
|
||
| Press ScreenKB+Down to move down by one row, or either next-page-turn-button to move one screen. | ||
|
|
||
| Press ScreenKB+Press on a thumbnail, to open more options. | ||
|
|
||
| Press ScreenKB+Back closes all instances of Page Browser and Book Map. | ||
|
|
||
| Select a thumbnail to read that page.]]) |
There was a problem hiding this comment.
I generally say it's important to avoid being smart in localization, but that's in reference to things like plurals. For reusing localization being smart is good.
Something like this:
elseif Device:hasKeyboard() then
local lines = {
_("The settings (in this menu) can be used to change the number of rows and columns, whether to display page numbers, and to display different chapter-levels in the bottom ribbon."),
_("Press Shift+Up to move up by one row, or either previous-page-turn-button to move one screen."),
_("Press Shift+Down to move down by one row, or either next-page-turn-button to move one screen."),
_("Press Shift+Press on a thumbnail, to open more options."),
_("Press Shift+Back closes all instances of Page Browser and Book Map."),
_("Select a thumbnail to read that page.")
}
text = table.concat(lines, "\n\n")
elseif Device:hasScreenKB() then
local lines = {
_("The settings (in this menu) can be used to change the number of rows and columns, whether to display page numbers, and to display different chapter-levels in the bottom ribbon."),
_("Press ScreenKB+Up to move up by one row, or either previous-page-turn-button to move one screen."),
_("Press ScreenKB+Down to move down by one row, or either next-page-turn-button to move one screen."),
_("Press ScreenKB+Press on a thumbnail, to open more options."),
_("Press ScreenKB+Back closes all instances of Page Browser and Book Map."),
_("Select a thumbnail to read that page.")
}
text = table.concat(lines, "\n\n")
end|
@poire-z What precisely needs to be in the commit message? (Or alternatively, can you squash it?) |
And: Thus do we strive to make Kindle great once more. 😂 I would call it, "liberation commit" |
|
Well now that Liberation day has come and kindle has finally been made great again, i would like to take a moment to thank @comphilip and @poire-z for their efforts and relentless dedication to the cause. Many a poire died in the process but hey, they do grow on trees so, there is that ;) |
Have them both usable on non-touch devices. Also: FrameContainer: fix focus border handling, and draw inner border after the content (to prevent it from being overridden by the content bgcolor).



Fix #11908
Changes Berif
BookMapandPageBrowsermenu items available on NT devicesfocus_inner_bordertoFrameContainer, to use inner border as focused style to void focused widget height and width changedBookMapRowwidgetAboutdialog inPageBrowser: describe keyboard shortcutsThis change is