Skip to content

Commit 126aaba

Browse files
pannalruuk
authored andcommitted
Add advanced setting to go back instantly instead of showing the header in scrolled views
* highlight the current section in the section list in fastBack mode in a scrolled view when using BACK
1 parent f14f154 commit 126aaba

File tree

10 files changed

+66
-29
lines changed

10 files changed

+66
-29
lines changed

lib/util.py

+1
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ class AdvancedSettings(object):
468468
("kodi_skip_stepping", False),
469469
("auto_seek", True),
470470
("dynamic_timeline_seek", False),
471+
("fast_back", False),
471472
)
472473

473474
def __init__(self):

lib/windows/episodes.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ def onAction(self, action):
199199
return
200200

201201
elif action == xbmcgui.ACTION_NAV_BACK:
202-
if not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(self.OPTIONS_GROUP_ID)) or not controlID:
202+
if (not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(
203+
self.OPTIONS_GROUP_ID)) or not controlID) and \
204+
not util.advancedSettings.fastBack:
203205
if self.getProperty('on.extras'):
204206
self.setFocusId(self.OPTIONS_GROUP_ID)
205207
return

lib/windows/home.py

+29-20
Original file line numberDiff line numberDiff line change
@@ -437,28 +437,37 @@ def onAction(self, action):
437437
self.hubItemClicked(controlID, auto_play=True)
438438
return
439439

440-
if action in(xbmcgui.ACTION_NAV_BACK, xbmcgui.ACTION_CONTEXT_MENU):
441-
if not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(self.OPTIONS_GROUP_ID)) \
442-
and util.getGlobalProperty('off.sections'):
443-
self.lastNonOptionsFocusID = self.lastFocusID
444-
self.setFocusId(self.OPTIONS_GROUP_ID)
445-
return
446-
elif not action == xbmcgui.ACTION_NAV_BACK \
447-
and xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(self.OPTIONS_GROUP_ID)) \
448-
and util.getGlobalProperty('off.sections') and self.lastNonOptionsFocusID:
449-
self.setFocusId(self.lastNonOptionsFocusID)
450-
self.lastNonOptionsFocusID = None
451-
return
440+
if action in(xbmcgui.ACTION_NAV_BACK, xbmcgui.ACTION_PREVIOUS_MENU, xbmcgui.ACTION_CONTEXT_MENU):
441+
optionsFocused = xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(self.OPTIONS_GROUP_ID))
442+
offSections = util.getGlobalProperty('off.sections')
443+
if action in (xbmcgui.ACTION_NAV_BACK, xbmcgui.ACTION_PREVIOUS_MENU):
444+
if self.getFocusId() == self.USER_LIST_ID:
445+
self.setFocusId(self.USER_BUTTON_ID)
446+
return
447+
elif self.getFocusId() == self.SERVER_LIST_ID:
448+
self.setFocusId(self.SERVER_BUTTON_ID)
449+
return
452450

453-
if action in(xbmcgui.ACTION_NAV_BACK, xbmcgui.ACTION_PREVIOUS_MENU):
454-
if self.getFocusId() == self.USER_LIST_ID:
455-
self.setFocusId(self.USER_BUTTON_ID)
456-
return
457-
elif self.getFocusId() == self.SERVER_LIST_ID:
458-
self.setFocusId(self.SERVER_BUTTON_ID)
459-
return
451+
if util.advancedSettings.fastBack and not optionsFocused and offSections \
452+
and self.lastFocusID not in (self.USER_BUTTON_ID, self.SERVER_BUTTON_ID,
453+
self.SEARCH_BUTTON_ID, self.SECTION_LIST_ID):
454+
self.setProperty('hub.focus', '0')
455+
self.setFocusId(self.SECTION_LIST_ID)
456+
return
457+
458+
if action in(xbmcgui.ACTION_NAV_BACK, xbmcgui.ACTION_CONTEXT_MENU):
459+
if not optionsFocused and offSections \
460+
and (not util.advancedSettings.fastBack or action == xbmcgui.ACTION_CONTEXT_MENU):
461+
self.lastNonOptionsFocusID = self.lastFocusID
462+
self.setFocusId(self.OPTIONS_GROUP_ID)
463+
return
464+
elif action == xbmcgui.ACTION_CONTEXT_MENU and optionsFocused and offSections \
465+
and self.lastNonOptionsFocusID:
466+
self.setFocusId(self.lastNonOptionsFocusID)
467+
self.lastNonOptionsFocusID = None
468+
return
460469

461-
if not self.confirmExit():
470+
if action in(xbmcgui.ACTION_NAV_BACK, xbmcgui.ACTION_PREVIOUS_MENU) and not self.confirmExit():
462471
return
463472
except:
464473
util.ERROR()

lib/windows/library.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,8 @@ def onAction(self, action):
521521
return
522522

523523
elif action in(xbmcgui.ACTION_NAV_BACK, xbmcgui.ACTION_CONTEXT_MENU):
524-
if not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(self.OPTIONS_GROUP_ID)):
524+
if not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(self.OPTIONS_GROUP_ID)) and \
525+
(not util.advancedSettings.fastBack or action == xbmcgui.ACTION_CONTEXT_MENU):
525526
if xbmc.getCondVisibility('Integer.IsGreater(Container(101).ListItem.Property(index),5)'):
526527
self.setFocusId(self.OPTIONS_GROUP_ID)
527528
return

lib/windows/preplay.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ def onAction(self, action):
100100
self.setFocusId(self.lastFocusID)
101101

102102
if action in(xbmcgui.ACTION_NAV_BACK, xbmcgui.ACTION_CONTEXT_MENU):
103-
if not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(self.OPTIONS_GROUP_ID)):
103+
if not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(
104+
self.OPTIONS_GROUP_ID)) and \
105+
(not util.advancedSettings.fastBack or action == xbmcgui.ACTION_CONTEXT_MENU):
104106
if self.getProperty('on.extras'):
105107
self.lastNonOptionsFocusID = self.lastFocusID
106108
self.setFocusId(self.OPTIONS_GROUP_ID)

lib/windows/subitems.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ def onAction(self, action):
178178
return
179179

180180
elif action in(xbmcgui.ACTION_NAV_BACK, xbmcgui.ACTION_CONTEXT_MENU):
181-
if not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(self.OPTIONS_GROUP_ID)):
181+
if not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(
182+
self.OPTIONS_GROUP_ID)) and \
183+
(not util.advancedSettings.fastBack or action == xbmcgui.ACTION_CONTEXT_MENU):
182184
if self.getProperty('on.extras'):
183185
self.setFocusId(self.OPTIONS_GROUP_ID)
184186
return

lib/windows/videoplayer.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,12 @@ def onAction(self, action):
9999
self.resetPassoutProtection()
100100
if action in(xbmcgui.ACTION_NAV_BACK, xbmcgui.ACTION_CONTEXT_MENU):
101101
if not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(self.OPTIONS_GROUP_ID)):
102-
self.lastNonOptionsFocusID = self.lastFocusID
103-
self.setFocusId(self.OPTIONS_GROUP_ID)
104-
return
102+
if not util.advancedSettings.fastBack or action == xbmcgui.ACTION_CONTEXT_MENU:
103+
self.lastNonOptionsFocusID = self.lastFocusID
104+
self.setFocusId(self.OPTIONS_GROUP_ID)
105+
return
105106
else:
106-
if self.lastNonOptionsFocusID:
107+
if self.lastNonOptionsFocusID and action == xbmcgui.ACTION_CONTEXT_MENU:
107108
self.setFocusId(self.lastNonOptionsFocusID)
108109
self.lastNonOptionsFocusID = None
109110
return

resources/language/English/strings.po

+8
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,14 @@ msgctxt "#32466"
963963
msgid "Automatically seek selected position after a delay"
964964
msgstr ""
965965

966+
msgctxt "#32467"
967+
msgid "User Interface"
968+
msgstr ""
969+
966970
msgctxt "#32471"
967971
msgid "Use Plex/Kodi steps for timeline"
972+
msgstr ""
973+
974+
msgctxt "#32485"
975+
msgid "Go back instantly with the previous menu action in scrolled views"
968976
msgstr ""

resources/language/German/strings.po

+9-1
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,14 @@ msgctxt "#32466"
962962
msgid "Automatically seek to the selected timeline position after a second"
963963
msgstr "Nach Verzögerung automatisch zur aktuell gewählten Position springen"
964964

965+
msgctxt "#32467"
966+
msgid "User Interface"
967+
msgstr "Benutzeroberfläche"
968+
965969
msgctxt "#32471"
966970
msgid "Use Plex/Kodi steps for timeline"
967-
msgstr "Plex/Kodi-Skip-Schritte für die Zeitachse verwenden"
971+
msgstr "Plex/Kodi-Skip-Schritte für die Zeitachse verwenden"
972+
973+
msgctxt "#32485"
974+
msgid "Go back instantly with the previous menu action in scrolled views"
975+
msgstr "Mit der Previous-Menu-Aktion In gescrollten Ansichten sofort zurückgehen"

resources/settings.xml

+3
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@
1313
<setting id="kodi_skip_stepping" type="bool" label="32465" default="false" />
1414
<setting id="dynamic_timeline_seek" type="bool" label="32471" default="false" />
1515
</category>
16+
<category label="32467">
17+
<setting id="fast_back" type="bool" label="32485" default="false" />
18+
</category>
1619
</settings>

0 commit comments

Comments
 (0)