mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-17 05:47:50 +00:00
more label options
This commit is contained in:
parent
684b9f965e
commit
8f5e46a4ea
@ -65,7 +65,8 @@ OPTIONS_DEFAULTS = {
|
|||||||
"max_upload_slots":-1,
|
"max_upload_slots":-1,
|
||||||
"prioritize_first_last":False,
|
"prioritize_first_last":False,
|
||||||
"apply_max":False,
|
"apply_max":False,
|
||||||
"move_completed_to":"",
|
"move_completed":False,
|
||||||
|
"move_completed_path":"",
|
||||||
"apply_queue":False,
|
"apply_queue":False,
|
||||||
"is_auto_managed":False,
|
"is_auto_managed":False,
|
||||||
"stop_at_ratio":False,
|
"stop_at_ratio":False,
|
||||||
@ -183,7 +184,7 @@ class Core(CorePluginBase):
|
|||||||
|
|
||||||
if self.config["hide_zero_hits"]:
|
if self.config["hide_zero_hits"]:
|
||||||
for state in set(KNOWN_STATES):
|
for state in set(KNOWN_STATES):
|
||||||
log.debug(states.keys())
|
#log.debug(states.keys())
|
||||||
if states[state] == 0 :
|
if states[state] == 0 :
|
||||||
#del states[state]
|
#del states[state]
|
||||||
state_order.remove(state)
|
state_order.remove(state)
|
||||||
@ -214,10 +215,13 @@ class Core(CorePluginBase):
|
|||||||
else:
|
else:
|
||||||
no_label +=1
|
no_label +=1
|
||||||
|
|
||||||
|
#show all labels,even if hide-zero-hits is true
|
||||||
|
"""
|
||||||
if self.config["hide_zero_hits"]:
|
if self.config["hide_zero_hits"]:
|
||||||
for label , count in list(labels.iteritems()):
|
for label , count in list(labels.iteritems()):
|
||||||
if count == 0:
|
if count == 0:
|
||||||
del labels[label]
|
del labels[label]
|
||||||
|
"""
|
||||||
|
|
||||||
return [(NO_LABEL, no_label)] + [(label_id, labels[label_id]) for label_id in sorted(labels.keys())]
|
return [(NO_LABEL, no_label)] + [(label_id, labels[label_id]) for label_id in sorted(labels.keys())]
|
||||||
|
|
||||||
@ -272,7 +276,7 @@ class Core(CorePluginBase):
|
|||||||
CheckInput(label_id, _("Empty Label"))
|
CheckInput(label_id, _("Empty Label"))
|
||||||
CheckInput(not (label_id in self.labels) , _("Label already exists"))
|
CheckInput(not (label_id in self.labels) , _("Label already exists"))
|
||||||
|
|
||||||
self.labels[label_id] = OPTIONS_DEFAULTS
|
self.labels[label_id] = dict(OPTIONS_DEFAULTS)
|
||||||
log.debug("this is the file!")
|
log.debug("this is the file!")
|
||||||
|
|
||||||
def export_remove(self, label_id):
|
def export_remove(self, label_id):
|
||||||
@ -286,12 +290,22 @@ class Core(CorePluginBase):
|
|||||||
options = self.labels[label_id]
|
options = self.labels[label_id]
|
||||||
torrent = self.torrents[torrent_id]
|
torrent = self.torrents[torrent_id]
|
||||||
|
|
||||||
torrent.set_max_download_speed(options["max_download_speed"])
|
if options["apply_max"]:
|
||||||
torrent.set_max_upload_speed(options["max_upload_speed"])
|
torrent.set_max_download_speed(options["max_download_speed"])
|
||||||
torrent.set_max_connections(options["max_connections"])
|
torrent.set_max_upload_speed(options["max_upload_speed"])
|
||||||
torrent.set_max_upload_slots(options["max_upload_slots"])
|
torrent.set_max_connections(options["max_connections"])
|
||||||
torrent.set_prioritize_first_last(options["prioritize_first_last"])
|
torrent.set_max_upload_slots(options["max_upload_slots"])
|
||||||
|
torrent.set_prioritize_first_last(options["prioritize_first_last"])
|
||||||
|
|
||||||
|
if options["apply_queue"]:
|
||||||
|
torrent.set_auto_managed(options['is_auto_managed'])
|
||||||
|
torrent.set_stop_at_ratio(options['stop_at_ratio'])
|
||||||
|
torrent.set_stop_ratio(options['stop_ratio'])
|
||||||
|
torrent.set_remove_at_ratio(options['remove_at_ratio'])
|
||||||
|
|
||||||
|
if options["move_completed"]:
|
||||||
|
#todo...
|
||||||
|
pass
|
||||||
|
|
||||||
def export_set_options(self, label_id, options_dict , apply = False):
|
def export_set_options(self, label_id, options_dict , apply = False):
|
||||||
"""update the label options
|
"""update the label options
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||||
<!--Generated with glade3 3.4.5 on Thu Jul 31 22:43:12 2008 -->
|
<!--Generated with glade3 3.4.5 on Sun Aug 3 21:52:58 2008 -->
|
||||||
<glade-interface>
|
<glade-interface>
|
||||||
<widget class="GtkDialog" id="dlg_label_options">
|
<widget class="GtkDialog" id="dlg_label_options">
|
||||||
<property name="border_width">5</property>
|
<property name="border_width">5</property>
|
||||||
@ -48,13 +48,20 @@
|
|||||||
<placeholder/>
|
<placeholder/>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<widget class="GtkLabel" id="label16">
|
||||||
|
<property name="width_request">30</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkCheckButton" id="apply_max">
|
<widget class="GtkCheckButton" id="apply_max">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="label" translatable="yes">Apply max settings:</property>
|
<property name="label" translatable="yes">Apply per torrent max settings:</property>
|
||||||
<property name="response_id">0</property>
|
<property name="response_id">0</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -267,17 +274,30 @@
|
|||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<placeholder/>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label13">
|
<widget class="GtkLabel" id="label13">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes">warning : not effective yet</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="right_attach">3</property>
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
<property name="top_attach">6</property>
|
<property name="top_attach">6</property>
|
||||||
<property name="bottom_attach">7</property>
|
<property name="bottom_attach">7</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label17">
|
||||||
|
<property name="width_request">30</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkCheckButton" id="apply_queue">
|
<widget class="GtkCheckButton" id="apply_queue">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@ -295,6 +315,7 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="adjustment">2 1 100 1 10 10</property>
|
<property name="adjustment">2 1 100 1 10 10</property>
|
||||||
|
<property name="digits">2</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">2</property>
|
<property name="left_attach">2</property>
|
||||||
@ -387,23 +408,99 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox4">
|
<widget class="GtkTable" id="table3">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="n_rows">7</property>
|
||||||
|
<property name="n_columns">2</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkCheckButton" id="chk_move_completed_to">
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label20">
|
||||||
|
<property name="width_request">30</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
<property name="x_options"></property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label19">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">5</property>
|
||||||
|
<property name="bottom_attach">6</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label18">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">4</property>
|
||||||
|
<property name="bottom_attach">5</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label9">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">3</property>
|
||||||
|
<property name="bottom_attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label25">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
<property name="bottom_attach">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkFileChooserButton" id="move_completed_path">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkCheckButton" id="move_completed">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="label" translatable="yes">Move completed to:</property>
|
<property name="label" translatable="yes">Move completed to:</property>
|
||||||
<property name="response_id">0</property>
|
<property name="response_id">0</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkFileChooserButton" id="move_completed_to">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">1</property>
|
<property name="right_attach">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@ -412,31 +509,9 @@
|
|||||||
<property name="label" translatable="yes">warning : not effective yet</property>
|
<property name="label" translatable="yes">warning : not effective yet</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">2</property>
|
<property name="right_attach">2</property>
|
||||||
</packing>
|
<property name="top_attach">6</property>
|
||||||
</child>
|
<property name="bottom_attach">7</property>
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label18">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="position">3</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label19">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="position">4</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label20">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="position">5</property>
|
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
@ -445,7 +520,7 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label9">
|
<widget class="GtkLabel" id="label21">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes">Location</property>
|
<property name="label" translatable="yes">Location</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -455,6 +530,58 @@
|
|||||||
<property name="tab_fill">False</property>
|
<property name="tab_fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkVBox" id="vbox2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label22">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Automatically apply label:</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkTextView" id="trackers">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="text" translatable="yes">tracker1.org
|
||||||
|
tracker2.com
|
||||||
|
this doesn't do anything yet, be patient.
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label23">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes"><i>(1 line per tracker)</i></property>
|
||||||
|
<property name="use_markup">True</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="position">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label99">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Trackers</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="type">tab</property>
|
||||||
|
<property name="position">3</property>
|
||||||
|
<property name="tab_fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
|
@ -120,12 +120,12 @@ class AddDialog(object):
|
|||||||
|
|
||||||
class OptionsDialog(object):
|
class OptionsDialog(object):
|
||||||
spin_ids = ["max_download_speed","max_upload_speed","max_upload_slots","max_connections","stop_ratio"]
|
spin_ids = ["max_download_speed","max_upload_speed","max_upload_slots","max_connections","stop_ratio"]
|
||||||
chk_ids = ["apply_max","apply_queue","stop_at_ratio","apply_queue","remove_at_ratio","chk_move_completed_to"]
|
chk_ids = ["apply_max","apply_queue","stop_at_ratio","apply_queue","remove_at_ratio","move_completed","is_auto_managed"]
|
||||||
sensitive_groups = { #keys must be checkboxes , value-list is to be enabled on checked.
|
sensitive_groups = { #keys must be checkboxes , value-list is to be enabled on checked.
|
||||||
"apply_max": ["max_download_speed","max_upload_speed","max_upload_slots","max_connections"],
|
"apply_max": ["max_download_speed","max_upload_speed","max_upload_slots","max_connections"],
|
||||||
"apply_queue":["is_auto_managed","remove_at_ratio","stop_at_ratio","stop_ratio"],
|
"apply_queue":["is_auto_managed","remove_at_ratio","stop_at_ratio","stop_ratio"],
|
||||||
#"stop_at_ratio":["stop_at_ratio","remove_at_ratio"], #nested from apply_queue, will probably cause bugs.
|
#"stop_at_ratio":["stop_at_ratio","remove_at_ratio"], #nested from apply_queue, will probably cause bugs.
|
||||||
"chk_move_completed_to":["move_completed_to"]
|
"move_completed":["move_completed_path"]
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -151,30 +151,24 @@ class OptionsDialog(object):
|
|||||||
|
|
||||||
def load_options(self, options):
|
def load_options(self, options):
|
||||||
log.debug(options.keys())
|
log.debug(options.keys())
|
||||||
options["chk_move_completed_to"] = bool(options["move_completed_to"])
|
|
||||||
for id in self.spin_ids:
|
for id in self.spin_ids:
|
||||||
self.glade.get_widget(id).set_value(options[id])
|
self.glade.get_widget(id).set_value(options[id])
|
||||||
for id in self.chk_ids:
|
for id in self.chk_ids:
|
||||||
self.glade.get_widget(id).set_active(bool(options[id]))
|
self.glade.get_widget(id).set_active(bool(options[id]))
|
||||||
|
self.glade.get_widget("move_completed_path").set_filename(options["move_completed_path"])
|
||||||
if options["move_completed_to"]:
|
|
||||||
self.glade.get_widget("move_completed_to").set_filename(options["move_completed_to"])
|
|
||||||
|
|
||||||
self.apply_sensitivity()
|
self.apply_sensitivity()
|
||||||
|
|
||||||
def on_ok(self, event=None):
|
def on_ok(self, event=None):
|
||||||
"save options.."
|
"save options.."
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
for id in self.spin_ids:
|
for id in self.spin_ids:
|
||||||
options[id] = self.glade.get_widget(id).get_value()
|
options[id] = self.glade.get_widget(id).get_value()
|
||||||
for id in self.chk_ids:
|
for id in self.chk_ids:
|
||||||
options[id] = self.glade.get_widget(id).get_active()
|
options[id] = self.glade.get_widget(id).get_active()
|
||||||
|
options["move_completed_path"] = self.glade.get_widget("move_completed_path").get_filename()
|
||||||
if options["chk_move_completed_to"]:
|
|
||||||
options["move_completed_to"] = self.glade.get_widget("move_completed_to").get_filename()
|
|
||||||
else:
|
|
||||||
options["move_completed_to"] = None
|
|
||||||
del options["chk_move_completed_to"] #not mapped.
|
|
||||||
|
|
||||||
|
|
||||||
aclient.label_set_options(None, self.label, options)
|
aclient.label_set_options(None, self.label, options)
|
||||||
@ -185,7 +179,6 @@ class OptionsDialog(object):
|
|||||||
for chk_id , sensitive_list in self.sensitive_groups.iteritems():
|
for chk_id , sensitive_list in self.sensitive_groups.iteritems():
|
||||||
sens = self.glade.get_widget(chk_id).get_active()
|
sens = self.glade.get_widget(chk_id).get_active()
|
||||||
for widget_id in sensitive_list:
|
for widget_id in sensitive_list:
|
||||||
log.debug(widget_id)
|
|
||||||
self.glade.get_widget(widget_id).set_sensitive(sens)
|
self.glade.get_widget(widget_id).set_sensitive(sens)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user