diff --git a/resources/lib/dialog/loginconnect.py b/resources/lib/dialog/loginconnect.py new file mode 100644 index 00000000..4b35946e --- /dev/null +++ b/resources/lib/dialog/loginconnect.py @@ -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() \ No newline at end of file diff --git a/resources/skins/default/1080i/script-emby-connect-login.xml b/resources/skins/default/1080i/script-emby-connect-login.xml index 3d755222..b5b01632 100644 --- a/resources/skins/default/1080i/script-emby-connect-login.xml +++ b/resources/skins/default/1080i/script-emby-connect-login.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <window> - <defaultcontrol always="true">100</defaultcontrol> + <defaultcontrol always="false">200</defaultcontrol> <zorder>0</zorder> <include>dialogeffect</include> <controls> @@ -53,19 +53,6 @@ <aligny>top</aligny> </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"> <description>separator</description> <width>102%</width> @@ -86,20 +73,6 @@ <font>font10</font> <aligny>top</aligny> </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"> <description>separator</description> @@ -113,7 +86,7 @@ <control type="group"> <description>Buttons</description> - <top>365</top> + <top>385</top> <control type="button" id="200"> <description>Sign in</description> <texturenofocus border="5" colordiffuse="green">box.png</texturenofocus> @@ -124,7 +97,6 @@ <width>100%</width> <height>50</height> <ondown>201</ondown> - <onup>101</onup> </control> <control type="button" id="201"> @@ -143,7 +115,7 @@ <control type="group"> <description>Disclaimer</description> - <top>490</top> + <top>510</top> <control type="label"> <description>Disclaimer label</description> <label>$ADDON[plugin.video.emby 30603]</label> @@ -170,7 +142,8 @@ <textcolor>green</textcolor> <align>right</align> <aligny>top</aligny> - <top>151</top> + <top>120</top> + <right>160</right> </control> </control> </control> diff --git a/resources/skins/default/media/button-focus.png b/resources/skins/default/media/button-focus.png new file mode 100644 index 00000000..d1427a2c Binary files /dev/null and b/resources/skins/default/media/button-focus.png differ