From 0e141aacd41efdb099c48a3996bd27dc3caecdbc Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 15 Jun 2006 18:24:43 +0000 Subject: [PATCH] * src/GrampsLogger/_ErrorReportAssistant.py (__init__): Adapt to the Assistant change. * src/Assistant.py: Convert to working both with and without ManagedWindow. (__init__): Adapt to the Assistant change. svn: r6895 --- ChangeLog | 5 ++++ src/Assistant.py | 36 ++++++++++++++++------- src/Exporter.py | 8 +++-- src/GrampsLogger/_ErrorReportAssistant.py | 2 +- 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index c85ae179d..4073e183f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ 2006-06-15 Alex Roitman + * src/GrampsLogger/_ErrorReportAssistant.py (__init__): Adapt to + the Assistant change. + * src/Assistant.py: Convert to working both with and without + ManagedWindow. * src/DisplayTabs/Makefile.am (pkgdata_PYTHON): Ship new file. * src/DisplayTabs/__init__.py: Import new module. * src/DisplayTabs/_TextTab.py: Add new module. @@ -7,6 +11,7 @@ * src/glade/gramps.glade (source_ref_edit): Remove Text tab. * src/GrampsDb/_WriteGedcom.py (write_photo): Typo. * src/Exporter.py (build_options): Correctly shift all pages. + (__init__): Adapt to the Assistant change. 2006-06-14 Don Allingham * src/ScratchPad.py: check for null model diff --git a/src/Assistant.py b/src/Assistant.py index 7d08a1107..8ec3ccba4 100644 --- a/src/Assistant.py +++ b/src/Assistant.py @@ -51,6 +51,7 @@ import gobject # #------------------------------------------------------------------------- import const +import ManagedWindow #------------------------------------------------------------------------- # @@ -66,7 +67,7 @@ _format = '%s' # Assistant class # #------------------------------------------------------------------------- -class Assistant(gtk.Object): +class Assistant(gtk.Object,ManagedWindow.ManagedWindow): """ A tabbed dialog box used to implement Assistant interfaces.""" __gproperties__ = {} @@ -91,10 +92,15 @@ class Assistant(gtk.Object): gobject.TYPE_NONE, ()) } - - def __init__(self,complete): + + def __init__(self,uistate,complete,top_title=''): gobject.GObject.__init__(self) - + + self.top_title = top_title + if uistate: + ManagedWindow.ManagedWindow.__init__(self,uistate,[], + self.__class__) + self.complete = complete self.fg_color = gtk.gdk.color_parse('#7d684a') self.bg_color = gtk.gdk.color_parse('#e1dbc5') @@ -103,7 +109,12 @@ class Assistant(gtk.Object): self.current_page = -1 - self.window = gtk.Window() + if uistate: + self.set_window(gtk.Window(), None, self.top_title) + else: + self.window = gtk.Window() + self.close = self.destroy + titlebox = gtk.HBox() self.title_text = [] @@ -127,7 +138,7 @@ class Assistant(gtk.Object): hbox.set_layout(gtk.BUTTONBOX_END) self.cancel = gtk.Button(stock=gtk.STOCK_CANCEL) - self.cancel.connect('clicked',lambda x: self.window.destroy()) + self.cancel.connect('clicked',self.close) self.back = gtk.Button(stock=gtk.STOCK_GO_BACK) self.back.set_sensitive(False) self.back.connect('clicked',self.back_clicked) @@ -148,6 +159,9 @@ class Assistant(gtk.Object): self.window.add(vbox) + def build_menu_names(self,obj): + return (self.top_title,None) + def set_busy_cursor(self,value): if value: self.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) @@ -159,6 +173,9 @@ class Assistant(gtk.Object): while gtk.events_pending(): gtk.main_iteration() + def destroy(self,*obj): + self.window.destroy() + def do_get_property(self, prop): """Return the gproperty's value.""" raise AttributeError, 'unknown property %s' % prop.name @@ -217,7 +234,7 @@ class Assistant(gtk.Object): if self.current_page == self.notebook.get_n_pages()-1: self.emit('complete') self.complete() - self.window.destroy() + self.close() else: self.current_page += 1 self.notebook.set_current_page(self.current_page) @@ -286,9 +303,8 @@ class Assistant(gtk.Object): self.update_title() self.set_buttons() self.emit('page-changed',self.notebook.get_current_page()) - - def destroy(self): - self.window.destroy() + if self.uistate: + ManagedWindow.ManagedWindow.show(self) if gtk.pygtk_version < (2,8,0): gobject.type_register(Assistant) diff --git a/src/Exporter.py b/src/Exporter.py index b09332452..9032cb886 100644 --- a/src/Exporter.py +++ b/src/Exporter.py @@ -57,7 +57,7 @@ import QuestionDialog import Config import GrampsDisplay import Assistant - +import Errors from GrampsDb import gramps_db_writer_factory #------------------------------------------------------------------------- # @@ -92,7 +92,11 @@ class Exporter: self.build_exports() self.format_option = None - self.w = Assistant.Assistant(self.complete) + try: + self.w = Assistant.Assistant(uistate,self.complete, + _("Export Assistant")) + except Errors.WindowActiveError: + return self.w.add_text_page(_('Saving your data'),self.get_intro_text()) diff --git a/src/GrampsLogger/_ErrorReportAssistant.py b/src/GrampsLogger/_ErrorReportAssistant.py index 95e451261..30b99cd77 100644 --- a/src/GrampsLogger/_ErrorReportAssistant.py +++ b/src/GrampsLogger/_ErrorReportAssistant.py @@ -17,7 +17,7 @@ class ErrorReportAssistant: self._error_details_text_buffer = None self._final_report_text_buffer = None - self.w = Assistant.Assistant(self.complete) + self.w = Assistant.Assistant(None,self.complete) self.w.add_text_page( _('Report a bug'),