Some fixes for tabs, and an option to skip saving filename

svn: r13540
This commit is contained in:
Doug Blank 2009-11-10 05:20:19 +00:00
parent b04b31dbc7
commit 18dede768e

View File

@ -248,13 +248,17 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
"""
if pagenumber == _ExportAssistant_pages['exporttypes'] :
#decide if options need to be shown:
self.option_box_instance = None
ix = self.get_selected_format_index()
if self.__exporters[ix].get_config():
return pagenumber + 1
else :
if not self.__exporters[ix].get_config():
# no options needed
return pagenumber + 2
else :
elif pagenumber == _ExportAssistant_pages['options']:
# need to check to see if we should show file selection
if (self.option_box_instance and
hasattr(self.option_box_instance, "no_fileselect")):
# don't show fileselect, but mark it ok
return pagenumber + 2
return pagenumber + 1
def create_options(self):
@ -435,7 +439,19 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
# Present user with what will happen
ix = self.get_selected_format_index()
format = self.__exporters[ix].get_name()
page_complete = False
# If no file select:
if (self.option_box_instance and
hasattr(self.option_box_instance, "no_fileselect")):
# No file selection
filename = ''
confirm_text = _(
'The data will be exported as follows:\n\n'
'Format:\t%s\n\n'
'Press Apply to proceed, Back to revisit '
'your options, or Cancel to abort') % (format.replace("_",""), )
page_complete = True
else:
#Allow for exotic error: file is still not correct
self.check_fileselect(self.chooser, show=False)
if self.get_page_complete(self.chooser) :
@ -447,15 +463,22 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
'Format:\t%s\nName:\t%s\nFolder:\t%s\n\n'
'Press Apply to proceed, Back to revisit '
'your options, or Cancel to abort') % (format.replace("_",""), name, folder)
self.set_page_complete(page, True)
page_complete = True
else :
confirm_text = _(
'The selected file and folder to save to '
'cannot be created or found.\n\n'
'Press Back to return and select a valid filename.'
)
self.set_page_complete(page, False)
page_complete = False
# Set the page_complete status
self.set_page_complete(page, page_complete)
# If it is ok, then look for alternate confirm_text
if (page_complete and
self.option_box_instance and
hasattr(self.option_box_instance, "confirm_text")):
# Override message
confirm_text = self.option_box_instance.confirm_text
page.set_label(confirm_text)
elif self.get_page_type(page) == gtk.ASSISTANT_PAGE_SUMMARY :
@ -562,6 +585,10 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
Depending on the success status, set the text for the final page.
"""
if (self.option_box_instance and
hasattr(self.option_box_instance, "no_fileselect")):
filename = ""
else:
filename = Utils.get_unicode_path(self.chooser.get_filename())
config.set('paths.recent-export-dir', os.path.split(filename)[0])
ix = self.get_selected_format_index()