Watch for and capture escaped button presses (#57)

* Watch for and capture escaped button presses

* remove debug prints
This commit is contained in:
Nick Bisby 2019-07-30 23:31:48 -05:00 committed by GitHub
parent 4652c742ef
commit 528deec6b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 2 deletions

View File

@ -22,7 +22,7 @@ sub updateSize()
m.top.translation = [border, border + 115]
itemWidth = (dimensions["width"] - border*2) / m.top.rowSize
itemHeight = dimensions["height"] / 2
itemHeight = itemWidth / 2
m.top.visible = true

View File

@ -404,6 +404,7 @@ sub ShowTVShowOptions(library)
"SortOrder": sort_order })
item_grid.objects = item_list
item_grid.observeField("escapeButton", port)
item_grid.observeField("itemSelected", port)
pager = scene.findNode("pager")
@ -450,7 +451,18 @@ sub ShowTVShowOptions(library)
while true
msg = wait(0, port)
if nodeEventQ(msg, "escape") and msg.getNode() = "pager"
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed() then
return
else if nodeEventQ(msg, "escapeButton")
node = msg.getRoSGNode()
if node.escapeButton = "down"
pager.setFocus(true)
pager.getChild(0).setFocus(true)
else if node.escapeButton = "options"
sidepanel.visible = true
sidepanel.findNode("panelList").setFocus(true)
end if
else if nodeEventQ(msg, "escape") and msg.getNode() = "pager"
item_grid.setFocus(true)
else if nodeEventQ(msg, "escape") and msg.getNode() = "options"
item_grid.setFocus(true)
@ -578,6 +590,7 @@ sub ShowCollections(library)
"SortOrder": sort_order })
item_grid.objects = item_list
item_grid.observeField("escapeButton", port)
item_grid.observeField("itemSelected", port)
pager = scene.findNode("pager")
@ -626,6 +639,15 @@ sub ShowCollections(library)
msg = wait(0, port)
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed() then
return
else if nodeEventQ(msg, "escapeButton")
node = msg.getRoSGNode()
if node.escapeButton = "down"
pager.setFocus(true)
pager.getChild(0).setFocus(true)
else if node.escapeButton = "options"
sidepanel.visible = true
sidepanel.findNode("panelList").setFocus(true)
end if
else if nodeEventQ(msg, "escape") and msg.getNode() = "pager"
item_grid.setFocus(true)
else if nodeEventQ(msg, "escape") and msg.getNode() = "options"