Modifications to GTKUI Client - adding and moving torrents

Suggestions and discussion of future versions
Post Reply
bro
Top Bloke
Top Bloke
Posts: 364
Joined: Sun Aug 28, 2011 6:46 pm
Location: Norway

Modifications to GTKUI Client - adding and moving torrents

Post by bro »

Hi

I've made some changes that fixes a few serious annoyances I have when using the GTKUI client with a remote daemon.
  • Changed "Move completed" dialog to use a ComboBox. This is a ComboBox are loaded with previously saved paths.
    Then I don't have to type in the same paths over and over again.
  • Made the "Moved completed" text field in the Options pane of each torrent expand when the window is resized. The default width is too small.
Add Torrent dialog
  • Added "Move completed to" option in the "Add Torrent" dialog. This is a ComboBox which uses the same saved paths as in the "Move Completed" dialog.
  • Added right click popup menu in the torrent list with the button "Copy title to clipboard". Sometimes the filenames do not correspond to the title at all, and it's a hassle to go find the title somewhere else and copy/paste to give the files a proper name.
  • Added right click popup menu in the files list with two options that greatly eases the work to add torrents.
    • Normalize filename
    • Place all items in a root directory.
    Normalize filename
    This is function which basically runs a series of regex replaces on the title. I prefer to not have any spaces in the filenames, so I have the following regexes:

    Code: Select all

    import re
    filename = re.sub(" - ", "-", filename)
    # For sound e.g. 7.1, to replace with "-7.1-" to avoid ".7.1." 
    filename = re.sub(" (\d)\.(\d) ", "-\g<1>.\g<2>-", filename)
    # If last in name
    filename = re.sub(" (\d)\.(\d)", "-\g<1>.\g<2>", filename)
    # For punctuation with a following space, e.g. when punctuation is in the title.
    filename = re.sub("\. ", ".-", filename)
    # Replace all spaces with punctuation
    filename = re.sub(" ", ".", filename)
    It would be easy to have a few different configurations with different regexes, and also have the user provide a custom config.

    Place all items in a root directory
    I prefer having all torrents in one root directory. Many torrents have multiple files, and some have simply one file.
    This function creates a root directory with the name of the currently selected file (subtracted the extension) and places all the files in this directory (keeping the original tree structure).
  • Also fixed a bug (or is it intended?) with renaming directories, where a directory renamed to an empty string is actually removed instead of just having an empty name.
One problem with the ComboBoxes is that they require GTK+ 2.24, whereas the current glade files are set for 2.16.

Would you consider including any of these changes in Deluge?
When reporting issues, please include any relevant information such as OS (and version), python version (for Windows users this depends on which Deluge installer was used), Deluge version and plugin version.
Cas
Top Bloke
Top Bloke
Posts: 3681
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: Modifications to GTKUI Client - adding and moving torren

Post by Cas »

bro wrote:Place all items in a root directory
I am not sure what this is solving.
bro wrote: Added "Move completed to" option in the "Add Torrent" dialog. This is a ComboBox which uses the same saved paths as in the "Move Completed" dialog.
There is a ticket for this so if you add a patch it will be reviewed and added.
bro wrote: Made the "Moved completed" text field in the Options pane of each torrent expand when the window is resized. The default width is too small.
Seems reasonable.
bro wrote: Added right click popup menu in the torrent list with the button "Copy title to clipboard". Sometimes the filenames do not correspond to the title at all, and it's a hassle to go find the title somewhere else and copy/paste to give the files a proper name.
Seems reasonable.
bro wrote:Added right click popup menu in the files list with two options that greatly eases the work to add torrents.
Normalize filename

It seems that normalize would be dependant on user's preferences and we might end up with lots of requests for different flavours.
bro wrote:Place all items in a root directory.
Might be useful to have to opposite option so that users can 'undo' it.
bro wrote:Also fixed a bug (or is it intended?) with renaming directories, where a directory renamed to an empty string is actually removed instead of just having an empty name.
Why would you have a directory with an empty string? I guess if the above option has been added then it would obsolete this 'feature'.
bro wrote:One problem with the ComboBoxes is that they require GTK+ 2.24, whereas the current glade files are set for 2.16.
Comboboxes do not require 2.24, they are already in use in Encryption settings.
bro
Top Bloke
Top Bloke
Posts: 364
Joined: Sun Aug 28, 2011 6:46 pm
Location: Norway

Re: Modifications to GTKUI Client - adding and moving torren

Post by bro »

Cas wrote:
bro wrote:Place all items in a root directory
I am not sure what this is solving.
  • A helper to create directories will make it easier for people to actually become aware of the possibility. I didn't know it was possible to create directories by renaming for a long time myself ;-)
  • It's faster than copying the title and renaming the file, especially if there are many files.
Cas wrote:
bro wrote: Added "Move completed to" option in the "Add Torrent" dialog. This is a ComboBox which uses the same saved paths as in the "Move Completed" dialog.
There is a ticket for this so if you add a patch it will be reviewed and added.
Ok
Cas wrote:
bro wrote: Made the "Moved completed" text field in the Options pane of each torrent expand when the window is resized. The default width is too small.
Seems reasonable.
This can be fixed only by modifying the glade file, either by setting Expand/Fill or setting a bigger preferred width.
Cas wrote:
bro wrote: Added right click popup menu in the torrent list with the button "Copy title to clipboard". Sometimes the filenames do not correspond to the title at all, and it's a hassle to go find the title somewhere else and copy/paste to give the files a proper name.
Seems reasonable.
Ok.
Cas wrote:
bro wrote:Added right click popup menu in the files list with two options that greatly eases the work to add torrents.
Normalize filename

It seems that normalize would be dependant on user's preferences and we might end up with lots of requests for different flavours.
Yeah, that's true. But it would be possible to let people define their own list of regex replace rules.
Cas wrote:
bro wrote:Place all items in a root directory.
Might be useful to have to opposite option so that users can 'undo' it.
Yes, with the changes I made, simply renaming to "" or "/" removes the directory, moving the files one level up. I can add an option for this in the popup.
Cas wrote:
bro wrote:Also fixed a bug (or is it intended?) with renaming directories, where a directory renamed to an empty string is actually removed instead of just having an empty name.
Why would you have a directory with an empty string? I guess if the above option has been added then it would obsolete this 'feature'.
Actually, you can already delete a directory by renaming to "/" in the filetree in the "Add Torrents" dialog. The bug is that the "Add Torrents" dialog will display a directory with only a slash. After adding the torrent, the directory is not displayed in the Files tab, so it is in fact removed. The fix only removes the node in the "Add Torrents" dialog, so that it looks correct before the torrent is added.

However, it doesn't seem to be possible to remove a directory with the same approach in the Files tab after the torrent has been added. Ideally, I think both file trees should behave the same way.
Cas wrote:
bro wrote:One problem with the ComboBoxes is that they require GTK+ 2.24, whereas the current glade files are set for 2.16.
Comboboxes do not require 2.24, they are already in use in Encryption settings.
Sorry, I was unprecise. It's the 'Has Entry' and 'Entry Text Column' properties Glade doesn't like if the project is set to 2.16.

Code: Select all

[dialog_add_torrent:dialog-vbox1:vpaned1:notebook1:vbox3:frame1:alignment8:hbox1:combobox_move_completed] Property 'Has Entry' of object class 'Combo Box' was introduced in gtk+ 2.24
[dialog_add_torrent:dialog-vbox1:vpaned1:notebook1:vbox3:frame1:alignment8:hbox1:combobox_move_completed] Property 'Entry Text Column' of object class 'Combo Box' was introduced in gtk+ 2.24
To combine both showing previously saved values, and the possibility of adding a new value in the ComboBox, these two properties are necessary.

It would of course be possible to provide two fields, one traditional ComboBox with saved values, and a text field where a new value can be entered.
When reporting issues, please include any relevant information such as OS (and version), python version (for Windows users this depends on which Deluge installer was used), Deluge version and plugin version.
Post Reply