diff --git a/deluge/ui/gtkui/createtorrentdialog.py b/deluge/ui/gtkui/createtorrentdialog.py new file mode 100644 index 000000000..990ada2b9 --- /dev/null +++ b/deluge/ui/gtkui/createtorrentdialog.py @@ -0,0 +1,99 @@ +# +# createtorrentdialog.py +# +# Copyright (C) 2008 Andrew Resch ('andar') +# +# Deluge is free software. +# +# You may redistribute it and/or modify it under the terms of the +# GNU General Public License, as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# deluge is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with deluge. If not, write to: +# The Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor +# Boston, MA 02110-1301, USA. +# +# In addition, as a special exception, the copyright holders give +# permission to link the code of portions of this program with the OpenSSL +# library. +# You must obey the GNU General Public License in all respects for all of +# the code used other than OpenSSL. If you modify file(s) with this +# exception, you may extend this exception to your version of the file(s), +# but you are not obligated to do so. If you do not wish to do so, delete +# this exception statement from your version. If you delete this exception +# statement from all source files in the program, then also delete it here. + +import gtk +import pkg_resources + +import deluge.component as component +import deluge.common +from deluge.configmanager import ConfigManager +from deluge.log import LOG as log + +class CreateTorrentDialog: + def __init__(self): + pass + + def show(self): + self.config = ConfigManager("gtkui.conf") + glade = gtk.glade.XML( + pkg_resources.resource_filename( + "deluge.ui.gtkui", + "glade/create_torrent_dialog.glade")) + + self.dialog = glade.get_widget("create_torrent_dialog") + self.dialog.set_transient_for(component.get("MainWindow").window) + + glade.signal_autoconnect({ + "on_button_file_clicked": self._on_button_file_clicked, + "on_button_folder_clicked": self._on_button_folder_clicked, + "on_button_remote_path_clicked": self._on_button_remote_path_clicked, + "on_button_cancel_clicked": self._on_button_cancel_clicked, + "on_button_create_clicked": self._on_button_create_clicked, + "on_button_up_clicked": self._on_button_up_clicked, + "on_button_add_clicked": self._on_button_add_clicked, + "on_button_remove_clicked": self._on_button_remove_clicked, + "on_button_down_clicked": self._on_button_down_clicked + }) + + + self.dialog.show_all() + + def _on_button_file_clicked(self, widget): + log.debug("_on_button_file_clicked") + + def _on_button_folder_clicked(self, widget): + log.debug("_on_button_folder_clicked") + + def _on_button_remote_path_clicked(self, widget): + log.debug("_on_button_remote_path_clicked") + + def _on_button_cancel_clicked(self, widget): + log.debug("_on_button_cancel_clicked") + self.dialog.destroy() + + def _on_button_create_clicked(self, widget): + log.debug("_on_button_create_clicked") + self.dialog.destroy() + + def _on_button_up_clicked(self, widget): + log.debug("_on_button_up_clicked") + + def _on_button_add_clicked(self, widget): + log.debug("_on_button_add_clicked") + + def _on_button_remove_clicked(self, widget): + log.debug("_on_button_remove_clicked") + + def _on_button_down_clicked(self, widget): + log.debug("_on_button_down_clicked") + diff --git a/deluge/ui/gtkui/glade/create_torrent_dialog.glade b/deluge/ui/gtkui/glade/create_torrent_dialog.glade new file mode 100644 index 000000000..18229cfda --- /dev/null +++ b/deluge/ui/gtkui/glade/create_torrent_dialog.glade @@ -0,0 +1,735 @@ + + + + + + 560 + 5 + Create Torrent + GTK_WIN_POS_CENTER_ON_PARENT + + + True + 5 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-new + 5 + + + False + False + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + <big><b>Create Torrent</b></big> + True + + + False + False + 1 + + + + + False + False + + + + + True + + + False + 1 + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 5 + 12 + 12 + + + True + 5 + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + True + + + + + + + True + GTK_BUTTONBOX_CENTER + + + True + True + True + 0 + + + + True + 5 + + + True + gtk-new + + + False + False + + + + + True + _File + True + + + False + False + 1 + + + + + + + + + True + True + True + 0 + + + + True + 5 + + + True + gtk-open + + + False + False + + + + + True + Fol_der + True + + + False + False + 1 + + + + + + + 1 + + + + + True + True + True + 0 + + + + True + 5 + + + True + gtk-network + + + False + False + + + + + True + _Remote Path + True + + + False + False + 1 + + + + + + + 2 + + + + + False + False + 1 + + + + + + + + + True + <b>Files</b> + True + + + label_item + + + + + 2 + + + + + True + True + + + True + 5 + 5 + 12 + 12 + + + True + 5 + + + True + 5 + + + True + Save .torrent file as: + + + False + False + + + + + True + True + + + 1 + + + + + True + False + False + + + False + False + 2 + + + + + False + False + + + + + True + 5 + + + True + Author: + + + False + False + + + + + True + True + + + 1 + + + + + False + False + 1 + + + + + True + 5 + + + True + Comments: + + + False + False + + + + + True + True + + + 1 + + + + + False + False + 2 + + + + + + + + + True + 5 + + + True + gtk-info + + + + + True + Info + + + 1 + + + + + tab + False + + + + + True + 5 + 5 + 12 + 12 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 1 + GTK_BUTTONBOX_CENTER + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-go-up + True + 0 + + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-add + True + 0 + + + + 1 + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-remove + True + 0 + + + + 2 + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-go-down + True + 0 + + + + 3 + + + + + False + False + 1 + + + + + + + 1 + + + + + True + 5 + + + True + gtk-edit + + + + + True + Trackers + + + 1 + + + + + tab + 1 + False + + + + + True + 5 + 5 + 12 + 12 + + + True + GTK_RESIZE_QUEUE + + + True + True + + + + + + + 2 + + + + + True + 5 + + + True + gtk-network + + + + + True + Webseeds + + + 1 + + + + + tab + 2 + False + + + + + True + 5 + 5 + 12 + 12 + + + True + 5 + + + True + + + True + Piece Size: + + + False + False + + + + + True + + + False + False + 1 + + + + + False + False + + + + + True + True + Set Private Flag + 0 + True + + + False + False + 1 + + + + + True + True + Add this torrent to the session + 0 + True + + + False + False + 2 + + + + + + + 3 + + + + + True + 5 + + + True + gtk-preferences + + + + + True + Options + + + 1 + + + + + tab + 3 + False + + + + + False + False + 3 + + + + + True + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-cancel + True + 0 + + + + + + True + True + True + 0 + + + + True + + + True + gtk-new + + + + + True + Create _Torrent + True + + + 1 + + + + + + + 1 + + + + + + + False + False + 4 + + + + + + diff --git a/deluge/ui/gtkui/glade/main_window.glade b/deluge/ui/gtkui/glade/main_window.glade index 3f3884370..903b04168 100644 --- a/deluge/ui/gtkui/glade/main_window.glade +++ b/deluge/ui/gtkui/glade/main_window.glade @@ -37,6 +37,20 @@ + + + True + _Create Torrent + True + + + + gtk-new + 1 + + + + @@ -666,191 +680,276 @@ - + True - 0 - - - 1 - 2 - GTK_FILL - - - - - True - 0 - - - 3 - 4 - GTK_FILL - - - - - True - 0 - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - 0 - - - 3 - 4 - 1 - 2 - GTK_FILL - - - - - True - 5 - - - True - 0 - <b>Downloaded:</b> - True - - - - - GTK_FILL - - - - - True - 5 - - - True - 0 - <b>Uploaded:</b> - True - - - - - 1 - 2 - GTK_FILL - - - - - True - 5 - - - True - 0 - <b>Share Ratio:</b> - True - - - - - 2 - 3 - GTK_FILL - - - - - True - 5 - - - True - 0 - <b>Next Announce:</b> - True - - + 5 + 6 3 4 GTK_FILL - + True - 15 - 5 - - - True - 0 - <b>Speed:</b> - True - - + 0 + <b>Auto Managed:</b> + True - 2 - 3 + 4 + 5 + 3 + 4 GTK_FILL - + True - 15 - 5 - - - True - 0 - <b>Speed:</b> - True - - - 2 - 3 + 7 + 8 + 2 + 3 + GTK_FILL + + + + + True + + + 7 + 8 1 2 GTK_FILL - + True - 15 - 5 - - - True - 0 - <b>ETA:</b> - True - - + 0 + <b>Seed Rank:</b> + True - 2 - 3 + 6 + 7 2 3 GTK_FILL + + + True + 0 + <b>Seeding Time:</b> + True + + + 6 + 7 + 1 + 2 + GTK_FILL + + + + + True + + + 7 + 8 + GTK_FILL + + + + + True + 0 + <b>Active Time:</b> + True + + + 6 + 7 + GTK_FILL + + + + + True + 0 + True + True + + + 1 + 2 + 3 + 4 + GTK_FILL + + + + + True + 0 + + + 3 + 4 + 3 + 4 + GTK_FILL + + + + + True + 0 + PANGO_WRAP_CHAR + True + + + 1 + 6 + 4 + 5 + GTK_FILL + + + + + True + 0 + <b>Tracker Status:</b> + True + + + 4 + 5 + GTK_FILL + + + + + + True + 0 + True + PANGO_WRAP_WORD_CHAR + + + 5 + 6 + 2 + 3 + GTK_FILL + + + + + + True + 0 + 1 + <b>Availability:</b> + True + + + 4 + 5 + 2 + 3 + GTK_FILL + + + + + True + 0 + + + 3 + 4 + 2 + 3 + GTK_FILL + + + + + True + 0 + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + 0 + + + 5 + 6 + 1 + 2 + GTK_FILL + + + + + True + 0 + <b>Peers:</b> + True + + + 4 + 5 + 1 + 2 + GTK_FILL + + + + + True + 0 + + + 5 + 6 + GTK_FILL + + + + + True + 0 + <b>Seeders:</b> + True + + + 4 + 5 + GTK_FILL + + True @@ -874,273 +973,188 @@ - + True - 0 - <b>Seeders:</b> - True + 15 + 5 + + + True + 0 + <b>ETA:</b> + True + + - 4 - 5 - GTK_FILL - - - - - True - 0 - - - 5 - 6 - GTK_FILL - - - - - True - 0 - <b>Peers:</b> - True - - - 4 - 5 - 1 - 2 - GTK_FILL - - - - - True - 0 - - - 5 - 6 - 1 - 2 - GTK_FILL - - - - - True - 0 - - - 1 - 2 + 2 + 3 2 3 GTK_FILL - + + True + 15 + 5 + + + True + 0 + <b>Speed:</b> + True + + + + + 2 + 3 + 1 + 2 + GTK_FILL + + + + + True + 15 + 5 + + + True + 0 + <b>Speed:</b> + True + + + + + 2 + 3 + GTK_FILL + + + + + True + 5 + + + True + 0 + <b>Next Announce:</b> + True + + + + + 3 + 4 + GTK_FILL + + + + + True + 5 + + + True + 0 + <b>Share Ratio:</b> + True + + + + + 2 + 3 + GTK_FILL + + + + + True + 5 + + + True + 0 + <b>Uploaded:</b> + True + + + + + 1 + 2 + GTK_FILL + + + + + True + 5 + + + True + 0 + <b>Downloaded:</b> + True + + + + + GTK_FILL + + + + True 0 3 4 - 2 - 3 + 1 + 2 GTK_FILL - + True 0 - 1 - <b>Availability:</b> - True - - - 4 - 5 - 2 - 3 - GTK_FILL - - - - - True - 0 - True - PANGO_WRAP_WORD_CHAR - - - 5 - 6 - 2 - 3 - GTK_FILL - - - - - - True - 0 - <b>Tracker Status:</b> - True - - - 4 - 5 - GTK_FILL - - - - - - True - 0 - PANGO_WRAP_CHAR - True 1 - 6 - 4 - 5 + 2 + 1 + 2 GTK_FILL - + True 0 3 4 - 3 - 4 GTK_FILL - + True 0 - True - True 1 2 - 3 - 4 - GTK_FILL - - - - - True - 0 - <b>Active Time:</b> - True - - - 6 - 7 - GTK_FILL - - - - - True - - - 7 - 8 - GTK_FILL - - - - - True - 0 - <b>Seeding Time:</b> - True - - - 6 - 7 - 1 - 2 - GTK_FILL - - - - - True - 0 - <b>Seed Rank:</b> - True - - - 6 - 7 - 2 - 3 - GTK_FILL - - - - - True - - - 7 - 8 - 1 - 2 - GTK_FILL - - - - - True - - - 7 - 8 - 2 - 3 - GTK_FILL - - - - - True - 0 - <b>Auto Managed:</b> - True - - - 4 - 5 - 3 - 4 - GTK_FILL - - - - - True - - - 5 - 6 - 3 - 4 GTK_FILL @@ -1227,7 +1241,7 @@ - + True 0 True @@ -1235,42 +1249,28 @@ 1 2 - 3 - 4 + 4 + 5 - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - - - 1 - 4 - 5 - 6 - - - - - + True 0 1 - <b>Status:</b> + <b># of files:</b> True - 5 - 6 + 4 + 5 GTK_FILL - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 0 @@ -1281,65 +1281,52 @@ 1 4 - 2 - 3 + 1 + 2 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - <b>Path:</b> - True - - + 0 + <b>Hash:</b> + True - 2 - 3 + 1 + 2 GTK_FILL - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - 0 - 0 - 1 - <b>Name:</b> - True - - - - - GTK_FILL - - - - - + True 0 - True - PANGO_WRAP_CHAR True 1 4 + 6 + 7 + + + + + + True + 0 + 1 + <b>Tracker:</b> + True + + + 6 + 7 + GTK_FILL @@ -1366,51 +1353,64 @@ - - True - 0 - 1 - <b>Tracker:</b> - True - - - 6 - 7 - GTK_FILL - - - - - + True 0 + True + PANGO_WRAP_CHAR True 1 4 - 6 - 7 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - <b>Hash:</b> - True + 5 + + + True + 0 + 0 + 1 + <b>Name:</b> + True + + - 1 - 2 GTK_FILL - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + <b>Path:</b> + True + + + + + 2 + 3 + GTK_FILL + + + + + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 0 @@ -1421,28 +1421,42 @@ 1 4 - 1 - 2 + 2 + 3 - + True 0 1 - <b># of files:</b> + <b>Status:</b> True - 4 - 5 + 5 + 6 GTK_FILL - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + + + 1 + 4 + 5 + 6 + + + + + True 0 True @@ -1450,8 +1464,8 @@ 1 2 - 4 - 5 + 3 + 4 @@ -1634,7 +1648,7 @@ - + True True 6 @@ -1644,100 +1658,8 @@ 1 2 - 3 - 4 - - - - - - - True - 0 - Max Upload Slots: - - - 3 - 4 - GTK_FILL - - - - - - True - KiB/s - - - 2 - 3 - 1 - 2 - - - - - - - True - KiB/s - - - 2 - 3 - - - - - - - True - 0 - Max Download Speed: - - - GTK_FILL - - - - - - True - 0 - Max Upload Speed: - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - Max Connections: - - 2 3 - GTK_FILL - - - - - - True - True - 6 - 1 - -1 -1 999999 1 10 10 - 1 - - - 1 - 2 @@ -1761,7 +1683,99 @@ - + + True + True + 6 + 1 + -1 -1 999999 1 10 10 + 1 + + + 1 + 2 + + + + + + + True + 0 + Max Connections: + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + Max Upload Speed: + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + Max Download Speed: + + + GTK_FILL + + + + + + True + KiB/s + + + 2 + 3 + + + + + + + True + KiB/s + + + 2 + 3 + 1 + 2 + + + + + + + True + 0 + Max Upload Slots: + + + 3 + 4 + GTK_FILL + + + + + True True 6 @@ -1771,8 +1785,8 @@ 1 2 - 2 - 3 + 3 + 4 @@ -2355,23 +2369,14 @@ 10 2 - - True - 0 - <i>Current Version:</i> - True - - - GTK_FILL - - - - + True 1 2 + 1 + 2 @@ -2389,17 +2394,26 @@ - + True 1 2 - 1 - 2 + + + True + 0 + <i>Current Version:</i> + True + + + GTK_FILL + + diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py index 68b2a8043..08dd309a2 100644 --- a/deluge/ui/gtkui/menubar.py +++ b/deluge/ui/gtkui/menubar.py @@ -106,6 +106,8 @@ class MenuBar(component.Component): ## File Menu "on_menuitem_addtorrent_activate": \ self.on_menuitem_addtorrent_activate, + "on_menuitem_createtorrent_activate": \ + self.on_menuitem_createtorrent_activate, "on_menuitem_quitdaemon_activate": \ self.on_menuitem_quitdaemon_activate, "on_menuitem_quit_activate": self.on_menuitem_quit_activate, @@ -224,7 +226,12 @@ class MenuBar(component.Component): def on_menuitem_addtorrent_activate(self, data=None): log.debug("on_menuitem_addtorrent_activate") component.get("AddTorrentDialog").show() - + + def on_menuitem_createtorrent_activate(self, data=None): + log.debug("on_menuitem_createtorrent_activate") + from createtorrentdialog import CreateTorrentDialog + CreateTorrentDialog().show() + def on_menuitem_quitdaemon_activate(self, data=None): log.debug("on_menuitem_quitdaemon_activate") # Tell the core to shutdown diff --git a/deluge/ui/gtkui/new_release_dialog.py b/deluge/ui/gtkui/new_release_dialog.py index fe62d4771..1818b0939 100644 --- a/deluge/ui/gtkui/new_release_dialog.py +++ b/deluge/ui/gtkui/new_release_dialog.py @@ -1,7 +1,7 @@ # # new_release_dialog.py # -# Copyright (C) 2007, 2008 Andrew Resch ('andar') +# Copyright (C) 2008 Andrew Resch ('andar') # # Deluge is free software. #