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,146 +8,82 @@
<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="label">
<control type="group"> <description>Connect to PMS</description>
<width>500</width> <label>$ADDON[plugin.video.plexkodiconnect 30018]</label>
<left>50</left> <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"> <control type="label">
<description>Connect to PMS</description> <height>50</height>
<label>$ADDON[plugin.video.plexkodiconnect 30018]</label> <width>560</width>
<textcolor>white</textcolor> <description>PMS IP address or host name</description>
<font>font12</font> <label>$ADDON[plugin.video.plexkodiconnect 30019]</label>
<aligny>top</aligny>
<align>left</align>
<width>100%</width>
<top>30</top>
<left>60</left>
</control> </control>
<control type="edit" id="1">
<control type="group"> <height>50</height>
<top>75</top> <width>560</width>
<control type="label"> <font>font4</font>
<description>PMS IP address or host name</description> <hinttext>https://192.168.1.2, https://myserver.com</hinttext>
<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> </control>
<control type="label">
<control type="group"> <height>50</height>
<description>Port</description> <width>560</width>
<top>200</top> <description>Port Number</description>
<control type="label"> <label>$ADDON[plugin.video.plexkodiconnect 30030]</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> </control>
<control type="edit" id="2">
<control type="group"> <height>50</height>
<description>Buttons</description> <width>560</width>
<top>380</top> <font>font4</font>
<control type="button" id="200"> </control>
<description>Connect</description> <control type="radiobutton" id="204">
<texturenofocus border="5" colordiffuse="ff464646">box.png</texturenofocus> <width>560</width>
<texturefocus border="5" colordiffuse="ff525252">box.png</texturefocus> <description>Verify Host SSL Certificate</description>
<label>$ADDON[plugin.video.plexkodiconnect 30020]</label> <label>$ADDON[plugin.video.plexkodiconnect 30500]</label>
<font>font10</font> </control>
<textcolor>ffa6a6a6</textcolor> <control type="button" id="200">
<focusedcolor>white</focusedcolor> <description>Connect</description>
<align>center</align> <label>$ADDON[plugin.video.plexkodiconnect 30020]</label>
<width>100%</width> <ondown>201</ondown>
<height>50</height> </control>
<ondown>201</ondown> <control type="button" id="201">
</control> <description>Cancel</description>
<label>$ADDON[plugin.video.plexkodiconnect 30602]</label>
<control type="button" id="201"> <onup>200</onup>
<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> </control>
</control> </control>
</control> </control>