On Thu, 2010-04-01 at 16:06 +0200, Jiri Moskovcak wrote:
On 04/01/2010 04:05 PM, Nikola Pajkovsky wrote:
> Looks good.
>
> Reviewed by: Nikola Pajkovsky<npajkovs(a)redhat.com>
>
> On 04/01/2010 03:38 PM, Denys Vlasenko wrote:
>>
https://bugzilla.redhat.com/show_bug.cgi?id=551989
>>
>> Apparently self.dlist.get_selection() sometimes returns None.
>> This patch takes care of this case.
>>
>> Please review.
Good catch,
but I would rather use dumplist_get_selected() everywhere so we don't
duplicate the code and then the fix would be on one place.
Like this?
--
vda
diff -x '*.po' -d -urpN abrt.8/src/Gui/CCMainWindow.py
abrt.9/src/Gui/CCMainWindow.py
--- abrt.8/src/Gui/CCMainWindow.py 2010-04-01 17:44:20.556259187 +0200
+++ abrt.9/src/Gui/CCMainWindow.py 2010-04-01 18:01:36.967475616 +0200
@@ -194,8 +194,16 @@ class MainWindow():
# for later..
return True
+ def dumplist_get_selected(self):
+ selection = self.dlist.get_selection()
+ if selection:
+ # returns (dumpsListStore, path) tuple
+ return selection.get_selected_rows()
+ else:
+ return (None, None)
+
def on_tvDumps_cursor_changed(self, treeview):
- dumpsListStore, path = self.dlist.get_selection().get_selected_rows()
+ dumpsListStore, path = self.dumplist_get_selected()
if not path:
self.wTree.get_widget("bDelete").set_sensitive(False)
self.wTree.get_widget("bReport").set_sensitive(False)
@@ -291,7 +299,7 @@ class MainWindow():
return False
def on_bDelete_clicked(self, button, treeview):
- dumpsListStore, path = self.dlist.get_selection().get_selected_rows()
+ dumpsListStore, path = self.dumplist_get_selected()
if not path:
return
# this should work until we keep the dump object in the last position
@@ -311,7 +319,7 @@ class MainWindow():
print ex
def dumplist_get_selected(self):
- dumpsListStore, path = self.dlist.get_selection().get_selected_rows()
+ dumpsListStore, path = self.dumplist_get_selected()
if path and dumpsListStore:
return dumpsListStore.get_value(dumpsListStore.get_iter(path[0]),
dumpsListStore.get_n_columns()-1)
return None
@@ -343,7 +351,7 @@ class MainWindow():
# FIXME mark the new entry somehow....
# remember the selected row
last_dump = None
- dumpsListStore, path = self.dlist.get_selection().get_selected_rows()
+ dumpsListStore, path = self.dumplist_get_selected()
if path and dumpsListStore:
last_dump = dumpsListStore.get_value(dumpsListStore.get_iter(path[0]),
dumpsListStore.get_n_columns()-1)
self.hydrate()
@@ -353,11 +361,11 @@ class MainWindow():
def on_bReport_clicked(self, button):
- dumpsListStore, path = self.dlist.get_selection().get_selected_rows()
+ dumpsListStore, path = self.dumplist_get_selected()
self.on_dumpRowActivated(self.dlist, None, path, None)
def on_dumpRowActivated(self, treeview, it, path, user_data=None):
- dumpsListStore, path = treeview.get_selection().get_selected_rows()
+ dumpsListStore, path = self.dumplist_get_selected()
if not path:
return
dump = dumpsListStore.get_value(dumpsListStore.get_iter(path[0]),
dumpsListStore.get_n_columns()-1)