From 3088078ff894988461f0a0cc4a65044c5e9d9b12 Mon Sep 17 00:00:00 2001 From: croneter Date: Sat, 15 Sep 2018 15:46:06 +0200 Subject: [PATCH] Fix empty pin entry field showing up --- resources/lib/plex_tv.py | 16 +++++++++++++++- resources/lib/windows/userselect.py | 10 +++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/resources/lib/plex_tv.py b/resources/lib/plex_tv.py index b7e300db..7493491a 100644 --- a/resources/lib/plex_tv.py +++ b/resources/lib/plex_tv.py @@ -18,8 +18,22 @@ LOG = getLogger('PLEX.plex_tv') class HomeUser(utils.AttributeDict): """ 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): diff --git a/resources/lib/windows/userselect.py b/resources/lib/windows/userselect.py index 7154a66e..fccd759e 100644 --- a/resources/lib/windows/userselect.py +++ b/resources/lib/windows/userselect.py @@ -59,7 +59,7 @@ class UserSelectWindow(kodigui.BaseWindow): if 57 < ID < 68: if not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(self.PIN_ENTRY_GROUP_ID)): item = self.userList.getSelectedItem() - if not item.dataSource.protected: + if not item.dataSource.isProtected: return self.setFocusId(self.PIN_ENTRY_GROUP_ID) self.pinEntryClicked(ID + 142) @@ -67,7 +67,7 @@ class UserSelectWindow(kodigui.BaseWindow): elif 142 <= ID <= 149: # JumpSMS action if not xbmc.getCondVisibility('ControlGroup({0}).HasFocus(0)'.format(self.PIN_ENTRY_GROUP_ID)): item = self.userList.getSelectedItem() - if not item.dataSource.protected: + if not item.dataSource.isProtected: return self.setFocusId(self.PIN_ENTRY_GROUP_ID) self.pinEntryClicked(ID + 60) @@ -84,7 +84,7 @@ class UserSelectWindow(kodigui.BaseWindow): def onClick(self, controlID): if controlID == self.USER_LIST_ID: item = self.userList.getSelectedItem() - if item.dataSource.protected: + if item.dataSource.isProtected: self.setFocusId(self.PIN_ENTRY_GROUP_ID) else: self.userSelected(item) @@ -116,8 +116,8 @@ class UserSelectWindow(kodigui.BaseWindow): mli = kodigui.ManagedListItem(user.title, user.title[0].upper(), data_source=user) mli.setProperty('pin', user.title) # mli.setProperty('back.image', back) - mli.setProperty('protected', user.protected == '1' and '1' or '') - mli.setProperty('admin', user.admin == '1' and '1' or '') + mli.setProperty('protected', user.isProtected and '1' or '') + mli.setProperty('admin', user.isAdmin and '1' or '') items.append(mli) self.userList.addItems(items)