Make home button close user selection dialog

This commit is contained in:
croneter 2018-09-15 15:07:57 +02:00
parent 6a32fd2c33
commit 82a7e021ef
2 changed files with 18 additions and 4 deletions

View file

@ -237,7 +237,7 @@ class UserClient(Thread):
plextoken = utils.settings('plexToken')
if plextoken:
LOG.info("Trying to connect to plex.tv to get a user list")
user = userselect.start()
user, aborted = userselect.start()
if not user:
# FAILURE: Something went wrong, try again
self.auth = True

View file

@ -40,11 +40,12 @@ class UserSelectWindow(kodigui.BaseWindow):
USER_LIST_ID = 101
PIN_ENTRY_GROUP_ID = 400
SHUTDOWN_BUTTON_ID = 500 # Todo: DELETE
HOME_BUTTON_ID = 500
def __init__(self, *args, **kwargs):
self.task = None
self.user = None
self.aborted = False
kodigui.BaseWindow.__init__(self, *args, **kwargs)
def onFirstInit(self):
@ -89,6 +90,8 @@ class UserSelectWindow(kodigui.BaseWindow):
self.userSelected(item)
elif 200 < controlID < 212:
self.pinEntryClicked(controlID)
elif controlID == self.HOME_BUTTON_ID:
self.home_button_clicked()
def onFocus(self, controlID):
if controlID == self.USER_LIST_ID:
@ -126,6 +129,14 @@ class UserSelectWindow(kodigui.BaseWindow):
finally:
self.setProperty('busy', '')
def home_button_clicked(self):
"""
Action taken if user clicked the home button
"""
self.user = None
self.aborted = True
self.doClose()
def pinEntryClicked(self, controlID):
item = self.userList.getSelectedItem()
if item.getProperty('editing.pin'):
@ -182,10 +193,13 @@ def start():
Returns
=======
tuple (user, aborted)
user : HomeUser
Or None if user switch failed or aborted by the user)
aborted : bool
True if the user cancelled the dialog
"""
w = UserSelectWindow.open()
user = w.user
user, aborted = w.user, w.aborted
del w
return user
return user, aborted