Fix empty pin entry field showing up

This commit is contained in:
croneter 2018-09-15 15:46:06 +02:00
parent b5524d1206
commit 3088078ff8
2 changed files with 20 additions and 6 deletions

View file

@ -18,8 +18,22 @@ LOG = getLogger('PLEX.plex_tv')
class HomeUser(utils.AttributeDict): class HomeUser(utils.AttributeDict):
""" """
Turns an etree xml answer into an object with attributes Turns an etree xml answer into an object with attributes
Adds the additional properties:
isProtected
isAdmin
isManaged
""" """
pass @property
def isProtected(self):
return self.protected == '1'
@property
def isAdmin(self):
return self.admin == '1'
@property
def isManaged(self):
return self.restricted == '1'
def homeuser_to_settings(user): def homeuser_to_settings(user):

View file

@ -59,7 +59,7 @@ class UserSelectWindow(kodigui.BaseWindow):
if 57 < ID < 68: if 57 < ID < 68:
if not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(self.PIN_ENTRY_GROUP_ID)): if not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(self.PIN_ENTRY_GROUP_ID)):
item = self.userList.getSelectedItem() item = self.userList.getSelectedItem()
if not item.dataSource.protected: if not item.dataSource.isProtected:
return return
self.setFocusId(self.PIN_ENTRY_GROUP_ID) self.setFocusId(self.PIN_ENTRY_GROUP_ID)
self.pinEntryClicked(ID + 142) self.pinEntryClicked(ID + 142)
@ -67,7 +67,7 @@ class UserSelectWindow(kodigui.BaseWindow):
elif 142 <= ID <= 149: # JumpSMS action elif 142 <= ID <= 149: # JumpSMS action
if not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(self.PIN_ENTRY_GROUP_ID)): if not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(self.PIN_ENTRY_GROUP_ID)):
item = self.userList.getSelectedItem() item = self.userList.getSelectedItem()
if not item.dataSource.protected: if not item.dataSource.isProtected:
return return
self.setFocusId(self.PIN_ENTRY_GROUP_ID) self.setFocusId(self.PIN_ENTRY_GROUP_ID)
self.pinEntryClicked(ID + 60) self.pinEntryClicked(ID + 60)
@ -84,7 +84,7 @@ class UserSelectWindow(kodigui.BaseWindow):
def onClick(self, controlID): def onClick(self, controlID):
if controlID == self.USER_LIST_ID: if controlID == self.USER_LIST_ID:
item = self.userList.getSelectedItem() item = self.userList.getSelectedItem()
if item.dataSource.protected: if item.dataSource.isProtected:
self.setFocusId(self.PIN_ENTRY_GROUP_ID) self.setFocusId(self.PIN_ENTRY_GROUP_ID)
else: else:
self.userSelected(item) self.userSelected(item)
@ -116,8 +116,8 @@ class UserSelectWindow(kodigui.BaseWindow):
mli = kodigui.ManagedListItem(user.title, user.title[0].upper(), data_source=user) mli = kodigui.ManagedListItem(user.title, user.title[0].upper(), data_source=user)
mli.setProperty('pin', user.title) mli.setProperty('pin', user.title)
# mli.setProperty('back.image', back) # mli.setProperty('back.image', back)
mli.setProperty('protected', user.protected == '1' and '1' or '') mli.setProperty('protected', user.isProtected and '1' or '')
mli.setProperty('admin', user.admin == '1' and '1' or '') mli.setProperty('admin', user.isAdmin and '1' or '')
items.append(mli) items.append(mli)
self.userList.addItems(items) self.userList.addItems(items)