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

View file

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

View file

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