mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-05-04 00:18:48 +00:00
Workaround for LibreElec bug with edit control (#127)
This commit is contained in:
parent
d41e3d7fe1
commit
4413f469a3
8 changed files with 147 additions and 146 deletions
|
@ -22,8 +22,6 @@ SIGN_IN = 200
|
|||
CANCEL = 201
|
||||
ERROR_TOGGLE = 202
|
||||
ERROR_MSG = 203
|
||||
USER = 204
|
||||
PASSWORD = 205
|
||||
ERROR = {
|
||||
'Invalid': 1,
|
||||
'Empty': 2
|
||||
|
@ -54,14 +52,21 @@ class LoginConnect(xbmcgui.WindowXMLDialog):
|
|||
|
||||
def onInit(self):
|
||||
|
||||
self.user_field = self.getControl(USER)
|
||||
self.user_field = self._add_editcontrol(755, 358, 40, 415)
|
||||
self.setFocus(self.user_field)
|
||||
self.password_field = self.getControl(PASSWORD)
|
||||
self.password_field = self._add_editcontrol(755, 458, 40, 415, password=1)
|
||||
self.signin_button = self.getControl(SIGN_IN)
|
||||
self.remind_button = self.getControl(CANCEL)
|
||||
self.error_toggle = self.getControl(ERROR_TOGGLE)
|
||||
self.error_msg = self.getControl(ERROR_MSG)
|
||||
|
||||
self.user_field.controlUp(self.remind_button)
|
||||
self.user_field.controlDown(self.password_field)
|
||||
self.password_field.controlUp(self.user_field)
|
||||
self.password_field.controlDown(self.signin_button)
|
||||
self.signin_button.controlUp(self.password_field)
|
||||
self.remind_button.controlDown(self.user_field)
|
||||
|
||||
def onClick(self, control):
|
||||
|
||||
if control == SIGN_IN:
|
||||
|
@ -92,6 +97,24 @@ class LoginConnect(xbmcgui.WindowXMLDialog):
|
|||
if action in (ACTION_BACK, ACTION_PARENT_DIR, ACTION_PREVIOUS_MENU):
|
||||
self.close()
|
||||
|
||||
def _add_editcontrol(self, x, y, height, width, password=0):
|
||||
|
||||
media = os.path.join(addon.getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
|
||||
control = xbmcgui.ControlEdit(0, 0, 0, 0,
|
||||
label="User",
|
||||
font="font10",
|
||||
textColor="FF52b54b",
|
||||
disabledColor="FF888888",
|
||||
focusTexture="-",
|
||||
noFocusTexture="-",
|
||||
isPassword=password)
|
||||
control.setPosition(x, y)
|
||||
control.setHeight(height)
|
||||
control.setWidth(width)
|
||||
|
||||
self.addControl(control)
|
||||
return control
|
||||
|
||||
def _login(self, username, password):
|
||||
|
||||
result = self.connect_manager.loginToConnect(username, password)
|
||||
|
|
|
@ -23,8 +23,6 @@ SIGN_IN = 200
|
|||
CANCEL = 201
|
||||
ERROR_TOGGLE = 202
|
||||
ERROR_MSG = 203
|
||||
USER = 204
|
||||
PASSWORD = 205
|
||||
ERROR = {
|
||||
'Invalid': 1,
|
||||
'Empty': 2
|
||||
|
@ -52,7 +50,7 @@ class LoginManual(xbmcgui.WindowXMLDialog):
|
|||
self.server = server
|
||||
|
||||
def set_user(self, user):
|
||||
self.username = user or None
|
||||
self.username = user or {}
|
||||
|
||||
def get_user(self):
|
||||
return self._user
|
||||
|
@ -63,8 +61,8 @@ class LoginManual(xbmcgui.WindowXMLDialog):
|
|||
self.cancel_button = self.getControl(CANCEL)
|
||||
self.error_toggle = self.getControl(ERROR_TOGGLE)
|
||||
self.error_msg = self.getControl(ERROR_MSG)
|
||||
self.user_field = self.getControl(USER)
|
||||
self.password_field = self.getControl(PASSWORD)
|
||||
self.user_field = self._add_editcontrol(755, 458, 40, 415)
|
||||
self.password_field = self._add_editcontrol(755, 558, 40, 415, password=1)
|
||||
|
||||
if self.username:
|
||||
self.user_field.setText(self.username)
|
||||
|
@ -72,6 +70,13 @@ class LoginManual(xbmcgui.WindowXMLDialog):
|
|||
else:
|
||||
self.setFocus(self.user_field)
|
||||
|
||||
self.user_field.controlUp(self.cancel_button)
|
||||
self.user_field.controlDown(self.password_field)
|
||||
self.password_field.controlUp(self.user_field)
|
||||
self.password_field.controlDown(self.signin_button)
|
||||
self.signin_button.controlUp(self.password_field)
|
||||
self.cancel_button.controlDown(self.user_field)
|
||||
|
||||
def onClick(self, control):
|
||||
|
||||
if control == SIGN_IN:
|
||||
|
@ -101,6 +106,24 @@ class LoginManual(xbmcgui.WindowXMLDialog):
|
|||
if action in (ACTION_BACK, ACTION_PARENT_DIR, ACTION_PREVIOUS_MENU):
|
||||
self.close()
|
||||
|
||||
def _add_editcontrol(self, x, y, height, width, password=0):
|
||||
|
||||
media = os.path.join(addon.getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
|
||||
control = xbmcgui.ControlEdit(0, 0, 0, 0,
|
||||
label="User",
|
||||
font="font10",
|
||||
textColor="FF52b54b",
|
||||
disabledColor="FF888888",
|
||||
focusTexture="-",
|
||||
noFocusTexture="-",
|
||||
isPassword=password)
|
||||
control.setPosition(x, y)
|
||||
control.setHeight(height)
|
||||
control.setWidth(width)
|
||||
|
||||
self.addControl(control)
|
||||
return control
|
||||
|
||||
def _login(self, username, password):
|
||||
|
||||
try:
|
||||
|
|
|
@ -24,8 +24,6 @@ CONNECT = 200
|
|||
CANCEL = 201
|
||||
ERROR_TOGGLE = 202
|
||||
ERROR_MSG = 203
|
||||
HOST = 204
|
||||
PORT = 205
|
||||
ERROR = {
|
||||
'Invalid': 1,
|
||||
'Empty': 2
|
||||
|
@ -59,12 +57,19 @@ class ServerManual(xbmcgui.WindowXMLDialog):
|
|||
self.cancel_button = self.getControl(CANCEL)
|
||||
self.error_toggle = self.getControl(ERROR_TOGGLE)
|
||||
self.error_msg = self.getControl(ERROR_MSG)
|
||||
self.host_field = self.getControl(HOST)
|
||||
self.port_field = self.getControl(PORT)
|
||||
self.host_field = self._add_editcontrol(755, 458, 40, 415)
|
||||
self.port_field = self._add_editcontrol(755, 558, 40, 415)
|
||||
|
||||
self.port_field.setText('8096')
|
||||
self.setFocus(self.host_field)
|
||||
|
||||
self.host_field.controlUp(self.cancel_button)
|
||||
self.host_field.controlDown(self.port_field)
|
||||
self.port_field.controlUp(self.host_field)
|
||||
self.port_field.controlDown(self.connect_button)
|
||||
self.connect_button.controlUp(self.port_field)
|
||||
self.cancel_button.controlDown(self.host_field)
|
||||
|
||||
def onClick(self, control):
|
||||
|
||||
if control == CONNECT:
|
||||
|
@ -94,6 +99,23 @@ class ServerManual(xbmcgui.WindowXMLDialog):
|
|||
if action in (ACTION_BACK, ACTION_PARENT_DIR, ACTION_PREVIOUS_MENU):
|
||||
self.close()
|
||||
|
||||
def _add_editcontrol(self, x, y, height, width):
|
||||
|
||||
media = os.path.join(addon.getAddonInfo('path'), 'resources', 'skins', 'default', 'media')
|
||||
control = xbmcgui.ControlEdit(0, 0, 0, 0,
|
||||
label="User",
|
||||
font="font10",
|
||||
textColor="FF52b54b",
|
||||
disabledColor="FF888888",
|
||||
focusTexture="-",
|
||||
noFocusTexture="-")
|
||||
control.setPosition(x, y)
|
||||
control.setHeight(height)
|
||||
control.setWidth(width)
|
||||
|
||||
self.addControl(control)
|
||||
return control
|
||||
|
||||
def _connect_to_server(self, server, port):
|
||||
|
||||
server_address = "%s:%s" % (server, port) if port else server
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue