Workaround for LibreElec bug with edit control (#127)

This commit is contained in:
Sebastian S 2018-02-09 01:05:24 +01:00 committed by angelblue05
parent d41e3d7fe1
commit 4413f469a3
8 changed files with 147 additions and 146 deletions

View file

@ -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)

View file

@ -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:

View file

@ -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

View file

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<window>
<defaultcontrol always="true">200</defaultcontrol>
<animation type="WindowOpen" reversible="false">
<effect type="zoom" start="80" end="100" center="960,540" delay="160" tween="circle" easin="out" time="240" />
<effect type="fade" delay="160" end="100" time="240" />
</animation>
<animation type="WindowClose" reversible="false">
<effect type="zoom" start="100" end="80" center="960,540" easing="in" tween="circle" easin="out" time="240" />
<effect type="fade" start="100" end="0" time="240" />
</animation>
<controls>
<control type="group">
<control type="image">
<top>0</top>
<bottom>0</bottom>
<left>0</left>
<right>0</right>
<top>-200</top>
<bottom>-200</bottom>
<left>-200</left>
<right>-200</right>
<texture colordiffuse="CC000000">white.png</texture>
<aspectratio>stretch</aspectratio>
<animation effect="fade" end="100" time="200">WindowOpen</animation>
<animation effect="fade" start="100" end="0" time="200">WindowClose</animation>
</control>
<control type="group">
<animation type="WindowOpen" reversible="false">
<effect type="zoom" start="80" end="100" center="960,540" delay="160" tween="circle" easin="out" time="240" />
<effect type="fade" delay="160" end="100" time="240" />
</animation>
<animation type="WindowClose" reversible="false">
<effect type="zoom" start="100" end="80" center="960,540" easing="in" tween="circle" easin="out" time="240" />
<effect type="fade" start="100" end="0" time="240" />
</animation>
<centerleft>50%</centerleft>
<centertop>50%</centertop>
<width>470</width>
@ -69,18 +69,8 @@
<aligny>top</aligny>
<textoffsetx>20</textoffsetx>
</control>
<control id="204" type="edit">
<top>35</top>
<left>20</left>
<right>20</right>
<control type="label">
<height>50</height>
<font>font10</font>
<textcolor>FF888888</textcolor>
<focusedcolor>FF52b54b</focusedcolor>
<shadowcolor>66000000</shadowcolor>
<ondown>205</ondown>
<texturefocus>-</texturefocus>
<texturenofocus>-</texturenofocus>
</control>
<control type="image">
<left>20</left>
@ -100,20 +90,8 @@
<aligny>top</aligny>
<textoffsetx>20</textoffsetx>
</control>
<control id="205" type="edit">
<top>35</top>
<left>20</left>
<right>20</right>
<control type="label">
<height>50</height>
<font>font10</font>
<textcolor>FF888888</textcolor>
<focusedcolor>FF52b54b</focusedcolor>
<shadowcolor>66000000</shadowcolor>
<onup>204</onup>
<ondown>200</ondown>
<texturefocus>-</texturefocus>
<texturenofocus>-</texturenofocus>
<password>true</password>
</control>
<control type="image">
<description>separator</description>

View file

@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<window>
<animation type="WindowOpen" reversible="false">
<effect type="zoom" start="80" end="100" center="960,540" delay="160" tween="circle" easin="out" time="240" />
<effect type="fade" delay="160" end="100" time="240" />
</animation>
<animation type="WindowClose" reversible="false">
<effect type="zoom" start="100" end="80" center="960,540" easing="in" tween="circle" easin="out" time="240" />
<effect type="fade" start="100" end="0" time="240" />
</animation>
<controls>
<control type="group">
<control type="image">
<top>0</top>
<bottom>0</bottom>
<left>0</left>
<right>0</right>
<top>-200</top>
<bottom>-200</bottom>
<left>-200</left>
<right>-200</right>
<texture colordiffuse="CC000000">white.png</texture>
<aspectratio>stretch</aspectratio>
<animation effect="fade" end="100" time="200">WindowOpen</animation>
<animation effect="fade" start="100" end="0" time="200">WindowClose</animation>
</control>
<control type="group">
<animation type="WindowOpen" reversible="false">
<effect type="zoom" start="80" end="100" center="960,540" delay="160" tween="circle" easin="out" time="240" />
<effect type="fade" delay="160" end="100" time="240" />
</animation>
<animation type="WindowClose" reversible="false">
<effect type="zoom" start="100" end="80" center="960,540" easing="in" tween="circle" easin="out" time="240" />
<effect type="fade" start="100" end="0" time="240" />
</animation>
<centerleft>50%</centerleft>
<centertop>50%</centertop>
<width>470</width>
@ -68,18 +68,8 @@
<aligny>top</aligny>
<textoffsetx>20</textoffsetx>
</control>
<control id="204" type="edit">
<top>35</top>
<left>20</left>
<right>20</right>
<control type="label">
<height>50</height>
<font>font10</font>
<textcolor>FF888888</textcolor>
<focusedcolor>FF52b54b</focusedcolor>
<shadowcolor>66000000</shadowcolor>
<ondown>205</ondown>
<texturefocus>-</texturefocus>
<texturenofocus>-</texturenofocus>
</control>
<control type="image">
<left>20</left>
@ -99,20 +89,8 @@
<aligny>top</aligny>
<textoffsetx>20</textoffsetx>
</control>
<control id="205" type="edit">
<top>35</top>
<left>20</left>
<right>20</right>
<control type="label">
<height>50</height>
<font>font10</font>
<textcolor>FF888888</textcolor>
<focusedcolor>FF52b54b</focusedcolor>
<shadowcolor>66000000</shadowcolor>
<onup>204</onup>
<ondown>200</ondown>
<texturefocus>-</texturefocus>
<texturenofocus>-</texturenofocus>
<password>true</password>
</control>
<control type="image">
<description>separator</description>

View file

@ -1,28 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<window>
<defaultcontrol always="true">200</defaultcontrol>
<zorder>0</zorder>
<animation type="WindowOpen" reversible="false">
<effect type="zoom" start="80" end="100" center="960,540" delay="160" tween="circle" easin="out" time="240" />
<effect type="fade" delay="160" end="100" time="240" />
</animation>
<animation type="WindowClose" reversible="false">
<effect type="zoom" start="100" end="80" center="960,540" easing="in" tween="circle" easin="out" time="240" />
<effect type="fade" start="100" end="0" time="240" />
</animation>
<controls>
<control type="group">
<control type="image">
<top>0</top>
<bottom>0</bottom>
<left>0</left>
<right>0</right>
<top>-200</top>
<bottom>-200</bottom>
<left>-200</left>
<right>-200</right>
<texture colordiffuse="CC000000">white.png</texture>
<aspectratio>stretch</aspectratio>
<animation effect="fade" end="100" time="200">WindowOpen</animation>
<animation effect="fade" start="100" end="0" time="200">WindowClose</animation>
</control>
<control type="group">
<animation type="WindowOpen" reversible="false">
<effect type="zoom" start="80" end="100" center="960,540" delay="160" tween="circle" easin="out" time="240" />
<effect type="fade" delay="160" end="100" time="240" />
</animation>
<animation type="WindowClose" reversible="false">
<effect type="zoom" start="100" end="80" center="960,540" easing="in" tween="circle" easin="out" time="240" />
<effect type="fade" start="100" end="0" time="240" />
</animation>
<centerleft>50%</centerleft>
<centertop>50%</centertop>
<width>470</width>
@ -70,19 +69,8 @@
<aligny>top</aligny>
<textoffsetx>20</textoffsetx>
</control>
<control id="204" type="edit">
<top>35</top>
<left>20</left>
<right>20</right>
<control type="label">
<height>50</height>
<font>font10</font>
<textcolor>FF888888</textcolor>
<focusedcolor>FF52b54b</focusedcolor>
<shadowcolor>66000000</shadowcolor>
<ondown>205</ondown>
<hinttext>[COLOR ff464646]IP or https://myserver.com[/COLOR]</hinttext>
<texturefocus>-</texturefocus>
<texturenofocus>-</texturenofocus>
</control>
<control type="image">
<left>20</left>
@ -102,19 +90,8 @@
<aligny>top</aligny>
<textoffsetx>20</textoffsetx>
</control>
<control id="205" type="edit">
<top>35</top>
<left>20</left>
<right>20</right>
<control type="label">
<height>50</height>
<font>font10</font>
<textcolor>FF888888</textcolor>
<focusedcolor>FF52b54b</focusedcolor>
<shadowcolor>66000000</shadowcolor>
<onup>204</onup>
<ondown>200</ondown>
<texturefocus>-</texturefocus>
<texturenofocus>-</texturenofocus>
</control>
<control type="image">
<description>separator</description>

View file

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<window>
<defaultcontrol always="true">205</defaultcontrol>
<animation type="WindowOpen" reversible="false">
<effect type="zoom" start="80" end="100" center="960,540" delay="160" tween="circle" easin="out" time="240" />
<effect type="fade" delay="160" end="100" time="240" />
</animation>
<animation type="WindowClose" reversible="false">
<effect type="zoom" start="100" end="80" center="960,540" easing="in" tween="circle" easin="out" time="240" />
<effect type="fade" start="100" end="0" time="240" />
</animation>
<controls>
<control type="group">
<control type="image">
<top>0</top>
<bottom>0</bottom>
<left>0</left>
<right>0</right>
<top>-200</top>
<bottom>-200</bottom>
<left>-200</left>
<right>-200</right>
<texture colordiffuse="CC000000">white.png</texture>
<aspectratio>stretch</aspectratio>
<animation effect="fade" end="100" time="200">WindowOpen</animation>
<animation effect="fade" start="100" end="0" time="200">WindowClose</animation>
</control>
<control type="group">
<animation type="WindowOpen" reversible="false">
<effect type="zoom" start="80" end="100" center="960,540" delay="160" tween="circle" easin="out" time="240" />
<effect type="fade" delay="160" end="100" time="240" />
</animation>
<animation type="WindowClose" reversible="false">
<effect type="zoom" start="100" end="80" center="960,540" easing="in" tween="circle" easin="out" time="240" />
<effect type="fade" start="100" end="0" time="240" />
</animation>
<centerleft>50%</centerleft>
<centertop>50%</centertop>
<width>470</width>

View file

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<window>
<defaultcontrol always="true">155</defaultcontrol>
<animation type="WindowOpen" reversible="false">
<effect type="zoom" start="80" end="100" center="960,540" delay="160" tween="circle" easin="out" time="240" />
<effect type="fade" delay="160" end="100" time="240" />
</animation>
<animation type="WindowClose" reversible="false">
<effect type="zoom" start="100" end="80" center="960,540" easing="in" tween="circle" easin="out" time="240" />
<effect type="fade" start="100" end="0" time="240" />
</animation>
<controls>
<control type="group">
<control type="image">
<top>0</top>
<bottom>0</bottom>
<left>0</left>
<right>0</right>
<top>-200</top>
<bottom>-200</bottom>
<left>-200</left>
<right>-200</right>
<texture colordiffuse="CC000000">white.png</texture>
<aspectratio>stretch</aspectratio>
<animation effect="fade" end="100" time="200">WindowOpen</animation>
<animation effect="fade" start="100" end="0" time="200">WindowClose</animation>
</control>
<control type="group">
<animation type="WindowOpen" reversible="false">
<effect type="zoom" start="80" end="100" center="960,540" delay="160" tween="circle" easin="out" time="240" />
<effect type="fade" delay="160" end="100" time="240" />
</animation>
<animation type="WindowClose" reversible="false">
<effect type="zoom" start="100" end="80" center="960,540" easing="in" tween="circle" easin="out" time="240" />
<effect type="fade" start="100" end="0" time="240" />
</animation>
<centerleft>50%</centerleft>
<centertop>50%</centertop>
<width>920</width>