make test active port use internal graphic instead of launching browser

This commit is contained in:
Marcos Pinto 2008-12-16 02:49:06 +00:00
parent f136d41b62
commit 24a0ccee0a
5 changed files with 42 additions and 15 deletions

View File

@ -31,6 +31,7 @@ Deluge 1.1.0 - "" (In Development)
* Add protocol traffic statusbar item
* Rework the Remove Torrent Dialog to only have 2 options, remove data and remove from session.
* Add "Install Plugin" and "Rescan Plugins" buttons to the Plugins preferences
* Make active port test use internal graphic instead of launching browser
WebUi:
* Lots of smaller tweaks.

View File

@ -790,3 +790,15 @@ class Core(
def export_glob(self, path):
return glob.glob(path)
def export_test_listen_port(self):
""" Checks if active port is open """
import urllib
port = self.export_get_listen_port()
try:
status = urllib.urlopen("http://deluge-torrent.org/test_port.php?port=%s" % port).read()
except IOError:
log.debug("Network error while trying to check status of port %s", port)
return 0
else:
return int(status)

View File

@ -1,6 +1,5 @@
<?xml version="1.0"?>
<glade-interface>
<requires-version lib="gtk+" version="2.12"/>
<widget class="GtkDialog" id="addhost_dialog">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Mon Dec 8 21:18:16 2008 -->
<?xml version="1.0"?>
<glade-interface>
<widget class="GtkDialog" id="pref_dialog">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@ -449,8 +447,8 @@
<property name="label" translatable="yes">page 6</property>
</widget>
<packing>
<property name="type">tab</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
<child>
@ -645,6 +643,21 @@
<property name="position">4</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment48">
<property name="visible">True</property>
<property name="left_padding">5</property>
<child>
<widget class="GtkImage" id="port_img">
<property name="visible">True</property>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">5</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">5</property>
@ -1147,9 +1160,9 @@ Disabled</property>
<property name="label" translatable="yes">page 7</property>
</widget>
<packing>
<property name="type">tab</property>
<property name="position">1</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
<child>
@ -1639,9 +1652,9 @@ Disabled</property>
<property name="label" translatable="yes">page 8</property>
</widget>
<packing>
<property name="type">tab</property>
<property name="position">2</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
<child>
@ -2009,9 +2022,9 @@ Disabled</property>
<property name="label" translatable="yes">page 10</property>
</widget>
<packing>
<property name="type">tab</property>
<property name="position">3</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
<child>
@ -2203,9 +2216,9 @@ Disabled</property>
<property name="label" translatable="yes">page 11</property>
</widget>
<packing>
<property name="type">tab</property>
<property name="position">4</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
<child>
@ -2424,9 +2437,9 @@ Disabled</property>
<property name="label" translatable="yes">page 11</property>
</widget>
<packing>
<property name="type">tab</property>
<property name="position">5</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
<child>
@ -2883,9 +2896,9 @@ Disabled</property>
<property name="label" translatable="yes">page 12</property>
</widget>
<packing>
<property name="type">tab</property>
<property name="position">6</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
<child>

View File

@ -790,10 +790,12 @@ class Preferences(component.Component):
def on_test_port_clicked(self, data):
log.debug("on_test_port_clicked")
def on_get_listen_port(port):
deluge.common.open_url_in_browser(
"http://deluge-torrent.org/test-port.php?port=%s" % port)
client.get_listen_port(on_get_listen_port)
def on_get_test(status):
if status:
self.glade.get_widget("port_img").set_from_stock(gtk.STOCK_YES, 4).show()
else:
self.glade.get_widget("port_img").set_from_stock(gtk.STOCK_DIALOG_WARNING, 4).show()
client.test_listen_port(on_get_test)
client.force_call()
def on_plugin_toggled(self, renderer, path):