summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Resch <andrewresch@gmail.com>2009-12-20 04:02:41 +0000
committerAndrew Resch <andrewresch@gmail.com>2009-12-20 04:02:41 +0000
commited2568c8b073bd3e0819ef2f8a45b5fb129899ed (patch)
tree7a989b218238ccc2d4c8206850c7de6edab2b13b
parent700fe2ec17e1e4a53febf68b5d7f33f4af5ad975 (diff)
downloaddeluge-ed2568c8b073bd3e0819ef2f8a45b5fb129899ed.tar.gz
deluge-ed2568c8b073bd3e0819ef2f8a45b5fb129899ed.tar.bz2
deluge-ed2568c8b073bd3e0819ef2f8a45b5fb129899ed.zip
Fix displaying folders in the add torrent dialog
-rw-r--r--ChangeLog3
-rw-r--r--deluge/ui/gtkui/addtorrentdialog.py20
2 files changed, 13 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 930c39257..d0db2c202 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@
==== GtkUI ====
* Fix #1104, #735 use path.utf-8 if available
+==== Windows ====
+ * Fix displaying folders in the add torrent dialog
+
=== Deluge 1.2.0_rc5 (17 December 2009) ===
==== Web ====
* Swap order of buttons in Remove window (Closes #1083)
diff --git a/deluge/ui/gtkui/addtorrentdialog.py b/deluge/ui/gtkui/addtorrentdialog.py
index fb253c6bf..f672d9ede 100644
--- a/deluge/ui/gtkui/addtorrentdialog.py
+++ b/deluge/ui/gtkui/addtorrentdialog.py
@@ -296,7 +296,7 @@ class AddTorrentDialog(component.Component):
self.listview_files.expand_row("0", False)
def prepare_file(self, file, file_name, file_num, download, files_storage):
- first_slash_index = file_name.find("/")
+ first_slash_index = file_name.find(os.path.sep)
if first_slash_index == -1:
files_storage[file_name] = (file_num, file, download)
else:
@@ -309,7 +309,7 @@ class AddTorrentDialog(component.Component):
def add_files(self, parent_iter, split_files):
ret = 0
for key,value in split_files.iteritems():
- if key.endswith("/"):
+ if key.endswith(os.path.sep):
chunk_iter = self.files_treestore.append(parent_iter,
[True, key, 0, -1, False, gtk.STOCK_DIRECTORY])
chunk_size = self.add_files(chunk_iter, value)
@@ -434,7 +434,7 @@ class AddTorrentDialog(component.Component):
if self.files_treestore.iter_has_child(iter):
self.build_priorities(self.files_treestore.iter_children(iter),
priorities)
- elif not self.files_treestore.get_value(iter, 1).endswith("/"):
+ elif not self.files_treestore.get_value(iter, 1).endswith(os.path.sep):
priorities[self.files_treestore.get_value(iter, 3)] = self.files_treestore.get_value(iter, 0)
iter = self.files_treestore.iter_next(iter)
return priorities
@@ -806,12 +806,12 @@ class AddTorrentDialog(component.Component):
parent = self.files_treestore.iter_parent(itr)
file_path = self.get_file_path(parent)
file_path += new_text
- file_path = file_path.replace("//", "/")
+ file_path = file_path.replace(os.path.sep*2, os.path.sep)
if "/" in new_text:
# There are folders in this path, so we need to create them
# and then move the file iter to top
- split_text = new_text.split("/")
+ split_text = new_text.split(os.path.sep)
for s in split_text[:-1]:
parent = self.files_treestore.append(parent,
[True, s, 0, -1, False, gtk.STOCK_DIRECTORY])
@@ -860,11 +860,11 @@ class AddTorrentDialog(component.Component):
# Update the treestore row first so that when walking the tree
# we can construct the new proper paths
- if len(new_text) == 0 or new_text[-1] != "/":
- new_text += "/"
+ if len(new_text) == 0 or new_text[-1] != os.path.sep:
+ new_text += os.path.sep
# We need to check if this folder has been split
- split_text = new_text[:-1].split("/")
+ split_text = new_text[:-1].split(os.path.sep)
if len(split_text) > 1:
# It's been split, so we need to add new folders and then reparent
# itr.
@@ -873,9 +873,9 @@ class AddTorrentDialog(component.Component):
# We don't iterate over the last item because we'll just use
# the existing itr and change the text
parent = self.files_treestore.append(parent,
- [True, s + "/", 0, -1, False, gtk.STOCK_DIRECTORY])
+ [True, s + os.path.sep, 0, -1, False, gtk.STOCK_DIRECTORY])
- self.files_treestore[itr][1] = split_text[-1] + "/"
+ self.files_treestore[itr][1] = split_text[-1] + os.path.sep
# Now reparent itr to parent
common.reparent_iter(self.files_treestore, itr, parent)