mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-27 11:45:44 +00:00
add use random port option
This commit is contained in:
parent
d77afef3c3
commit
267ba8f7ac
@ -438,11 +438,13 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label37">
|
||||
<widget class="GtkCheckButton" id="chk_random_port">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">Active Port:</property>
|
||||
<property name="justify">GTK_JUSTIFY_RIGHT</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">Random Ports</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@ -450,19 +452,6 @@
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="active_port_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">0000</property>
|
||||
<property name="width_chars">5</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="btn_testport">
|
||||
<property name="visible">True</property>
|
||||
@ -476,7 +465,7 @@
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">6</property>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
@ -489,10 +478,46 @@
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label25">
|
||||
<widget class="GtkHBox" id="hbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>TCP Port</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label22">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>TCP</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="padding">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label37">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">Active Port:</property>
|
||||
<property name="justify">GTK_JUSTIFY_RIGHT</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="active_port_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">0000</property>
|
||||
<property name="width_chars">5</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
@ -530,9 +555,6 @@
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
10
src/core.py
10
src/core.py
@ -845,9 +845,15 @@ class Manager:
|
||||
print "Applying preferences"
|
||||
|
||||
for pref in PREF_FUNCTIONS:
|
||||
if PREF_FUNCTIONS[pref] is not None:
|
||||
if PREF_FUNCTIONS[pref] is not None and self.get_pref("random_port") \
|
||||
== False:
|
||||
PREF_FUNCTIONS[pref](self.get_pref(pref))
|
||||
|
||||
if self.get_pref("random_port"):
|
||||
import random
|
||||
ports = [random.randrange(49152, 65535), random.randrange(49152, 65535)]
|
||||
ports.sort()
|
||||
deluge_core.set_listen_on(ports)
|
||||
|
||||
# We need to reapply priorities to files after preferences were
|
||||
# changed
|
||||
for unique_ID in self.unique_IDs:
|
||||
|
@ -63,6 +63,7 @@ class PreferencesDlg:
|
||||
self.glade.get_widget("chk_tracker_proxy").set_active(self.preferences.get("tracker_proxy"))
|
||||
self.glade.get_widget("chk_dht_proxy").set_active(self.preferences.get("dht_proxy"))
|
||||
self.glade.get_widget("chk_upnp").set_active(self.preferences.get("use_upnp"))
|
||||
self.glade.get_widget("chk_random_port").set_active(self.preferences.get("random_port"))
|
||||
self.glade.get_widget("chk_natpmp").set_active(self.preferences.get("use_natpmp"))
|
||||
self.glade.get_widget("chk_utpex").set_active(self.preferences.get("use_utpex"))
|
||||
self.glade.get_widget("chk_use_tray").set_active(self.preferences.get("enable_system_tray"))
|
||||
@ -135,6 +136,7 @@ class PreferencesDlg:
|
||||
self.preferences.set("tracker_proxy", self.glade.get_widget("chk_tracker_proxy").get_active())
|
||||
self.preferences.set("dht_proxy", self.glade.get_widget("chk_dht_proxy").get_active())
|
||||
self.preferences.set("use_upnp", self.glade.get_widget("chk_upnp").get_active())
|
||||
self.preferences.set("random_port", self.glade.get_widget("chk_random_port").get_active())
|
||||
self.preferences.set("use_natpmp", self.glade.get_widget("chk_natpmp").get_active())
|
||||
self.preferences.set("use_utpex", self.glade.get_widget("chk_utpex").get_active())
|
||||
self.preferences.set("enable_system_tray", self.glade.get_widget("chk_use_tray").get_active())
|
||||
@ -203,6 +205,13 @@ class PreferencesDlg:
|
||||
self.glade.get_widget('chk_lock_tray').set_active(value)
|
||||
elif widget == self.glade.get_widget('chk_lock_tray'):
|
||||
self.glade.get_widget('txt_tray_passwd').set_sensitive(value)
|
||||
elif widget == self.glade.get_widget('chk_move_completed'):
|
||||
if self.glade.get_widget('chk_random_port').get_active():
|
||||
self.glade.get_widget('spin_port_min').set_sensitive(False)
|
||||
self.glade.get_widget('spin_port_max').set_sensitive(False)
|
||||
else:
|
||||
self.glade.get_widget('spin_port_min').set_sensitive(True)
|
||||
self.glade.get_widget('spin_port_max').set_sensitive(True)
|
||||
|
||||
class MergeDlg:
|
||||
def __init__(self):
|
||||
|
@ -78,6 +78,7 @@ DEFAULT_PREFS = {
|
||||
"proxy_password" : "",
|
||||
"proxy_port": 8080,
|
||||
"queue_seeds_to_bottom" : False,
|
||||
"random_port" : False,
|
||||
"show_availability" : True,
|
||||
"show_dl" : True,
|
||||
"show_eta" : True,
|
||||
|
Loading…
x
Reference in New Issue
Block a user