mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Display the port number on the connect menu if it is fixed.
This commit is contained in:
parent
3cae8e614d
commit
a16756497a
@ -238,11 +238,20 @@ class ConnectShareAction(InterfaceAction):
|
|||||||
|
|
||||||
def set_smartdevice_action_state(self):
|
def set_smartdevice_action_state(self):
|
||||||
from calibre.utils.mdns import get_external_ip
|
from calibre.utils.mdns import get_external_ip
|
||||||
running = self.gui.device_manager.is_running('smartdevice')
|
dm = self.gui.device_manager
|
||||||
|
|
||||||
|
running = dm.is_running('smartdevice')
|
||||||
if not running:
|
if not running:
|
||||||
text = self.share_conn_menu.DEVICE_MSGS[0]
|
text = self.share_conn_menu.DEVICE_MSGS[0]
|
||||||
else:
|
else:
|
||||||
text = self.share_conn_menu.DEVICE_MSGS[1] + ' [%s]'%get_external_ip()
|
use_fixed_port = dm.get_option('smartdevice', 'use_fixed_port')
|
||||||
|
port_number = dm.get_option('smartdevice', 'port_number')
|
||||||
|
if use_fixed_port:
|
||||||
|
text = self.share_conn_menu.DEVICE_MSGS[1] + ' [%s port %s]'%(
|
||||||
|
get_external_ip(), port_number)
|
||||||
|
else:
|
||||||
|
text = self.share_conn_menu.DEVICE_MSGS[1] + ' [%s]'%get_external_ip()
|
||||||
|
|
||||||
icon = 'green' if running else 'red'
|
icon = 'green' if running else 'red'
|
||||||
ac = self.share_conn_menu.control_smartdevice_action
|
ac = self.share_conn_menu.control_smartdevice_action
|
||||||
ac.setIcon(QIcon(I('dot_%s.png'%icon)))
|
ac.setIcon(QIcon(I('dot_%s.png'%icon)))
|
||||||
|
@ -97,7 +97,7 @@
|
|||||||
<item row="2" column="2">
|
<item row="2" column="2">
|
||||||
<widget class="QCheckBox" name="use_fixed_port">
|
<widget class="QCheckBox" name="use_fixed_port">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Use the fixed port</string>
|
<string>&Use a fixed port</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user