mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-06 00:18:39 +00:00
[GTKUI] [Console] Modify UIs to display single incoming port
This commit is contained in:
parent
5978b433d3
commit
1755347878
3 changed files with 34 additions and 96 deletions
|
@ -85,12 +85,11 @@ class BasePane(object):
|
||||||
for ipt in self.inputs:
|
for ipt in self.inputs:
|
||||||
if not isinstance(ipt, NoInput):
|
if not isinstance(ipt, NoInput):
|
||||||
# gross, have to special case in/out ports since they are tuples
|
# gross, have to special case in/out ports since they are tuples
|
||||||
if ipt.name in ("listen_ports_to", "listen_ports_from", "out_ports_from", "out_ports_to",
|
if ipt.name in ("listen_interface", "listen_port", "out_ports_from", "out_ports_to",
|
||||||
"i2p_port", "i2p_hostname", "proxy_type", "proxy_username", "proxy_hostnames",
|
"i2p_port", "i2p_hostname", "proxy_type", "proxy_username", "proxy_hostnames",
|
||||||
"proxy_password", "proxy_hostname", "proxy_port", "proxy_peer_connections",
|
"proxy_password", "proxy_hostname", "proxy_port", "proxy_peer_connections"):
|
||||||
"listen_interface"):
|
if ipt.name == "listen_port":
|
||||||
if ipt.name == "listen_ports_to":
|
conf_dict["listen_ports"] = [self.infrom.get_value()] * 2
|
||||||
conf_dict["listen_ports"] = (self.infrom.get_value(), self.into.get_value())
|
|
||||||
elif ipt.name == "out_ports_to":
|
elif ipt.name == "out_ports_to":
|
||||||
conf_dict["outgoing_ports"] = (self.outfrom.get_value(), self.outto.get_value())
|
conf_dict["outgoing_ports"] = (self.outfrom.get_value(), self.outto.get_value())
|
||||||
elif ipt.name == "listen_interface":
|
elif ipt.name == "listen_interface":
|
||||||
|
@ -309,17 +308,14 @@ class DownloadsPane(BasePane):
|
||||||
class NetworkPane(BasePane):
|
class NetworkPane(BasePane):
|
||||||
def __init__(self, offset, parent, width):
|
def __init__(self, offset, parent, width):
|
||||||
BasePane.__init__(self, offset, parent, width)
|
BasePane.__init__(self, offset, parent, width)
|
||||||
self.add_header("Incomming Ports")
|
self.add_header("Incomming Port")
|
||||||
inrand = CheckedInput(parent, "Use Random Ports Active Port: %d" % parent.active_port,
|
inrand = CheckedInput(parent, "Use Random Port Active Port: %d" % parent.active_port,
|
||||||
"random_port", parent.core_config["random_port"])
|
"random_port", parent.core_config["random_port"])
|
||||||
self.inputs.append(inrand)
|
self.inputs.append(inrand)
|
||||||
listen_ports = parent.core_config["listen_ports"]
|
listen_ports = parent.core_config["listen_ports"]
|
||||||
self.infrom = IntSpinInput(self.parent, " From:", "listen_ports_from", self.move, listen_ports[0], 0, 65535)
|
self.infrom = IntSpinInput(self.parent, " ", "listen_port", self.move, listen_ports[0], 0, 65535)
|
||||||
self.infrom.set_depend(inrand, True)
|
self.infrom.set_depend(inrand, True)
|
||||||
self.into = IntSpinInput(self.parent, " To: ", "listen_ports_to", self.move, listen_ports[1], 0, 65535)
|
|
||||||
self.into.set_depend(inrand, True)
|
|
||||||
self.inputs.append(self.infrom)
|
self.inputs.append(self.infrom)
|
||||||
self.inputs.append(self.into)
|
|
||||||
|
|
||||||
self.add_header("Outgoing Ports", True)
|
self.add_header("Outgoing Ports", True)
|
||||||
outrand = CheckedInput(parent, "Use Random Ports", "random_outgoing_ports",
|
outrand = CheckedInput(parent, "Use Random Ports", "random_outgoing_ports",
|
||||||
|
|
|
@ -51,6 +51,11 @@
|
||||||
<property name="step_increment">1</property>
|
<property name="step_increment">1</property>
|
||||||
<property name="page_increment">10</property>
|
<property name="page_increment">10</property>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkAdjustment" id="adjustment_spin_incoming_port">
|
||||||
|
<property name="upper">65535</property>
|
||||||
|
<property name="step_increment">1</property>
|
||||||
|
<property name="page_increment">10</property>
|
||||||
|
</object>
|
||||||
<object class="GtkAdjustment" id="adjustment_spin_max_conn_global">
|
<object class="GtkAdjustment" id="adjustment_spin_max_conn_global">
|
||||||
<property name="lower">-1</property>
|
<property name="lower">-1</property>
|
||||||
<property name="upper">9999</property>
|
<property name="upper">9999</property>
|
||||||
|
@ -121,16 +126,6 @@
|
||||||
<property name="step_increment">1</property>
|
<property name="step_increment">1</property>
|
||||||
<property name="page_increment">10</property>
|
<property name="page_increment">10</property>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkAdjustment" id="adjustment_spin_port_max">
|
|
||||||
<property name="upper">65535</property>
|
|
||||||
<property name="step_increment">1</property>
|
|
||||||
<property name="page_increment">10</property>
|
|
||||||
</object>
|
|
||||||
<object class="GtkAdjustment" id="adjustment_spin_port_min">
|
|
||||||
<property name="upper">65535</property>
|
|
||||||
<property name="step_increment">1</property>
|
|
||||||
<property name="page_increment">10</property>
|
|
||||||
</object>
|
|
||||||
<object class="GtkAdjustment" id="adjustment_spin_proxy_port">
|
<object class="GtkAdjustment" id="adjustment_spin_proxy_port">
|
||||||
<property name="upper">65535</property>
|
<property name="upper">65535</property>
|
||||||
<property name="step_increment">1</property>
|
<property name="step_increment">1</property>
|
||||||
|
@ -2796,78 +2791,30 @@ used sparingly.</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label1">
|
<object class="GtkSpinButton" id="spin_incoming_port">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="sensitive">False</property>
|
||||||
<property name="label" translatable="yes">From:</property>
|
<property name="can_focus">True</property>
|
||||||
|
<property name="max_length">5</property>
|
||||||
|
<property name="xalign">1</property>
|
||||||
|
<property name="primary_icon_activatable">False</property>
|
||||||
|
<property name="secondary_icon_activatable">False</property>
|
||||||
|
<property name="primary_icon_sensitive">True</property>
|
||||||
|
<property name="secondary_icon_sensitive">True</property>
|
||||||
|
<property name="adjustment">adjustment_spin_incoming_port</property>
|
||||||
|
<property name="climb_rate">1</property>
|
||||||
|
<property name="snap_to_ticks">True</property>
|
||||||
|
<property name="numeric">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
|
<property name="padding">5</property>
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSpinButton" id="spin_port_min">
|
<object class="GtkCheckButton" id="chk_random_incoming_port">
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="sensitive">False</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="max_length">5</property>
|
|
||||||
<property name="xalign">1</property>
|
|
||||||
<property name="primary_icon_activatable">False</property>
|
|
||||||
<property name="secondary_icon_activatable">False</property>
|
|
||||||
<property name="primary_icon_sensitive">True</property>
|
|
||||||
<property name="secondary_icon_sensitive">True</property>
|
|
||||||
<property name="adjustment">adjustment_spin_port_min</property>
|
|
||||||
<property name="climb_rate">1</property>
|
|
||||||
<property name="snap_to_ticks">True</property>
|
|
||||||
<property name="numeric">True</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="padding">5</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="label2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="xpad">5</property>
|
|
||||||
<property name="label" translatable="yes">To:</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
<property name="position">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSpinButton" id="spin_port_max">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="sensitive">False</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="max_length">5</property>
|
|
||||||
<property name="xalign">1</property>
|
|
||||||
<property name="primary_icon_activatable">False</property>
|
|
||||||
<property name="secondary_icon_activatable">False</property>
|
|
||||||
<property name="primary_icon_sensitive">True</property>
|
|
||||||
<property name="secondary_icon_sensitive">True</property>
|
|
||||||
<property name="adjustment">adjustment_spin_port_max</property>
|
|
||||||
<property name="climb_rate">1</property>
|
|
||||||
<property name="snap_to_ticks">True</property>
|
|
||||||
<property name="numeric">True</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="padding">5</property>
|
|
||||||
<property name="position">3</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkCheckButton" id="chk_random_port">
|
|
||||||
<property name="label" translatable="yes">Random</property>
|
<property name="label" translatable="yes">Random</property>
|
||||||
<property name="use_action_appearance">False</property>
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -2881,7 +2828,7 @@ used sparingly.</property>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="padding">5</property>
|
<property name="padding">5</property>
|
||||||
<property name="position">4</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
@ -2990,7 +2937,7 @@ used sparingly.</property>
|
||||||
<object class="GtkLabel" id="label4">
|
<object class="GtkLabel" id="label4">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">Incoming Ports</property>
|
<property name="label" translatable="yes">Incoming Port</property>
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="weight" value="bold"/>
|
<attribute name="weight" value="bold"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
|
|
@ -344,9 +344,8 @@ class Preferences(component.Component):
|
||||||
"chk_sequential_download": ("active", "sequential_download"),
|
"chk_sequential_download": ("active", "sequential_download"),
|
||||||
"chk_add_paused": ("active", "add_paused"),
|
"chk_add_paused": ("active", "add_paused"),
|
||||||
"active_port_label": ("text", lambda: str(self.active_port)),
|
"active_port_label": ("text", lambda: str(self.active_port)),
|
||||||
"spin_port_min": ("value", lambda: self.core_config["listen_ports"][0]),
|
"spin_incoming_port": ("value", lambda: self.core_config["listen_ports"][0]),
|
||||||
"spin_port_max": ("value", lambda: self.core_config["listen_ports"][1]),
|
"chk_random_incoming_port": ("active", "random_port"),
|
||||||
"chk_random_port": ("active", "random_port"),
|
|
||||||
"spin_outgoing_port_min": ("value", lambda: self.core_config["outgoing_ports"][0]),
|
"spin_outgoing_port_min": ("value", lambda: self.core_config["outgoing_ports"][0]),
|
||||||
"spin_outgoing_port_max": ("value", lambda: self.core_config["outgoing_ports"][1]),
|
"spin_outgoing_port_max": ("value", lambda: self.core_config["outgoing_ports"][1]),
|
||||||
"chk_random_outgoing_ports": ("active", "random_outgoing_ports"),
|
"chk_random_outgoing_ports": ("active", "random_outgoing_ports"),
|
||||||
|
@ -561,13 +560,10 @@ class Preferences(component.Component):
|
||||||
new_core_config["pre_allocate_storage"] = self.builder.get_object("chk_pre_allocation").get_active()
|
new_core_config["pre_allocate_storage"] = self.builder.get_object("chk_pre_allocation").get_active()
|
||||||
|
|
||||||
# Network tab #
|
# Network tab #
|
||||||
listen_ports = (
|
listen_ports = [self.builder.get_object("spin_incoming_port").get_value_as_int()] * 2
|
||||||
self.builder.get_object("spin_port_min").get_value_as_int(),
|
|
||||||
self.builder.get_object("spin_port_max").get_value_as_int()
|
|
||||||
)
|
|
||||||
new_core_config["listen_ports"] = listen_ports
|
new_core_config["listen_ports"] = listen_ports
|
||||||
new_core_config["random_port"] = \
|
new_core_config["random_port"] = \
|
||||||
self.builder.get_object("chk_random_port").get_active()
|
self.builder.get_object("chk_random_incoming_port").get_active()
|
||||||
outgoing_ports = (
|
outgoing_ports = (
|
||||||
self.builder.get_object("spin_outgoing_port_min").get_value_as_int(),
|
self.builder.get_object("spin_outgoing_port_min").get_value_as_int(),
|
||||||
self.builder.get_object("spin_outgoing_port_max").get_value_as_int()
|
self.builder.get_object("spin_outgoing_port_max").get_value_as_int()
|
||||||
|
@ -842,8 +838,7 @@ class Preferences(component.Component):
|
||||||
|
|
||||||
dependents = {
|
dependents = {
|
||||||
"chk_show_dialog": {"chk_focus_dialog": True},
|
"chk_show_dialog": {"chk_focus_dialog": True},
|
||||||
"chk_random_port": {"spin_port_min": False,
|
"chk_random_incoming_port": {"spin_incoming_port": False},
|
||||||
"spin_port_max": False},
|
|
||||||
"chk_random_outgoing_ports": {"spin_outgoing_port_min": False,
|
"chk_random_outgoing_ports": {"spin_outgoing_port_min": False,
|
||||||
"spin_outgoing_port_max": False},
|
"spin_outgoing_port_max": False},
|
||||||
"chk_use_tray": {"radio_appind": True,
|
"chk_use_tray": {"radio_appind": True,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue