def server_state_changed(self, running): from calibre.utils.mdns import get_external_ip, verify_ipV4_address text = _("Start Content Server") if running: listen_on = verify_ipV4_address(tweaks["server_listen_on"]) or get_external_ip() try: cs_port = content_server_config().parse().port ip_text = _(" [%(ip)s, port %(port)d]") % dict(ip=listen_on, port=cs_port) except: ip_text = " [%s]" % listen_on text = _("Stop Content Server") + ip_text self.toggle_server_action.setText(text)
def server_state_changed(self, running): from calibre.utils.mdns import get_external_ip, verify_ipV4_address text = _('Start Content Server') if running: listen_on = (verify_ipV4_address(tweaks['server_listen_on']) or get_external_ip()) try : cs_port = content_server_config().parse().port ip_text = _(' [%s, port %d]')%(listen_on, cs_port) except: ip_text = ' [%s]'%listen_on text = _('Stop Content Server') + ip_text self.toggle_server_action.setText(text)
def server_state_changed(self, running): from calibre.utils.mdns import get_external_ip, verify_ipV4_address text = _('Start Content Server') if running: listen_on = (verify_ipV4_address(tweaks['server_listen_on']) or get_external_ip()) try: cs_port = content_server_config().parse().port ip_text = _(' [%(ip)s, port %(port)d]') % dict(ip=listen_on, port=cs_port) except: ip_text = ' [%s]' % listen_on text = _('Stop Content Server') + ip_text self.toggle_server_action.setText(text)