Nuovo Dialog: dialog_register

This commit is contained in:
Alhaziel01
2020-10-06 18:10:53 +02:00
parent aec033163e
commit cae469fa55
2 changed files with 196 additions and 1 deletions

View File

@@ -110,6 +110,11 @@ def dialog_browse(_type, heading, shares="files", mask="", useThumbs=False, trea
return d
def dialog_register(heading, user=False, email=False, password=False, user_default='', email_default='', password_default='', captcha_img=''):
dialog = Register('Register.xml', config.get_runtime_path()).Start(heading, user, email, password, user_default, email_default, password_default, captcha_img)
return dialog
def itemlist_refresh():
# pos = Item().fromurl(xbmc.getInfoLabel('ListItem.FileNameAndPath')).itemlistPosition
# logger.info('Current position: ' + str(pos))
@@ -1268,4 +1273,69 @@ def get_platform():
ret["os"] = "ios"
ret["arch"] = "arm"
return ret
return ret
class Register(xbmcgui.WindowXMLDialog):
def Start(self, heading, user, email, password, user_default, email_default, password_default, captcha_img):
self.result = {}
self.heading = heading
self.user = user
self.email = email
self.password = password
self.user_default = user_default
self.email_default = email_default
self.password_default = password_default
self.captcha_img = captcha_img
self.doModal()
return self.result
def __init__(self, *args, **kwargs):
self.mensaje = kwargs.get("mensaje")
self.imagen = kwargs.get("imagen")
def onInit(self):
#### Kodi 18 compatibility ####
if config.get_platform(True)['num_version'] < 18:
self.setCoordinateResolution(2)
height = 90
self.getControl(10002).setText(self.heading)
if self.user:
self.getControl(10003).setText(self.user_default)
height+=70
else:
self.getControl(10003).setVisible(False)
if self.email:
self.getControl(10004).setText(self.email_default)
height+=70
else:
self.getControl(10004).setVisible(False)
if self.password:
self.getControl(10005).setText(self.password_default)
height+=70
else:
self.getControl(10005).setVisible(False)
if self.captcha_img:
self.getControl(10007).setImage(self.captcha_img)
height+=240
else:
self.getControl(10005).setVisible(False)
height +=40
if height < 250: height = 250
self.getControl(10000).setHeight(height)
self.getControl(10001).setHeight(height)
self.getControl(10000).setPosition(255, (720-height)/2)
self.setFocusId(30000)
def onClick(self, control):
if control in [10010]:
self.close()
elif control in [10009]:
if self.user: self.result['user'] = self.getControl(10003).getText()
if self.email: self.result['email'] = self.getControl(10004).getText()
if self.password: self.result['password'] = self.getControl(10005).getText()
if self.captcha_img: self.result['captcha'] = self.getControl(10006).getText()
self.close()

View File

@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<window>
<allowoverlays>false</allowoverlays>
<animation type="WindowOpen" reversible="false">
<effect type="zoom" start="80" end="100" center="640,225" delay="160" tween="back" 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="640,225" easing="in" tween="back" time="240" />
<effect type="fade" start="100" end="0" time="240" />
</animation>
<controls>
<control type="group" id="10000">
<width>790</width>
<!-- Background -->
<control type="image" id='10001'>
<width>790</width>
<texture colordiffuse="FF232323">white.png</texture>
</control>
<!-- Header -->
<control type="textbox" id="10002">
<height>60</height>
<width>600</width>
<textcolor>FFFFFFFF</textcolor>
<wrapmultiline>true</wrapmultiline>
<align>center</align>
<aligny>center</aligny>
<label></label>
</control>
<!-- User -->
<control type="grouplist" id="30000">
<top>90</top>
<left>40</left>
<itemgap>20</itemgap>
<onright>10009</onright>
<control type="edit" id="10003">
<height>50</height>
<width>560</width>
<textcolor>FFFFFFFF</textcolor>
<texturefocus colordiffuse="FF0082C2">white.png</texturefocus>
<texturenofocus colordiffuse="FF232323">white.png</texturenofocus>
<aligny>center</aligny>
<label>username</label>
</control>
<!-- Email -->
<control type="edit" id="10004">
<height>50</height>
<width>560</width>
<textcolor>FFFFFFFF</textcolor>
<texturefocus colordiffuse="FF0082C2">white.png</texturefocus>
<texturenofocus colordiffuse="FF232323">white.png</texturenofocus>
<aligny>center</aligny>
<label>email</label>
</control>
<!-- Password -->
<control type="edit" id="10005">
<height>50</height>
<width>560</width>
<textcolor>FFFFFFFF</textcolor>
<texturefocus colordiffuse="FF0082C2">white.png</texturefocus>
<texturenofocus colordiffuse="FF232323">white.png</texturenofocus>
<aligny>center</aligny>
<label>password</label>
</control>
<!-- Captcha -->
<control type="edit" id="10006">
<height>50</height>
<width>560</width>
<textcolor>FFFFFFFF</textcolor>
<texturefocus colordiffuse="FF0082C2">white.png</texturefocus>
<texturenofocus colordiffuse="FF232323">white.png</texturenofocus>
<aligny>center</aligny>
<label>captcha</label>
</control>
<!-- Captchaimg -->
<control type="image" id="10007">
<width>560</width>
<height>170</height>
<left>20</left>
<aspectratio>keep</aspectratio>
</control>
</control>
<control type="group" id='10008'>
<top>90</top>
<left>620</left>
<control type="button" id="10009">
<top>0</top>
<left>0</left>
<width>150</width>
<height>50</height>
<textwidth>110</textwidth>
<textcolor>FFFFFFFF</textcolor>
<focusedcolor>FFFFFFFF</focusedcolor>
<texturefocus colordiffuse="FF0082C2">white.png</texturefocus>
<texturenofocus colordiffuse="000082C2">white.png</texturenofocus>
<align>center</align>
<aligny>center</aligny>
<label>$ADDON[plugin.video.kod 70007]</label>
<onup>10010</onup>
<ondown>10010</ondown>
<onleft>10003</onleft>
<onright>10003</onright>
</control>
<control type="button" id="10010">
<top>70</top>
<left>0</left>
<width>150</width>
<height>50</height>
<textwidth>110</textwidth>
<textcolor>FFFFFFFF</textcolor>
<focusedcolor>FFFFFFFF</focusedcolor>
<texturefocus colordiffuse="FF0082C2">white.png</texturefocus>
<texturenofocus colordiffuse="000082C2">white.png</texturenofocus>
<align>center</align>
<aligny>center</aligny>
<label>$ADDON[plugin.video.kod 707433]</label>
<onup>10009</onup>
<ondown>10009</ondown>
<onleft>10003</onleft>
<onright>10003</onright>
</control>
</control>
</control>
</controls>
</window>