* 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
This commit is contained in:
Alex Roitman 2006-06-15 18:24:43 +00:00
parent e070e77c14
commit a4c7e78664
4 changed files with 38 additions and 13 deletions

View File

@ -1,4 +1,8 @@
2006-06-15 Alex Roitman <shura@gramps-project.org> 2006-06-15 Alex Roitman <shura@gramps-project.org>
* 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/Makefile.am (pkgdata_PYTHON): Ship new file.
* src/DisplayTabs/__init__.py: Import new module. * src/DisplayTabs/__init__.py: Import new module.
* src/DisplayTabs/_TextTab.py: Add new module. * src/DisplayTabs/_TextTab.py: Add new module.
@ -7,6 +11,7 @@
* src/glade/gramps.glade (source_ref_edit): Remove Text tab. * src/glade/gramps.glade (source_ref_edit): Remove Text tab.
* src/GrampsDb/_WriteGedcom.py (write_photo): Typo. * src/GrampsDb/_WriteGedcom.py (write_photo): Typo.
* src/Exporter.py (build_options): Correctly shift all pages. * src/Exporter.py (build_options): Correctly shift all pages.
(__init__): Adapt to the Assistant change.
2006-06-14 Don Allingham <don@gramps-project.org> 2006-06-14 Don Allingham <don@gramps-project.org>
* src/ScratchPad.py: check for null model * src/ScratchPad.py: check for null model

View File

@ -51,6 +51,7 @@ import gobject
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
import ManagedWindow
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -66,7 +67,7 @@ _format = '<span weight="bold" size="xx-large">%s</span>'
# Assistant class # Assistant class
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class Assistant(gtk.Object): class Assistant(gtk.Object,ManagedWindow.ManagedWindow):
""" A tabbed dialog box used to implement Assistant interfaces.""" """ A tabbed dialog box used to implement Assistant interfaces."""
__gproperties__ = {} __gproperties__ = {}
@ -91,10 +92,15 @@ class Assistant(gtk.Object):
gobject.TYPE_NONE, gobject.TYPE_NONE,
()) ())
} }
def __init__(self,complete): def __init__(self,uistate,complete,top_title=''):
gobject.GObject.__init__(self) gobject.GObject.__init__(self)
self.top_title = top_title
if uistate:
ManagedWindow.ManagedWindow.__init__(self,uistate,[],
self.__class__)
self.complete = complete self.complete = complete
self.fg_color = gtk.gdk.color_parse('#7d684a') self.fg_color = gtk.gdk.color_parse('#7d684a')
self.bg_color = gtk.gdk.color_parse('#e1dbc5') self.bg_color = gtk.gdk.color_parse('#e1dbc5')
@ -103,7 +109,12 @@ class Assistant(gtk.Object):
self.current_page = -1 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() titlebox = gtk.HBox()
self.title_text = [] self.title_text = []
@ -127,7 +138,7 @@ class Assistant(gtk.Object):
hbox.set_layout(gtk.BUTTONBOX_END) hbox.set_layout(gtk.BUTTONBOX_END)
self.cancel = gtk.Button(stock=gtk.STOCK_CANCEL) 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 = gtk.Button(stock=gtk.STOCK_GO_BACK)
self.back.set_sensitive(False) self.back.set_sensitive(False)
self.back.connect('clicked',self.back_clicked) self.back.connect('clicked',self.back_clicked)
@ -148,6 +159,9 @@ class Assistant(gtk.Object):
self.window.add(vbox) self.window.add(vbox)
def build_menu_names(self,obj):
return (self.top_title,None)
def set_busy_cursor(self,value): def set_busy_cursor(self,value):
if value: if value:
self.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) self.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
@ -159,6 +173,9 @@ class Assistant(gtk.Object):
while gtk.events_pending(): while gtk.events_pending():
gtk.main_iteration() gtk.main_iteration()
def destroy(self,*obj):
self.window.destroy()
def do_get_property(self, prop): def do_get_property(self, prop):
"""Return the gproperty's value.""" """Return the gproperty's value."""
raise AttributeError, 'unknown property %s' % prop.name 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: if self.current_page == self.notebook.get_n_pages()-1:
self.emit('complete') self.emit('complete')
self.complete() self.complete()
self.window.destroy() self.close()
else: else:
self.current_page += 1 self.current_page += 1
self.notebook.set_current_page(self.current_page) self.notebook.set_current_page(self.current_page)
@ -286,9 +303,8 @@ class Assistant(gtk.Object):
self.update_title() self.update_title()
self.set_buttons() self.set_buttons()
self.emit('page-changed',self.notebook.get_current_page()) self.emit('page-changed',self.notebook.get_current_page())
if self.uistate:
def destroy(self): ManagedWindow.ManagedWindow.show(self)
self.window.destroy()
if gtk.pygtk_version < (2,8,0): if gtk.pygtk_version < (2,8,0):
gobject.type_register(Assistant) gobject.type_register(Assistant)

View File

@ -57,7 +57,7 @@ import QuestionDialog
import Config import Config
import GrampsDisplay import GrampsDisplay
import Assistant import Assistant
import Errors
from GrampsDb import gramps_db_writer_factory from GrampsDb import gramps_db_writer_factory
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -92,7 +92,11 @@ class Exporter:
self.build_exports() self.build_exports()
self.format_option = None 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()) self.w.add_text_page(_('Saving your data'),self.get_intro_text())

View File

@ -17,7 +17,7 @@ class ErrorReportAssistant:
self._error_details_text_buffer = None self._error_details_text_buffer = None
self._final_report_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( self.w.add_text_page(
_('Report a bug'), _('Report a bug'),