Display the forced IP address in the Connect/Share menu and the Wireless device dialog.

This commit is contained in:
Charles Haley 2012-09-05 13:06:41 +02:00
parent 1a19cd7c19
commit fd80b279cd
3 changed files with 18 additions and 7 deletions

View File

@ -505,6 +505,8 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
return self.OPT_USE_PORT
elif opt_string == 'port_number':
return self.OPT_PORT_NUMBER
elif opt_string == 'force_ip_address':
return self.OPT_FORCE_IP_ADDRESS
else:
return None

View File

@ -240,6 +240,11 @@ class ConnectShareAction(InterfaceAction):
from calibre.gui2.dialogs.smartdevice import get_all_ip_addresses
dm = self.gui.device_manager
forced_ip = dm.get_option('smartdevice', 'force_ip_address')
if forced_ip:
formatted_addresses = forced_ip
show_port = True
else:
all_ips = get_all_ip_addresses()
if len(all_ips) > 3:
formatted_addresses = _('Many IP addresses. See Start/Stop dialog.')

View File

@ -115,6 +115,10 @@ class SmartdeviceDialog(QDialog, Ui_Dialog):
self.auto_mgmt_button.setText(_('Automatic metadata management is enabled'))
self.auto_mgmt_button.setEnabled(False)
forced_ip = self.device_manager.get_option('smartdevice', 'force_ip_address')
if forced_ip:
self.ip_addresses.setText(forced_ip)
else:
self.ip_addresses.setText(', '.join(get_all_ip_addresses()))
self.resize(self.sizeHint())