Emby connect - login dialog

This commit is contained in:
angelblue05 2016-07-03 22:24:39 -05:00
parent 5aca32c341
commit b8ca6d3119
3 changed files with 87 additions and 32 deletions

View File

@ -0,0 +1,82 @@
# -*- coding: utf-8 -*-
##################################################################################################
import os
import xbmcgui
import userclient
import sys
import xbmc
import xbmcaddon
import json as json
import urllib
##################################################################################################
addon = xbmcaddon.Addon('plugin.video.emby')
ACTION_BACK = 92
SIGN_IN = 200
REMIND_LATER = 201
class LoginConnect(xbmcgui.WindowXMLDialog):
def __init__(self, *args, **kwargs):
self.UserClient = userclient.UserClient()
xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
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="ff464646",
focusTexture=os.path.join(media, "button-focus.png"),
noFocusTexture=os.path.join(media, "button-focus.png"),
isPassword=password)
control.setPosition(x,y)
control.setHeight(height)
control.setWidth(width)
self.addControl(control)
return control
def onInit(self):
self.user_field = self.__add_editcontrol(685,385,40,500)
self.setFocus(self.user_field)
self.password_field = self.__add_editcontrol(685,470,40,500, password=1)
self.signin_button = self.getControl(SIGN_IN)
self.user_field.controlDown(self.password_field)
self.user_field.controlRight(self.password_field)
self.password_field.controlUp(self.user_field)
self.password_field.controlDown(self.signin_button)
self.password_field.controlRight(self.signin_button)
self.signin_button.controlUp(self.password_field)
def onClick(self, control):
if control == SIGN_IN:
# Sign in to emby connect
self.user = self.user_field.getText()
__password = self.password_field.getText()
### REVIEW ONCE CONNECT MODULE IS MADE
elif control == REMIND_LATER:
# Remind me later
self.close()
def onAction(self, action):
if action == ACTION_BACK:
self.close()

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<window> <window>
<defaultcontrol always="true">100</defaultcontrol> <defaultcontrol always="false">200</defaultcontrol>
<zorder>0</zorder> <zorder>0</zorder>
<include>dialogeffect</include> <include>dialogeffect</include>
<controls> <controls>
@ -53,19 +53,6 @@
<aligny>top</aligny> <aligny>top</aligny>
</control> </control>
<control type="edit" id="100">
<description>Username field</description>
<texturefocus border="5" colordiffuse="ff111111">box.png</texturefocus>
<texturenofocus border="5" colordiffuse="ff111111">box.png</texturenofocus>
<hinttext>User</hinttext>
<width>100%</width>
<height>40</height>
<textcolor>ff464646</textcolor>
<font>font10</font>
<top>25</top>
<ondown>101</ondown>
</control>
<control type="image"> <control type="image">
<description>separator</description> <description>separator</description>
<width>102%</width> <width>102%</width>
@ -86,20 +73,6 @@
<font>font10</font> <font>font10</font>
<aligny>top</aligny> <aligny>top</aligny>
</control> </control>
<control type="edit" id="101">
<description>Password field</description>
<texturefocus border="5" colordiffuse="ff111111">box.png</texturefocus>
<texturenofocus border="5" colordiffuse="ff111111">box.png</texturenofocus>
<hinttext>Password</hinttext>
<width>100%</width>
<height>40</height>
<textcolor>ff464646</textcolor>
<font>font10</font>
<top>25</top>
<ondown>200</ondown>
<onup>100</onup>
</control>
<control type="image"> <control type="image">
<description>separator</description> <description>separator</description>
@ -113,7 +86,7 @@
<control type="group"> <control type="group">
<description>Buttons</description> <description>Buttons</description>
<top>365</top> <top>385</top>
<control type="button" id="200"> <control type="button" id="200">
<description>Sign in</description> <description>Sign in</description>
<texturenofocus border="5" colordiffuse="green">box.png</texturenofocus> <texturenofocus border="5" colordiffuse="green">box.png</texturenofocus>
@ -124,7 +97,6 @@
<width>100%</width> <width>100%</width>
<height>50</height> <height>50</height>
<ondown>201</ondown> <ondown>201</ondown>
<onup>101</onup>
</control> </control>
<control type="button" id="201"> <control type="button" id="201">
@ -143,7 +115,7 @@
<control type="group"> <control type="group">
<description>Disclaimer</description> <description>Disclaimer</description>
<top>490</top> <top>510</top>
<control type="label"> <control type="label">
<description>Disclaimer label</description> <description>Disclaimer label</description>
<label>$ADDON[plugin.video.emby 30603]</label> <label>$ADDON[plugin.video.emby 30603]</label>
@ -170,7 +142,8 @@
<textcolor>green</textcolor> <textcolor>green</textcolor>
<align>right</align> <align>right</align>
<aligny>top</aligny> <aligny>top</aligny>
<top>151</top> <top>120</top>
<right>160</right>
</control> </control>
</control> </control>
</control> </control>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1023 B