Fix Create Torrent Dialog Box - Some buttons raise Type Error if no row selected

This commit is contained in:
Calum Lind 2011-02-11 01:07:47 +00:00
parent 553f35eae5
commit e198ea14e4

View File

@ -379,6 +379,8 @@ class CreateTorrentDialog:
def _on_button_up_clicked(self, widget): def _on_button_up_clicked(self, widget):
log.debug("_on_button_up_clicked") log.debug("_on_button_up_clicked")
row = self.glade.get_widget("tracker_treeview").get_selection().get_selected()[1] row = self.glade.get_widget("tracker_treeview").get_selection().get_selected()[1]
if row is None:
return
if self.trackers_liststore[row][0] == 0: if self.trackers_liststore[row][0] == 0:
return return
else: else:
@ -387,6 +389,8 @@ class CreateTorrentDialog:
def _on_button_down_clicked(self, widget): def _on_button_down_clicked(self, widget):
log.debug("_on_button_down_clicked") log.debug("_on_button_down_clicked")
row = self.glade.get_widget("tracker_treeview").get_selection().get_selected()[1] row = self.glade.get_widget("tracker_treeview").get_selection().get_selected()[1]
if row is None:
return
self.trackers_liststore[row][0] += 1 self.trackers_liststore[row][0] += 1
def _on_button_add_clicked(self, widget): def _on_button_add_clicked(self, widget):
@ -430,4 +434,6 @@ class CreateTorrentDialog:
def _on_button_remove_clicked(self, widget): def _on_button_remove_clicked(self, widget):
log.debug("_on_button_remove_clicked") log.debug("_on_button_remove_clicked")
row = self.glade.get_widget("tracker_treeview").get_selection().get_selected()[1] row = self.glade.get_widget("tracker_treeview").get_selection().get_selected()[1]
if row is None:
return
self.trackers_liststore.remove(row) self.trackers_liststore.remove(row)