Dialog: manual PMS entry, part 2

This commit is contained in:
tomkat83 2017-07-25 18:17:49 +02:00
parent ac3016c84d
commit 87775072c6
3 changed files with 96 additions and 138 deletions

View file

@ -21,11 +21,14 @@ CONNECT = 200
CANCEL = 201
ERROR_TOGGLE = 202
ERROR_MSG = 203
VERIFY_SSL = 204
ERROR = {
'Invalid': 1,
'Empty': 2
}
MEDIA = tryEncode(join(v.ADDON_PATH, 'resources', 'skins', 'default', 'media'))
###############################################################################
@ -55,15 +58,20 @@ class ServerManual(xbmcgui.WindowXMLDialog):
self.error_msg = self.getControl(ERROR_MSG)
self.host_field = self._add_editcontrol(725, 325, 40, 500)
self.port_field = self._add_editcontrol(725, 450, 40, 500)
# self.ssl_field = self._add_radiobutton(725, 550, 50, 50)
self.ssl_field = self.getControl(VERIFY_SSL)
self.port_field.setText('32400')
self.setFocus(self.host_field)
self.ssl_field.setSelected(True)
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.port_field.controlDown(self.ssl_field)
self.ssl_field.controlUp(self.port_field)
self.ssl_field.controlDown(self.connect_button)
self.connect_button.controlUp(self.ssl_field)
self.cancel_button.controlDown(self.host_field)
def onClick(self, control):
@ -82,7 +90,6 @@ class ServerManual(xbmcgui.WindowXMLDialog):
elif self._connect_to_server(server, port):
self.close()
elif control == CANCEL:
# Remind me later
self.close()
@ -96,14 +103,30 @@ class ServerManual(xbmcgui.WindowXMLDialog):
self.close()
def _add_editcontrol(self, x, y, height, width):
media = tryEncode(join(
v.ADDON_PATH, 'resources', 'skins', 'default', 'media'))
control = xbmcgui.ControlEdit(0, 0, 0, 0,
label="User",
font="font10",
textColor="ffc2c2c2",
focusTexture=join(media, "button-focus.png"),
noFocusTexture=join(media, "button-focus.png"))
control = xbmcgui.ControlEdit(
0, 0, 0, 0,
label="User",
font="font10",
textColor="ffc2c2c2",
focusTexture=join(MEDIA, "button-focus.png"),
noFocusTexture=join(MEDIA, "button-focus.png"))
control.setPosition(x, y)
control.setHeight(height)
control.setWidth(width)
self.addControl(control)
return control
def _add_radiobutton(self, x, y, height, width):
control = xbmcgui.ControlRadioButton(
0, 0, 0, 0,
label="",
font="font10",
textColor="ffc2c2c2",
focusOnTexture=join(MEDIA, "radio-on.png"),
noFocusOnTexture=join(MEDIA, "radio-on.png"),
focusOffTexture=join(MEDIA, "radio-off.png"),
noFocusOffTexture=join(MEDIA, "radio-off.png"))
control.setPosition(x, y)
control.setHeight(height)
control.setWidth(width)

View file

@ -54,6 +54,7 @@ def setup():
% (connectmanager.server, connectmanager.serverid))
connectmanager.write_pms_settings(connectmanager.server,
connectmanager.pms_token)
connectmanager.pick_pms(show_dialog=True)
return
# If not already retrieved myplex info, optionally let user sign in

View file

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<window>
<defaultcontrol always="true">200</defaultcontrol>
<zorder>0</zorder>
<include>dialogeffect</include>
<controls>
<control type="image">
<description>Background fade</description>
@ -10,146 +8,82 @@
<height>100%</height>
<texture>emby-bg-fade.png</texture>
</control>
<control type="group">
<width>600</width>
<left>35%</left>
<top>20%</top>
<centerleft>50%</centerleft>
<centertop>50%</centertop>
<width>560</width>
<height>560</height>
<textcolor>white</textcolor>
<control type="image">
<top>-20</top>
<left>-20</left>
<description>Background box</description>
<texture colordiffuse="ff111111">white.png</texture>
<width>600</width>
<height>525</height>
<height>600</height>
</control>
<control type="group" id="202">
<top>530</top>
<visible>False</visible>
<control type="image">
<description>Error box</description>
<texture colordiffuse="ff222222">white.png</texture>
<width>100%</width>
<height>50</height>
</control>
<control type="label" id="203">
<description>Error message</description>
<textcolor>white</textcolor>
<font>font10</font>
<aligny>center</aligny>
<align>center</align>
<height>50</height>
</control>
</control>
<control type="image">
<description>Plex logo</description>
<texture>logo-white.png</texture>
<width>64</width>
<height>64</height>
<aspectratio>keep</aspectratio>
<width>120</width>
<height>49</height>
<top>20</top>
<left>0</left>
<aligny>left</aligny>
<align>left</align>
</control>
<control type="group">
<width>500</width>
<left>50</left>
<control type="label">
<description>Connect to PMS</description>
<label>$ADDON[plugin.video.plexkodiconnect 30018]</label>
<left>84</left>
<width>476</width>
<height>64</height>
<align>left</align>
<aligny>center</aligny>
<font>font12</font>
</control>
<control type="grouplist">
<description>Container for spacing</description>
<top>80</top>
<left>0</left>
<height>480</height>
<width>560</width>
<aligny>top</aligny>
<font>font6</font>
<control type="label">
<description>Connect to PMS</description>
<label>$ADDON[plugin.video.plexkodiconnect 30018]</label>
<textcolor>white</textcolor>
<font>font12</font>
<aligny>top</aligny>
<align>left</align>
<width>100%</width>
<top>30</top>
<left>60</left>
<height>50</height>
<width>560</width>
<description>PMS IP address or host name</description>
<label>$ADDON[plugin.video.plexkodiconnect 30019]</label>
</control>
<control type="group">
<top>75</top>
<control type="label">
<description>PMS IP address or host name</description>
<label>$ADDON[plugin.video.plexkodiconnect 30019]</label>
<textcolor>ffa6a6a6</textcolor>
<font>font10</font>
<aligny>top</aligny>
</control>
<control type="image">
<description>separator</description>
<width>102%</width>
<height>0.5</height>
<top>66</top>
<left>-10</left>
<texture colordiffuse="ff525252" border="90,3,90,3">emby-separator.png</texture>
</control>
<control type="label">
<description>Host example</description>
<label>https://192.168.1.2, https://myserver.com</label>
<textcolor>ff464646</textcolor>
<font>font10</font>
<aligny>top</aligny>
<top>70</top>
</control>
<control type="edit" id="1">
<height>50</height>
<width>560</width>
<font>font4</font>
<hinttext>https://192.168.1.2, https://myserver.com</hinttext>
</control>
<control type="group">
<description>Port</description>
<top>200</top>
<control type="label">
<description>Port Number</description>
<label>$ADDON[plugin.video.plexkodiconnect 30030]</label>
<textcolor>ffa6a6a6</textcolor>
<font>font10</font>
<aligny>top</aligny>
</control>
<control type="image">
<description>separator</description>
<width>102%</width>
<height>0.5</height>
<top>66</top>
<left>-10</left>
<texture colordiffuse="ff525252" border="90,3,90,3">emby-separator.png</texture>
</control>
<control type="label">
<height>50</height>
<width>560</width>
<description>Port Number</description>
<label>$ADDON[plugin.video.plexkodiconnect 30030]</label>
</control>
<control type="group">
<description>Buttons</description>
<top>380</top>
<control type="button" id="200">
<description>Connect</description>
<texturenofocus border="5" colordiffuse="ff464646">box.png</texturenofocus>
<texturefocus border="5" colordiffuse="ff525252">box.png</texturefocus>
<label>$ADDON[plugin.video.plexkodiconnect 30020]</label>
<font>font10</font>
<textcolor>ffa6a6a6</textcolor>
<focusedcolor>white</focusedcolor>
<align>center</align>
<width>100%</width>
<height>50</height>
<ondown>201</ondown>
</control>
<control type="button" id="201">
<description>Cancel</description>
<texturenofocus border="5" colordiffuse="ff464646">box.png</texturenofocus>
<texturefocus border="5" colordiffuse="ff525252">box.png</texturefocus>
<label>$ADDON[plugin.video.plexkodiconnect 30602]</label>
<font>font10</font>
<textcolor>ffa6a6a6</textcolor>
<focusedcolor>white</focusedcolor>
<align>center</align>
<width>100%</width>
<height>50</height>
<top>55</top>
<onup>200</onup>
</control>
<control type="edit" id="2">
<height>50</height>
<width>560</width>
<font>font4</font>
</control>
<control type="radiobutton" id="204">
<width>560</width>
<description>Verify Host SSL Certificate</description>
<label>$ADDON[plugin.video.plexkodiconnect 30500]</label>
</control>
<control type="button" id="200">
<description>Connect</description>
<label>$ADDON[plugin.video.plexkodiconnect 30020]</label>
<ondown>201</ondown>
</control>
<control type="button" id="201">
<description>Cancel</description>
<label>$ADDON[plugin.video.plexkodiconnect 30602]</label>
<onup>200</onup>
</control>
</control>
</control>