@@ -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 ()
0 commit comments