Remove port field from server setup

This commit is contained in:
mcarlton00 2019-11-02 23:25:15 -04:00
parent a2d4950fc8
commit 460b2ef889
2 changed files with 7 additions and 34 deletions

View file

@ -60,15 +60,12 @@ class ServerManual(xbmcgui.WindowXMLDialog):
self.error_toggle = self.getControl(ERROR_TOGGLE) self.error_toggle = self.getControl(ERROR_TOGGLE)
self.error_msg = self.getControl(ERROR_MSG) self.error_msg = self.getControl(ERROR_MSG)
self.host_field = self._add_editcontrol(755, 433, 40, 415) self.host_field = self._add_editcontrol(755, 433, 40, 415)
self.port_field = self._add_editcontrol(755, 543, 40, 415)
self.setFocus(self.host_field) self.setFocus(self.host_field)
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.connect_button)
self.port_field.controlUp(self.host_field) self.connect_button.controlUp(self.host_field)
self.port_field.controlDown(self.connect_button)
self.connect_button.controlUp(self.port_field)
self.cancel_button.controlDown(self.host_field) self.cancel_button.controlDown(self.host_field)
def onClick(self, control): def onClick(self, control):
@ -77,14 +74,13 @@ class ServerManual(xbmcgui.WindowXMLDialog):
self._disable_error() self._disable_error()
server = self.host_field.getText() server = self.host_field.getText()
port = self.port_field.getText()
if not server: if not server:
# Display error # Display error
self._error(ERROR['Empty'], _('empty_server')) self._error(ERROR['Empty'], _('empty_server'))
LOG.error("Server cannot be null") LOG.error("Server cannot be null")
elif self._connect_to_server(server, port): elif self._connect_to_server(server):
self.close() self.close()
elif control == CANCEL: elif control == CANCEL:
@ -93,7 +89,7 @@ class ServerManual(xbmcgui.WindowXMLDialog):
def onAction(self, action): def onAction(self, action):
if self.error == ERROR['Empty'] and self.host_field.getText() and self.port_field.getText(): if self.error == ERROR['Empty'] and self.host_field.getText():
self._disable_error() self._disable_error()
if action in (ACTION_BACK, ACTION_PARENT_DIR, ACTION_PREVIOUS_MENU): if action in (ACTION_BACK, ACTION_PARENT_DIR, ACTION_PREVIOUS_MENU):
@ -116,13 +112,12 @@ class ServerManual(xbmcgui.WindowXMLDialog):
self.addControl(control) self.addControl(control)
return control return control
def _connect_to_server(self, server, port): def _connect_to_server(self, server):
if _IPV6_RE.match(server): if _IPV6_RE.match(server):
server = "[%s]" % (server) server = "[%s]" % (server)
server_address = "%s:%s" % (server, port) if port else server self._message("%s %s..." % (_(30610), server))
self._message("%s %s..." % (_(30610), server_address)) result = self.connect_manager.connect_to_address(server)
result = self.connect_manager.connect_to_address(server_address)
if result['State'] == CONNECTION_STATE['Unavailable']: if result['State'] == CONNECTION_STATE['Unavailable']:
self._message(_(30609)) self._message(_(30609))

View file

@ -80,28 +80,6 @@
<texture colordiffuse="ff525252">white.png</texture> <texture colordiffuse="ff525252">white.png</texture>
</control> </control>
</control> </control>
<control type="group" id="102">
<height>110</height>
<control type="label">
<label>$ADDON[plugin.video.jellyfin 30030]</label>
<textcolor>ffe1e1e1</textcolor>
<textshadow>66000000</textshadow>
<font>font12</font>
<aligny>top</aligny>
<textoffsetx>20</textoffsetx>
</control>
<control type="label">
<height>50</height>
</control>
<control type="image">
<description>separator</description>
<left>20</left>
<right>20</right>
<height>1</height>
<top>90</top>
<texture colordiffuse="ff525252">white.png</texture>
</control>
</control>
<control type="button" id="200"> <control type="button" id="200">
<label>[B]$ADDON[plugin.video.jellyfin 30616][/B]</label> <label>[B]$ADDON[plugin.video.jellyfin 30616][/B]</label>
<width>426</width> <width>426</width>