Opened 2 years ago

Last modified 21 months ago

#2169 reopened bug

Add Torrent Dialog's ' Download Location' not set correctly when directory typed into Other->Location field

Reported by: beaux_monde Owned by: Cas
Priority: minor Milestone: not applicable
Component: other/unknown Version: 1.3.5
Keywords: Cc: slowrobot@…, inbox-sites@…

Description

When I add a new torrent from Mozilla Firefox by choosing "Open with" it is difficult to set up desired save path in adding torrent dialog. I sighted that if I switch between tabs in that dialog then save path sets correctly, but else it sets to my home directory.
I run it in KDE.

Attachments (2)

deluge-log-partial.log (2.3 KB) - added by ferp 23 months ago.
the log.txt (46.3 KB) - added by hadrons123 23 months ago.
The debug log

Download all attachments as: .zip

Change History (46)

comment:1 Changed 2 years ago by Cas

  • Milestone changed from 1.3.x to Future
  • Status changed from new to pending

I am sorry but I am not sure what you are asking for. You could try wording it differently or maybe supply a screenshot of the issue or proposed solution.

comment:2 Changed 2 years ago by beaux_monde

  • Status changed from pending to new
  1. In FireFox? choose some URI with torrent-file; when FF ask what to do with it choose point "Open with Deluge"
  2. Deluge starts (or pops up if started -- no matter) and the "Add torrents" dialog brings up.
  3. Switch to options tab and try to choose a save path.
  4. Press Add button and see that save path (need to turn on this column first) is... your home directory.

I was trying to research this issue but as far as I see this maybe related to that I running KDE.
And one more: if between 3 and 4 points above I switched between tabs inside the dialog save path was set correctly.

comment:3 Changed 2 years ago by Cas

  • Milestone changed from Future to 1.3.6
  • Owner set to Cas
  • Status changed from new to assigned
  • Summary changed from It is difficult to set up a save path to Add torrent dialog's 'save path' not set correctly in KDE

Thanks I understand the issue now. This could well be a KDE specific issue but I will need to download a KDE distro in order to test it.

comment:4 Changed 23 months ago by ferp

  • Cc slowrobot@… added

I also have this exact same issue in Deluge 1.3.5 on MacOS 10.7.5 Re-adding the torrent (without exiting Deluge) will save to the user-specified location. Re-adding after restarting Deluge will ignore the user-specified location and save to $HOME.

comment:5 Changed 23 months ago by Cas

This is odd as it has also been reported on Fedora F17

I will look into this further but I could not replicate on KDE specific distro and unless I can replicate it will be very difficult to determine the issue.

comment:6 Changed 23 months ago by Cas

  • Summary changed from Add torrent dialog's 'save path' not set correctly in KDE to Add torrent dialog's 'save path' not set correctly

comment:7 Changed 23 months ago by hadrons123

I have gnome 3.4 in Fedora 17 and Arch linux and it happens to me too. I have the latest Deluge 1.3.5.

comment:8 Changed 23 months ago by Cas

I have just downloaded and tested with a fresh virutalbox Fedora 17 and I still cannot replicate this. There must be something in the steps that is being omitted.

Are there any errors in logs?

comment:9 Changed 23 months ago by hadrons123

Did you try like this?

Description of problem:
When you add a torrent you should be able to download it to a user specified location on your hard disk. But in Deluge 1.3.5 when you select file->add a torrent->options->downloadlocation-> other(scroll down to the lowest in the menu). What ever location you set in "other" is not recognized by the application and it sets itself to default /home/user/Downloads.

So basically the "other" option is not working.

comment:10 Changed 23 months ago by Cas

I could select any directory with the Other option and it would select it and start downloading correctly.

Could try with a new Deluge config (-c switch) or test for yourself with a Virtualbox Fedora it may provide more information.

comment:11 Changed 23 months ago by hadrons123

I could not make it download to my preferred folder with the Other option, Yet. The download starts but at the wrong location.
I am using 64bit of Arch, Fedora. I tried both of them right now.

But about the config switch, how do I do it?

comment:12 Changed 23 months ago by Cas

| But about the config switch, how do I do it?

deluge -c ~/deluge_config

Are you using libtorrent 0.16?

comment:13 Changed 23 months ago by hadrons123

my libtorrent version is
libtorrent: 0.15.9.0 in fedora 17.

I tried your method but I am getting the same behaviour.
deluge -c ~/deluge_config

If there is a way I could post a log output I would be happy to post.

Changed 23 months ago by ferp

comment:14 Changed 23 months ago by ferp

The above log is from MacOS 10.7.5 and shows me adding a .torrent from $HOME/Downloads, specifying a save location of /var/tmp/, and you can see the torrent get added with options[download_location] set to $HOME instead of /var/tmp.

comment:15 Changed 23 months ago by ferp

Same behavior on Natty with a fresh install of 1.3.1-1ubuntu2, by the way.

Changed 23 months ago by hadrons123

The debug log

comment:16 Changed 23 months ago by Cas

I have made a fedora screencast to show what I think is being reported and what I am seeing, just in case I have got the wrong end of the stick...

comment:17 Changed 23 months ago by ferp

Yup that's the right flow. Except, in my case, I specified the directory by typing /var/tmp, which brings up the "Location" field in the "Select A Folder" dialog. When I do it your way, navigating to /var/tmp/ with the mouse, it works.

comment:18 Changed 23 months ago by Cas

  • Summary changed from Add torrent dialog's 'save path' not set correctly to Add Torrent Dialog's ' Download Location' not set correctly when directory typed into Other->Location field

Ah! I can finally replicate the issue by typing in the location field, thanks ferp.

Well now we know neither me nor anyone else here is crazy :P

comment:19 Changed 23 months ago by Cas

Looking into this issue it appears that using get_current_folder() in the file chooser will not return the correct folder in the above situation and the solution is to simply replace it with get_filename().

PyGTK Doc: get-filename()

comment:20 Changed 23 months ago by Cas

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed 1.3-stable: aa969fd830

comment:21 Changed 23 months ago by beaux_monde

  • Resolution fixed deleted
  • Status changed from closed to reopened

I applied your patch, but...

  1. In FireFox? choose some URI with torrent-file; when FF ask what to do with it choose point "Open with Deluge"
  2. Deluge starts (or pops up if started -- no matter) and the "Add torrents" dialog brings up.
  3. Switch to options tab and try to choose a save path (using "Other..." option).
  4. Press Add button and see that save path (need to turn on this column first) is... STILL your home directory.

If I try to reopen torrent file and if I choose previously chosen (and therefore saved in pop up list which contain $HOME, Desktop, File system and "Other..." options) then Download location set correctly.

comment:22 Changed 23 months ago by hadrons123

I still have the same issue too. The patch doesn't resolve it.
thanks beaux_monde for bringing it up.

comment:23 follow-up: Changed 23 months ago by Cas

Please take a screencast and share the link to it.

comment:24 in reply to: ↑ 23 Changed 23 months ago by beaux_monde

Replying to Cas:

Please take a screencast and share the link to it.

http://rghost.net/40808058

comment:25 Changed 23 months ago by Cas

Please add the following log lines and post the log output from both working and non-working steps.

diff --git a/deluge/ui/gtkui/addtorrentdialog.py b/deluge/ui/gtkui/addtorrentdialog.py
index a26acf0..760c558 100644
--- a/deluge/ui/gtkui/addtorrentdialog.py
+++ b/deluge/ui/gtkui/addtorrentdialog.py
@@ -406,6 +406,10 @@ def save_torrent_options(self, row=None):
         if client.is_localhost():
             options["download_location"] = \
                 self.glade.get_widget("button_location").get_filename()
+            log.error("DwnLoc filename: %s", self.glade.get_widget("button_location").get_filename())
+            log.error("DwnLoc uri: %s", self.glade.get_widget("button_location").get_uri())
+            log.error("DwnLoc curr fold: %s", self.glade.get_widget("button_location").get_current_folder())
+           log.error("DwnLoc config: %s", options["download_location"])
         else:
             options["download_location"] = \
                 self.glade.get_widget("entry_download_path").get_text()

comment:26 follow-up: Changed 23 months ago by beaux_monde

~$ deluge

** (deluge:16202): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags'

** (deluge:16202): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags'

** (deluge:16202): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags'
Traceback (most recent call last):
  File "/usr/bin/deluge", line 9, in <module>
    load_entry_point('deluge==1.3.5', 'gui_scripts', 'deluge')()
  File "/usr/lib/python2.7/site-packages/deluge/main.py", line 132, in start_ui
    UI(options, args, options.args)
  File "/usr/lib/python2.7/site-packages/deluge/ui/ui.py", line 149, in __init__
    from deluge.ui.gtkui.gtkui import GtkUI
  File "/usr/lib/python2.7/site-packages/deluge/ui/gtkui/__init__.py", line 1, in <module>
    from gtkui import start
  File "/usr/lib/python2.7/site-packages/deluge/ui/gtkui/gtkui.py", line 91, in <module>
    from addtorrentdialog import AddTorrentDialog
  File "/usr/lib/python2.7/site-packages/deluge/ui/gtkui/addtorrentdialog.py", line 413
    log.error("DwnLoc curr fold: %s", self.glade.get_widget("button_location").get_current_
      ^
SyntaxError: invalid syntax

comment:27 in reply to: ↑ 26 Changed 23 months ago by beaux_monde

Replying to beaux_monde:

~$ deluge

** (deluge:16202): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags'

** (deluge:16202): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags'

** (deluge:16202): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags'
Traceback (most recent call last):
  File "/usr/bin/deluge", line 9, in <module>
    load_entry_point('deluge==1.3.5', 'gui_scripts', 'deluge')()
  File "/usr/lib/python2.7/site-packages/deluge/main.py", line 132, in start_ui
    UI(options, args, options.args)
  File "/usr/lib/python2.7/site-packages/deluge/ui/ui.py", line 149, in __init__
    from deluge.ui.gtkui.gtkui import GtkUI
  File "/usr/lib/python2.7/site-packages/deluge/ui/gtkui/__init__.py", line 1, in <module>
    from gtkui import start
  File "/usr/lib/python2.7/site-packages/deluge/ui/gtkui/gtkui.py", line 91, in <module>
    from addtorrentdialog import AddTorrentDialog
  File "/usr/lib/python2.7/site-packages/deluge/ui/gtkui/addtorrentdialog.py", line 413
    log.error("DwnLoc curr fold: %s", self.glade.get_widget("button_location").get_current_
      ^
SyntaxError: invalid syntax

Sorry, it looks like I'm wrong

comment:28 Changed 23 months ago by Cas

Sorry its my copy and paste mistake, try again with amended diff.

comment:29 Changed 23 months ago by beaux_monde

[ERROR   ] 14:48:49 addtorrentdialog:411 DwnLoc filename: /home/serge
[ERROR   ] 14:48:49 addtorrentdialog:412 DwnLoc uri: file:///home/serge
[ERROR   ] 14:48:49 addtorrentdialog:413 DwnLoc curr fold: /home/serge
[ERROR   ] 14:48:49 addtorrentdialog:414 DwnLoc config: /home/serge
[ERROR   ] 14:48:51 addtorrentdialog:411 DwnLoc filename: /home/serge
[ERROR   ] 14:48:51 addtorrentdialog:412 DwnLoc uri: file:///home/serge
[ERROR   ] 14:48:51 addtorrentdialog:413 DwnLoc curr fold: /home/serge
[ERROR   ] 14:48:51 addtorrentdialog:414 DwnLoc config: /home/serge
[ERROR   ] 14:49:02 addtorrentdialog:411 DwnLoc filename: /home/serge
[ERROR   ] 14:49:02 addtorrentdialog:412 DwnLoc uri: file:///home/serge
[ERROR   ] 14:49:02 addtorrentdialog:413 DwnLoc curr fold: /home/serge
[ERROR   ] 14:49:02 addtorrentdialog:414 DwnLoc config: /home/serge
[ERROR   ] 14:49:35 addtorrentdialog:411 DwnLoc filename: /home/serge/temp
[ERROR   ] 14:49:35 addtorrentdialog:412 DwnLoc uri: file:///home/serge/temp
[ERROR   ] 14:49:35 addtorrentdialog:413 DwnLoc curr fold: /home/serge/temp
[ERROR   ] 14:49:35 addtorrentdialog:414 DwnLoc config: /home/serge/temp
[ERROR   ] 14:49:49 addtorrentdialog:411 DwnLoc filename: /home/serge/temp
[ERROR   ] 14:49:49 addtorrentdialog:412 DwnLoc uri: file:///home/serge/temp
[ERROR   ] 14:49:49 addtorrentdialog:413 DwnLoc curr fold: /home/serge/temp
[ERROR   ] 14:49:49 addtorrentdialog:414 DwnLoc config: /home/serge/temp

comment:30 Changed 23 months ago by Cas

What is that log of, the bug? Please provide context.

Also please use the WikiFormatting code tags.

comment:31 Changed 23 months ago by Cas

  • Resolution set to fixed
  • Status changed from reopened to closed

comment:32 Changed 23 months ago by beaux_monde

How do you fix it?

comment:33 Changed 23 months ago by Cas

I cannot replicate any further issues to the one I fixed and you have not provided any more information which I asked for in my last comment, so I closed it.

comment:34 Changed 23 months ago by pvgoran

It's a bug in GTK+, not in Deluge: https://bugzilla.gnome.org/show_bug.cgi?id=684128

Though Deluge devs could try to find and implement a work-around...

From the user perspective, I found out that the following allows me to use the directory I choose: select "Other", choose a directory, then switch to "File System" in the drop-down and switch back to the chosen directory again.

The other option is to downgrade GTK+ to 2.24.10.

comment:35 Changed 23 months ago by pvgoran

  • Cc inbox-sites@… added

comment:36 Changed 23 months ago by beaux_monde

It looks like a true 'cause I had some investigation of this bug (in deluge) and I have got the same result.

comment:37 Changed 23 months ago by hadrons123

The bug is real trouble for lot of people.see here
https://bbs.archlinux.org/viewtopic.php?pid=1173740

comment:38 Changed 23 months ago by beaux_monde

wow!
I use just the arch distro...
:-)

comment:39 Changed 23 months ago by hadrons123

It happens in fedora 17 too.

comment:40 Changed 23 months ago by Cas

  • Component changed from gtkui to other
  • Resolution fixed deleted
  • Status changed from closed to reopened

I had a feeling from the last debug logs that it was GTK issue and it's strange that I did not see this in F17 when testing previously however updated it and now see the issue along with a temporary workaround:

diff --git a/deluge/ui/gtkui/addtorrentdialog.py b/deluge/ui/gtkui/addtorrentdialog.py
index a26acf0..f4077c2 100644
--- a/deluge/ui/gtkui/addtorrentdialog.py
+++ b/deluge/ui/gtkui/addtorrentdialog.py
@@ -147,6 +147,12 @@ def __init__(self):
         self.core_config = {}
 
         self.glade.get_widget("notebook1").connect("switch-page", self._on_switch_page)
+        self.glade.get_widget("button_location").connect("current-folder-changed", self._on_folder_selected)
+        self.on_folder_selected_path = ""
+
+    def _on_folder_selected(self, widget):
+        log.debug("Selected folder path: %s", widget.get_filename())
+        self.on_folder_selected_path = widget.get_filename()
 
     def start(self):
         self.update_core_config()
@@ -405,7 +411,9 @@ def save_torrent_options(self, row=None):
 
         if client.is_localhost():
             options["download_location"] = \
-                self.glade.get_widget("button_location").get_filename()
+                self.on_folder_selected_path
+            log.debug("Dl folder: %s", self.glade.get_widget("button_location").get_filename())
+            log.debug("Dl signal: %s", self.on_folder_selected_path)
         else:
             options["download_location"] = \
                 self.glade.get_widget("entry_download_path").get_text()

comment:41 Changed 23 months ago by beaux_monde

It looks like this workaround solves the problem.

comment:42 Changed 22 months ago by MasterCATZ

self.core_config = {}

        self.builder.get_object("notebook1").connect("switch-page", self._on_switch_page)

    def start(self):
        self.update_core_config()

mine did not have

self.glade.get_widget("notebook1").connect("switch-page", self._on_switch_page)  

either so do I also add that and remove

self.builder.get_object("notebook1").connect("switch-page", self._on_switch_page)

??

do I change these self.builder to self.glade as well ?

if client.is_localhost():
            options["download_location"] = \
                self.builder.get_object("button_location").get_filename()
        else:
            options["download_location"] = \
                self.builder.get_object

using git master afak I would have thought the patch would have already been applied to it ?

comment:43 Changed 22 months ago by Cas

Since this is a bug in GTK, this hacky workaround will not be applied to our codebase. I am keeping the ticket open to keep track of the upstream bug: https://bugzilla.gnome.org/show_bug.cgi?id=684128

If you are using git master then self.builder is the new object reference so you simply replace in the diff code above self.glade.get_widget with self.builder.get_object and it should work.

comment:44 Changed 21 months ago by Cas

  • Milestone changed from 1.3.6 to not applicable
Note: See TracTickets for help on using tickets.