Module: deluge Branch: pieces-progress-bar Commit: 445f3c0123211f112cd1e7c269da5fdce17b1bf5
Author: Calum Lind <[email protected]> Date: Sat May 21 16:06:46 2011 +0100 Fix menu bug caused by Change Owner menuitem code The right-click torrent menu would move/jump around when the option submenu was opened with the mouse, possibly due to a conflict between glade file and append menuitem code in menubar.py. Solution was to create a menuitem entry for Change Owner in glade file and update code to add submenu to this new entry. --- deluge/ui/gtkui/glade/torrent_menu.glade | 7 +++++++ deluge/ui/gtkui/menubar.py | 19 +++++-------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/deluge/ui/gtkui/glade/torrent_menu.glade b/deluge/ui/gtkui/glade/torrent_menu.glade index eef4f5a..c7dfbe0 100644 --- a/deluge/ui/gtkui/glade/torrent_menu.glade +++ b/deluge/ui/gtkui/glade/torrent_menu.glade @@ -274,6 +274,13 @@ <property name="use_underline">True</property> </widget> </child> + <child> + <widget class="GtkMenuItem" id="menuitem_change_owner"> + <property name="visible">False</property> + <property name="label" translatable="yes">_Change Ownership</property> + <property name="use_underline">True</property> + </widget> + </child> </widget> <widget class="GtkMenu" id="queue_torrent_menu"> <property name="visible">True</property> diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py index b4b775c..14754b0 100644 --- a/deluge/ui/gtkui/menubar.py +++ b/deluge/ui/gtkui/menubar.py @@ -102,10 +102,6 @@ class MenuBar(component.Component): self.torrentmenu = self.torrentmenu_glade.get_widget("torrent_menu") self.menu_torrent = self.window.main_glade.get_widget("menu_torrent") - self.menuitem_change_owner = gtk.MenuItem(_("Change Ownership")) - self.torrentmenu_glade.get_widget("options_torrent_menu").append(self.menuitem_change_owner) - - # Attach the torrent_menu to the Torrent file menu self.menu_torrent.set_submenu(self.torrentmenu) @@ -209,12 +205,8 @@ class MenuBar(component.Component): # Show the Torrent menu because we're connected to a host self.menu_torrent.show() - # Hide the change owner submenu until we get the accounts back from the - # demon. - self.menuitem_change_owner.set_visible(False) - if client.get_auth_level() == deluge.common.AUTH_LEVEL_ADMIN: - # Get Known accounts to allow chaning ownership + # Get known accounts to allow changing ownership client.core.get_known_accounts().addCallback( self._on_known_accounts).addErrback(self._on_known_accounts_fail ) @@ -234,7 +226,6 @@ class MenuBar(component.Component): self.window.main_glade.get_widget("separatormenuitem").hide() self.window.main_glade.get_widget("menuitem_quitdaemon").hide() - def update_menu(self): selected = component.get('TorrentView').get_selected_torrents() if not selected or len(selected) == 0: @@ -531,7 +522,7 @@ class MenuBar(component.Component): if len(known_accounts) <= 1: return - self.menuitem_change_owner.set_visible(True) + self.torrentmenu_glade.get_widget("menuitem_change_owner").set_visible(True) self.change_owner_submenu = gtk.Menu() self.change_owner_submenu_items = {} @@ -549,13 +540,13 @@ class MenuBar(component.Component): self.change_owner_submenu.show_all() self.change_owner_submenu_items[None].set_active(True) self.change_owner_submenu_items[None].hide() - self.menuitem_change_owner.connect( + self.torrentmenu_glade.get_widget("menuitem_change_owner").connect( "activate", self._on_change_owner_submenu_active ) - self.menuitem_change_owner.set_submenu(self.change_owner_submenu) + self.torrentmenu_glade.get_widget("menuitem_change_owner").set_submenu(self.change_owner_submenu) def _on_known_accounts_fail(self, reason): - self.menuitem_change_owner.set_visible(False) + self.torrentmenu_glade.get_widget("menuitem_change_owner").set_visible(False) def _on_change_owner_submenu_active(self, widget): log.debug("_on_change_owner_submenu_active") -- You received this message because you are subscribed to the Google Groups "deluge-commit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/deluge-commit?hl=en.
