From e198ea14e4349436db1a7c754bbb2dcab7f76a53 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Fri, 11 Feb 2011 01:07:47 +0000 Subject: [PATCH] Fix Create Torrent Dialog Box - Some buttons raise Type Error if no row selected --- deluge/ui/gtkui/createtorrentdialog.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/deluge/ui/gtkui/createtorrentdialog.py b/deluge/ui/gtkui/createtorrentdialog.py index 147fd6435..786347e55 100644 --- a/deluge/ui/gtkui/createtorrentdialog.py +++ b/deluge/ui/gtkui/createtorrentdialog.py @@ -379,6 +379,8 @@ class CreateTorrentDialog: def _on_button_up_clicked(self, widget): log.debug("_on_button_up_clicked") row = self.glade.get_widget("tracker_treeview").get_selection().get_selected()[1] + if row is None: + return if self.trackers_liststore[row][0] == 0: return else: @@ -387,6 +389,8 @@ class CreateTorrentDialog: def _on_button_down_clicked(self, widget): log.debug("_on_button_down_clicked") row = self.glade.get_widget("tracker_treeview").get_selection().get_selected()[1] + if row is None: + return self.trackers_liststore[row][0] += 1 def _on_button_add_clicked(self, widget): @@ -430,4 +434,6 @@ class CreateTorrentDialog: def _on_button_remove_clicked(self, widget): log.debug("_on_button_remove_clicked") row = self.glade.get_widget("tracker_treeview").get_selection().get_selected()[1] + if row is None: + return self.trackers_liststore.remove(row)