From 01f264fa8b112b4111ea2c732fb0021ce8365e47 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Fri, 5 Mar 2010 15:24:47 +0000 Subject: [PATCH] 2043: Error on cosole output when Esc press in configure window of custom text in the book report svn: r14627 --- src/ReportBase/_ReportDialog.py | 7 +++++-- src/plugins/BookReport.py | 24 ++++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/ReportBase/_ReportDialog.py b/src/ReportBase/_ReportDialog.py index e76d5ce1e..23f431b0f 100644 --- a/src/ReportBase/_ReportDialog.py +++ b/src/ReportBase/_ReportDialog.py @@ -639,7 +639,10 @@ def report(dbstate, uistate, person, report_class, options_class, except: LOG.error("Failed to run report.", exc_info=True) break - elif (response == gtk.RESPONSE_DELETE_EVENT or - response == gtk.RESPONSE_CANCEL): + elif response == gtk.RESPONSE_CANCEL: dialog.close() break + elif response == gtk.RESPONSE_DELETE_EVENT: + #just stop, in ManagedWindow, delete-event is already coupled to + #correct action. + break diff --git a/src/plugins/BookReport.py b/src/plugins/BookReport.py index 5784e6005..e1f425e0b 100644 --- a/src/plugins/BookReport.py +++ b/src/plugins/BookReport.py @@ -899,12 +899,24 @@ class BookReportSelector(ManagedWindow.ManagedWindow): item.get_name(), item.get_translated_name(), self.track) - response = item_dialog.window.run() - if response == gtk.RESPONSE_OK: - subject = _get_subject(option_class, self.db) - self.book_model.model.set_value(the_iter, 2, subject) - self.book.set_item(row, item) - item_dialog.close() + + while True: + response = item_dialog.window.run() + if response == gtk.RESPONSE_OK: + # dialog will be closed by connect, now continue work while + # rest of dialog is unresponsive, release when finished + subject = _get_subject(option_class, self.db) + self.book_model.model.set_value(the_iter, 2, subject) + self.book.set_item(row, item) + item_dialog.close() + break + elif response == gtk.RESPONSE_CANCEL: + item_dialog.close() + break + elif response == gtk.RESPONSE_DELETE_EVENT: + #just stop, in ManagedWindow, delete-event is already coupled to + #correct action. + break def book_button_press(self, obj, event): """