set other as an option and not requirement for radio menus and changed label in glade file to be set by the plugin itself - fixes other in desired ratio plugin from saying 'Speed'

This commit is contained in:
Marcos Pinto 2007-07-15 07:04:38 +00:00
parent 5a103a4e35
commit ae0d21f115
3 changed files with 9 additions and 6 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.2.2 on Tue Jul 10 17:38:38 2007 by markybob@peg-->
<!--Generated with glade3 3.2.2 on Sun Jul 15 01:54:03 2007 by markybob@peg-->
<glade-interface>
<widget class="GtkDialog" id="remove_torrent_dlg">
<property name="title" translatable="yes">Remove Torrent</property>
@ -254,10 +254,9 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">10</property>
<child>
<widget class="GtkLabel" id="label2">
<widget class="GtkLabel" id="spin_title">
<property name="visible">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">Speed:</property>
</widget>
<packing>
<property name="expand">False</property>

View File

@ -32,7 +32,7 @@ def enable(core, interface):
### The Plugin ###
DEFAULT_PREFS = {
"ratios": [1.0, 1.5, 2.0, 3.0]
"ratios": [1.0, 1.5, 2.0, 2.5, 3.0]
}
import deluge
@ -64,7 +64,7 @@ class DesiredRatio:
self.ratio_menu = self.interface.build_menu_radio_list(self.config.get("ratios"), self.ratio_clicked, self.get_torrent_desired_ratio(), None, True, _("_Not Set"), 1)
self.ratio_menu = self.interface.build_menu_radio_list(self.config.get("ratios"), self.ratio_clicked, self.get_torrent_desired_ratio(), None, True, _("_Not Set"), 1, None)
self.ratio_menuitem.set_submenu(self.ratio_menu)
self.interface.torrent_menu.append(self.ratio_menuitem)
@ -102,6 +102,8 @@ class DesiredRatio:
if value == _("Other..."):
dialog_glade = gtk.glade.XML(deluge.common.get_glade_file("dgtkpopups.glade"))
speed_dialog = dialog_glade.get_widget("speed_dialog")
spin_title = dialog_glade.get_widget("spin_title")
spin_title.set_text(_("Desired Ratio"))
spin_speed = dialog_glade.get_widget("spin_speed")
spin_speed.set_value(self.get_torrent_desired_ratio())
spin_speed.set_increments(0.1, 1.0)

View File

@ -220,7 +220,7 @@ class DelugeGTK:
def build_menu_radio_list(self, value_list, callback, pref_value=None,
suffix=None, show_notset=False,
notset_label=None, notset_lessthan=0):
notset_label=None, notset_lessthan=0, show_other=False):
# Build a menu with radio menu items from a list and connect them to the callback
# The pref_value is what you would like to test for the default active radio item
# Setting show_unlimited will include an Unlimited radio item
@ -269,6 +269,8 @@ class DelugeGTK:
if str_bwdown == _("Other..."):
dialog_glade = gtk.glade.XML(common.get_glade_file("dgtkpopups.glade"))
speed_dialog = dialog_glade.get_widget("speed_dialog")
spin_title = dialog_glade.get_widget("spin_title")
spin_title.set_text(_("Speed:"))
spin_speed = dialog_glade.get_widget("spin_speed")
spin_speed.set_value(self.config.get("max_download_speed"))
spin_speed.select_region(0, -1)