From 826057649cb6672fe47d2ebbd11b8dc62ee55791 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Mon, 25 Jun 2007 23:11:16 +0000 Subject: [PATCH] Some updates to the torrentcreator interface. --- plugins/TorrentCreator/__init__.py | 12 +- plugins/TorrentCreator/torrentcreator.glade | 129 ++++++++++++-------- 2 files changed, 90 insertions(+), 51 deletions(-) diff --git a/plugins/TorrentCreator/__init__.py b/plugins/TorrentCreator/__init__.py index 5809b2fff..151387235 100644 --- a/plugins/TorrentCreator/__init__.py +++ b/plugins/TorrentCreator/__init__.py @@ -79,6 +79,7 @@ class TorrentCreator: self.dialog = self.glade.get_widget("torrentcreator") self.glade.get_widget("piece_size_combobox").set_active(0) + self.glade.get_widget("torrent_chooserbutton").connect("clicked", self.torrent_chooserbutton_clicked) self.dialog.connect("destroy", self.destroy) self.dialog.show_all() response = self.dialog.run() @@ -89,7 +90,16 @@ class TorrentCreator: self.destroy() return + + def torrent_chooserbutton_clicked(self, widget): + filechooser = gtk.FileChooserDialog(title=_("Save file as..."), parent=None, action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK), backend=None) + response = filechooser.run() + # Update the torrentfile entry widget if a file was selected. + if response == gtk.RESPONSE_OK: + self.glade.get_widget("torrentfile_entry").set_text(filechooser.get_filename()) + filechooser.destroy() + def create_torrent(self): # Create a torrent from the information provided in the torrentcreator dialog if self.glade.get_widget("folder_radiobutton").get_active(): @@ -97,7 +107,7 @@ class TorrentCreator: else: source = self.glade.get_widget("file_chooserbutton").get_filename() - torrent = self.glade.get_widget("torrent_chooserbutton").get_filename() + torrent = self.glade.get_widget("torrentfile_entry").get_text() piece_size = self.glade.get_widget("piece_size_combobox") piece_size = piece_size.get_model().get_value(piece_size.get_active_iter(), 0).split(" ")[0] diff --git a/plugins/TorrentCreator/torrentcreator.glade b/plugins/TorrentCreator/torrentcreator.glade index 6a11bbc81..c762182a7 100644 --- a/plugins/TorrentCreator/torrentcreator.glade +++ b/plugins/TorrentCreator/torrentcreator.glade @@ -1,6 +1,6 @@ - + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -42,7 +42,9 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 10 + 10 12 + 12 True @@ -59,6 +61,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 + 5 12 @@ -67,16 +70,28 @@ 2 2 - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Folder: - 0 - True - True + 1 + 2 + 1 + 2 + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + + + 1 + 2 + GTK_FILL @@ -97,28 +112,16 @@ - + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + Folder: + 0 + True + True - 1 - 2 - GTK_FILL - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - 1 - 2 @@ -153,6 +156,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 + 5 12 @@ -163,7 +167,43 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 1 - 2 + 3 + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + gtk-open + 2 + + + + + 2 + 3 + + + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + If no path is entered then the torrent file will be saved to the default torrent folder. + + + 1 + 2 + + True @@ -175,17 +215,6 @@ - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - 2 - - - False @@ -252,6 +281,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK GTK_WRAP_CHAR + False @@ -271,8 +301,6 @@ - False - False 2 @@ -300,6 +328,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK GTK_WRAP_WORD_CHAR + False @@ -378,17 +407,6 @@ 1 2 10 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Piece Size: - - - - - True @@ -404,6 +422,17 @@ + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Piece Size: + + + + +