Skip to content

Commit a00430d

Browse files
add multiple trackers at the same time
1 parent 43f3723 commit a00430d

File tree

9 files changed

+29
-24
lines changed

9 files changed

+29
-24
lines changed

defaulttrackers/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# __init__.py
33
#
4-
# Copyright (C) 2013 Stefan Talpalaru <[email protected]>
4+
# Copyright (C) 2013-2015 Stefan Talpalaru <[email protected]>
55
#
66
# Basic plugin template created by:
77
# Copyright (C) 2008 Martijn Voncken <[email protected]>

defaulttrackers/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# common.py
33
#
4-
# Copyright (C) 2013 Stefan Talpalaru <[email protected]>
4+
# Copyright (C) 2013-2015 Stefan Talpalaru <[email protected]>
55
#
66
# Basic plugin template created by:
77
# Copyright (C) 2008 Martijn Voncken <[email protected]>

defaulttrackers/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# core.py
33
#
4-
# Copyright (C) 2013 Stefan Talpalaru <[email protected]>
4+
# Copyright (C) 2013-2015 Stefan Talpalaru <[email protected]>
55
#
66
# Basic plugin template created by:
77
# Copyright (C) 2008 Martijn Voncken <[email protected]>

defaulttrackers/data/defaulttrackers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Script: defaulttrackers.js
33
The client-side javascript code for the DefaultTrackers plugin.
44
55
Copyright:
6-
(C) Stefan Talpalaru 2013 <[email protected]>
6+
(C) Stefan Talpalaru 2013-2015 <[email protected]>
77
This program is free software; you can redistribute it and/or modify
88
it under the terms of the GNU General Public License as published by
99
the Free Software Foundation; either version 3, or (at your option)

defaulttrackers/data/options.glade

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,10 @@
2727
<property name="visible">True</property>
2828
<property name="can_focus">False</property>
2929
<child>
30-
<widget class="GtkEntry" id="tracker_entry">
30+
<widget class="GtkTextView" id="tracker_entry">
31+
<property name="height_request">134</property>
3132
<property name="visible">True</property>
3233
<property name="can_focus">True</property>
33-
<property name="invisible_char">•</property>
34-
<property name="primary_icon_activatable">False</property>
35-
<property name="secondary_icon_activatable">False</property>
36-
<property name="primary_icon_sensitive">True</property>
37-
<property name="secondary_icon_sensitive">True</property>
3834
</widget>
3935
</child>
4036
</widget>
@@ -43,7 +39,7 @@
4339
<widget class="GtkLabel" id="label1">
4440
<property name="visible">True</property>
4541
<property name="can_focus">False</property>
46-
<property name="label" translatable="yes">&lt;b&gt;Tracker&lt;/b&gt;</property>
42+
<property name="label" translatable="yes">&lt;b&gt;Trackers&lt;/b&gt; (one per line)</property>
4743
<property name="use_markup">True</property>
4844
</widget>
4945
<packing>

defaulttrackers/gtkui.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# gtkui.py
33
#
4-
# Copyright (C) 2013 Stefan Talpalaru <[email protected]>
4+
# Copyright (C) 2013-2015 Stefan Talpalaru <[email protected]>
55
#
66
# Basic plugin template created by:
77
# Copyright (C) 2008 Martijn Voncken <[email protected]>
@@ -44,9 +44,9 @@
4444
from deluge.ui.client import client
4545
from deluge.plugins.pluginbase import GtkPluginBase
4646
import deluge.component as component
47-
import deluge.common
47+
#import deluge.common
4848
from deluge.ui.gtkui import dialogs
49-
from pprint import pprint
49+
#from pprint import pprint
5050

5151
from common import get_resource
5252

@@ -95,30 +95,39 @@ def show(self, options=None, item_id=None, item_index=None):
9595

9696
def load_options(self, options):
9797
if options:
98-
self.glade.get_widget("tracker_entry").set_text(options.get("url", ""))
98+
self.glade.get_widget("tracker_entry").get_buffer().set_text(options.get("url", ""))
99+
100+
def in_store(self, item):
101+
for row in self.gtkui.store:
102+
if row[0] == item:
103+
return True
104+
return False
99105

100106
def on_add(self, widget):
101107
try:
102108
options = self.generate_opts()
103-
self.gtkui.store.append([options["url"]])
104-
self.gtkui.trackers.append({"url": options["url"]})
109+
for url in options["urls"]:
110+
if not self.in_store(url):
111+
self.gtkui.store.append([url])
112+
self.gtkui.trackers.append({"url": url})
105113
except Exception, err:
106114
dialogs.ErrorDialog("Error", str(err), self.dialog).run()
107115

108116
def generate_opts(self):
109117
# generate options dict based on gtk objects
118+
buffer = self.glade.get_widget("tracker_entry").get_buffer()
110119
options = {
111-
"url": self.glade.get_widget("tracker_entry").get_text(),
120+
"urls": buffer.get_text(*buffer.get_bounds()).split(),
112121
}
113-
if len(options["url"]) == 0:
114-
raise Exception("empty URL")
122+
if len(options["urls"]) == 0:
123+
raise Exception("no URLs")
115124
return options
116125

117126
def on_apply(self, widget):
118127
try:
119128
options = self.generate_opts()
120-
self.gtkui.store[self.item_id][0] = options["url"]
121-
self.gtkui.trackers[self.item_index]["url"] = options["url"]
129+
self.gtkui.store[self.item_id][0] = options["urls"][0]
130+
self.gtkui.trackers[self.item_index]["url"] = options["urls"][0]
122131
except Exception, err:
123132
dialogs.ErrorDialog("Error", str(err), self.dialog).run()
124133

defaulttrackers/webui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# webui.py
33
#
4-
# Copyright (C) 2013 Stefan Talpalaru <[email protected]>
4+
# Copyright (C) 2013-2015 Stefan Talpalaru <[email protected]>
55
#
66
# Basic plugin template created by:
77
# Copyright (C) 2008 Martijn Voncken <[email protected]>

egg/DefaultTrackers-0.1-py2.7.egg

291 Bytes
Binary file not shown.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# setup.py
33
#
4-
# Copyright (C) 2013 Stefan Talpalaru <[email protected]>
4+
# Copyright (C) 2013-2015 Stefan Talpalaru <[email protected]>
55
#
66
# Basic plugin template created by:
77
# Copyright (C) 2008 Martijn Voncken <[email protected]>

0 commit comments

Comments
 (0)