Convert Assistants to Gtk3

svn: r20228
This commit is contained in:
Nick Hall 2012-08-18 21:05:33 +00:00
parent 5c6f4cf551
commit c0d1cfc4bc
5 changed files with 135 additions and 163 deletions

View File

@ -69,9 +69,6 @@ class ErrorReportAssistant(Gtk.Assistant):
self._error_details_text_buffer = None
self._final_report_text_buffer = None
self.logo = GdkPixbuf.Pixbuf.new_from_file(ICON)
self.splash = GdkPixbuf.Pixbuf.new_from_file(SPLASH)
self.set_title(_("Error Report Assistant"))
self.connect('close', self.close)
self.connect('cancel', self.close)
@ -110,7 +107,6 @@ class ErrorReportAssistant(Gtk.Assistant):
"""
Copy the bug report to the clipboard.
"""
#TODO GTK3 Is this clipboard copy working ??
clipboard = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(),
Gdk.SELECTION_CLIPBOARD)
clipboard.set_text(
@ -218,21 +214,17 @@ class ErrorReportAssistant(Gtk.Assistant):
label = Gtk.Label(label=self.get_intro_text())
label.set_line_wrap(True)
# Using set_page_side_image causes window sizing problems, so put the
# image in the main page instead.
image = Gtk.Image()
image.set_from_file(SPLASH)
hbox = Gtk.HBox()
hbox.pack_start(image, False, False, 0)
hbox.pack_start(label, True, True, 0)
box = Gtk.VBox()
box.pack_start(image, False, False, 5)
box.pack_start(label, False, False, 5)
page = hbox
page = box
page.show_all()
self.append_page(page)
self.set_page_header_image(page, self.logo)
#self.set_page_side_image(page, self.splash)
self.set_page_title(page, _('Report a bug'))
self.set_page_type(page, Gtk.AssistantPageType.INTRO)
@ -313,18 +305,23 @@ class ErrorReportAssistant(Gtk.Assistant):
"in the following pages of the assistant."))
side_label.set_line_wrap(True)
side_label.set_size_request(124, -1)
box = Gtk.HBox()
box.pack_start(side_label, False, False, 5)
image = Gtk.Image()
image.set_from_file(ICON)
heading = Gtk.HBox()
heading.pack_start(side_label, True, True, 5)
heading.pack_start(image, False, False, 5)
box = Gtk.VBox()
box.pack_start(heading, False, False, 5)
box.pack_start(error_details_frame, True, True, 0)
page = box
page.show_all()
self.append_page(page)
self.set_page_header_image(page, self.logo)
self.set_page_title(page, _("Report a bug: Step 1 of 5"))
self.set_page_title(page, _("Error Details"))
self.set_page_type(page, Gtk.AssistantPageType.CONTENT)
def build_page2(self):
@ -387,18 +384,23 @@ class ErrorReportAssistant(Gtk.Assistant):
"bug."))
side_label.set_line_wrap(True)
side_label.set_size_request(124, -1)
box = Gtk.HBox()
box.pack_start(side_label, False, False, 5)
image = Gtk.Image()
image.set_from_file(ICON)
heading = Gtk.HBox()
heading.pack_start(side_label, True, True, 5)
heading.pack_start(image, False, False, 5)
box = Gtk.VBox()
box.pack_start(heading, False, False, 5)
box.pack_start(sys_information_frame, True, True, 0)
page = box
page.show_all()
self.append_page(page)
self.set_page_header_image(page, self.logo)
self.set_page_title(page, _("Report a bug: Step 2 of 5"))
self.set_page_title(page, _("System Information"))
self.set_page_type(page, Gtk.AssistantPageType.CONTENT)
def build_page3(self):
@ -454,18 +456,23 @@ class ErrorReportAssistant(Gtk.Assistant):
"you were doing when the error occured."))
side_label.set_line_wrap(True)
side_label.set_size_request(124, -1)
box = Gtk.HBox()
box.pack_start(side_label, False, False, 5)
image = Gtk.Image()
image.set_from_file(ICON)
heading = Gtk.HBox()
heading.pack_start(side_label, True, True, 5)
heading.pack_start(image, False, False, 5)
box = Gtk.VBox()
box.pack_start(heading, False, False, 5)
box.pack_start(user_information_frame, True, True, 0)
page = box
page.show_all()
self.append_page(page)
self.set_page_header_image(page, self.logo)
self.set_page_title(page, _("Report a bug: Step 3 of 5"))
self.set_page_title(page, _("Further Information"))
self.set_page_type(page, Gtk.AssistantPageType.CONTENT)
def build_page4(self):
@ -516,18 +523,23 @@ class ErrorReportAssistant(Gtk.Assistant):
"website."))
side_label.set_line_wrap(True)
side_label.set_size_request(124, -1)
box = Gtk.HBox()
box.pack_start(side_label, False, False, 5)
image = Gtk.Image()
image.set_from_file(ICON)
heading = Gtk.HBox()
heading.pack_start(side_label, True, True, 5)
heading.pack_start(image, False, False, 5)
box = Gtk.VBox()
box.pack_start(heading, False, False, 5)
box.pack_start(summary_frame, True, True, 0)
page = box
page.show_all()
self.append_page(page)
self.set_page_header_image(page, self.logo)
self.set_page_title(page, _("Report a bug: Step 4 of 5"))
self.set_page_title(page, _("Bug Report Summary"))
self.set_page_type(page, Gtk.AssistantPageType.CONTENT)
def build_page5(self):
@ -551,6 +563,7 @@ class ErrorReportAssistant(Gtk.Assistant):
url_label.set_alignment(0.01, 0.5)
url_label.set_padding(0, 4)
url_label.set_line_wrap(True)
url_label.set_size_request(200, -1)
url_button = Gtk.Button("File bug report")
url_button.connect('clicked', self._start_gramps_bts_in_browser)
@ -577,6 +590,7 @@ class ErrorReportAssistant(Gtk.Assistant):
clip_label.set_alignment(0.01, 0.5)
clip_label.set_padding(0, 4)
clip_label.set_line_wrap(True)
clip_label.set_size_request(200, -1)
clip_button = Gtk.Button("Copy to clipboard")
clip_button.connect('clicked', self._copy_to_clipboard)
@ -618,18 +632,23 @@ class ErrorReportAssistant(Gtk.Assistant):
"system."))
side_label.set_line_wrap(True)
side_label.set_size_request(124, -1)
box = Gtk.HBox()
box.pack_start(side_label, False, False, 5)
image = Gtk.Image()
image.set_from_file(ICON)
heading = Gtk.HBox()
heading.pack_start(side_label, True, True, 5)
heading.pack_start(image, False, False, 5)
box = Gtk.VBox()
box.pack_start(heading, False, False, 5)
box.pack_start(outer_frame, True, True, 0)
page = box
page.show_all()
self.append_page(page)
self.set_page_header_image(page, self.logo)
self.set_page_title(page, _("Report a bug: Step 5 of 5"))
self.set_page_title(page, _("Send Bug Report"))
self.set_page_type(page, Gtk.AssistantPageType.CONTENT)
def create_page_summary(self):
@ -642,21 +661,17 @@ class ErrorReportAssistant(Gtk.Assistant):
label = Gtk.Label(label=text)
label.set_line_wrap(True)
# Using set_page_side_image causes window sizing problems, so put the
# image in the main page instead.
image = Gtk.Image()
image.set_from_file(SPLASH)
hbox = Gtk.HBox()
hbox.pack_start(image, False, False, 0)
hbox.pack_start(label, True, True, 0)
box = Gtk.VBox()
box.pack_start(image, False, False, 5)
box.pack_start(label, False, False, 5)
page = hbox
page = box
page.show_all()
self.append_page(page)
self.set_page_header_image(page, self.logo)
#self.set_page_side_image(page, self.splash)
self.set_page_title(page, _('Complete'))
self.set_page_type(page, Gtk.AssistantPageType.SUMMARY)

View File

@ -175,8 +175,8 @@ class GrampsWindowManager(object):
# Given an item, close its window and remove it's ID from the dict
if item.window_id:
del self.id2item[item.window_id]
if item.window:
item.window.destroy()
if item.get_window():
item.get_window().destroy()
def remove_item(self, track):
# We need the whole gymnastics below because our item
@ -418,6 +418,15 @@ class ManagedWindow(object):
self.window = window
self.window.connect('delete-event', self.close)
def get_window(self):
"""
Return the managed window.
"""
if self.isWindow:
return self
else:
return self.window
def update_title(self, text):
if self.isWindow:
set_titles(self, self.titlelabel, text, self.msg)

View File

@ -49,6 +49,7 @@ log = logging.getLogger(".ExportAssistant")
#
#-------------------------------------------------------------------------
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
#-------------------------------------------------------------------------
@ -109,18 +110,15 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
self.uistate = uistate
self.writestarted = False
self.confirm = None
#set up Assistant
GObject.GObject.__init__(self)
##workaround around bug http://bugzilla.gnome.org/show_bug.cgi?id=56070
self.forward_button = None
Gtk.Assistant.forall(self, self.get_forward_button)
## end
Gtk.Assistant.__init__(self)
#set up ManagedWindow
self.top_title = _("Export Assistant")
ManagedWindow.__init__(self,uistate,[],
self.__class__)
ManagedWindow.__init__(self, uistate, [], self.__class__)
#set_window is present in both parent classes
ManagedWindow.set_window(self, self, None,
self.top_title, isWindow=True)
@ -133,15 +131,6 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
if not self.person:
self.person = self.dbstate.db.find_initial_person()
try:
self.logo = GdkPixbuf.Pixbuf.new_from_file(ICON)
except:
self.logo = None
try:
self.splash = GdkPixbuf.Pixbuf.new_from_file(SPLASH)
except:
self.splash = None
pmgr = GuiPluginManager.get_instance()
self.__exporters = pmgr.get_export_plugins()
self.map_exporters = {}
@ -164,30 +153,6 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
#ManagedWindow show method
ManagedWindow.show(self)
def get_forward_button(self, arg):
if isinstance(arg, Gtk.HBox):
arg.forall(self._forward_btn)
def _forward_btn(self, arg):
if isinstance(arg, Gtk.Button) and arg.get_label() == 'gtk-go-forward':
self.forward_button = arg
def get_cancel_button(self, arg):
if isinstance(arg, Gtk.HBox):
arg.forall(self._cancel_btn)
def _cancel_btn(self, arg):
if isinstance(arg, Gtk.Button) and arg.get_label() == 'gtk-cancel':
self.cancel_button = arg
def get_close_button(self, arg):
if isinstance(arg, Gtk.HBox):
arg.forall(self._close_btn)
def _close_btn(self, arg):
if isinstance(arg, Gtk.Button) and arg.get_label() == 'gtk-close':
self.close_button = arg
def build_menu_names(self, obj):
"""Override ManagedWindow method."""
return (self.top_title, None)
@ -198,12 +163,17 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
label.set_line_wrap(True)
label.set_use_markup(True)
page = label
image = Gtk.Image()
image.set_from_file(SPLASH)
box = Gtk.VBox()
box.pack_start(image, False, False, 5)
box.pack_start(label, False, False, 5)
page = box
page.show_all()
self.append_page(page)
self.set_page_header_image(page, self.logo)
self.set_page_side_image(page, self.splash)
self.set_page_title(page, _('Saving your data'))
self.set_page_complete(page, True)
self.set_page_type(page, Gtk.AssistantPageType.INTRO)
@ -225,7 +195,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
table.set_row_spacings(6)
table.set_col_spacings(6)
group = None
button = None
recent_type = config.get('behavior.recent-export-type')
exporters = [(x.get_name().replace("_", ""), x) for x in self.__exporters]
@ -235,24 +205,21 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
title = exporter.get_name()
description= exporter.get_description()
self.map_exporters[ix] = exporter
button = Gtk.RadioButton(group,title)
button = Gtk.RadioButton.new_with_mnemonic_from_widget(button, title)
button.set_tooltip_text(description)
if not group:
group = button
self.format_buttons.append(button)
table.attach(button, 0, 2, 2*ix, 2*ix+1)
if ix == recent_type :
if ix == recent_type:
button.set_active(True)
ix += 1
box.add(table)
box.pack_start(table, False, False, 0)
page = box
page.show_all()
self.append_page(page)
self.set_page_header_image(page, self.logo)
self.set_page_title(page, _('Choose the output format'))
self.set_page_type(page, Gtk.AssistantPageType.CONTENT)
@ -267,7 +234,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
page.show_all()
self.append_page(page)
self.set_page_header_image(page, self.logo)
self.set_page_title(page, _('Export options'))
self.set_page_complete(page, False)
self.set_page_type(page, Gtk.AssistantPageType.CONTENT)
@ -297,9 +264,9 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
option = self.get_selected_format_index()
vbox = self.get_nth_page(_ExportAssistant_pages['options'])
(config_title, config_box_class) = self.map_exporters[option].get_config()
self.set_page_title(vbox, config_title)
#self.set_page_title(vbox, config_title)
# remove present content of the vbox
vbox.foreach(vbox.remove)
map(vbox.remove, vbox.get_children())
# add new content
if config_box_class:
self.option_box_instance = config_box_class(self.person, self.dbstate, self.uistate)
@ -336,10 +303,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
page = self.chooser
self.append_page(page)
self.set_page_header_image(page, self.logo)
self.set_page_title(page, _('Select Save File'))
#see if page can be set as complete :
self.check_fileselect(page)
self.set_page_title(page, _('Select save file'))
self.set_page_type(page, Gtk.AssistantPageType.CONTENT)
def check_fileselect(self, filechooser, event=None, show=True):
@ -356,25 +320,27 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
and folder and find_folder(folder):
#this page of the assistant is complete
self.set_page_complete(filechooser, True)
##workaround around bug http://bugzilla.gnome.org/show_bug.cgi?id=56070
if self.forward_button and show:
self.forward_button.hide()
self.forward_button.show()
## end
else :
self.set_page_complete(filechooser, False)
def create_page_confirm(self):
# Construct confirm page
label = Gtk.Label()
label.set_line_wrap(True)
label.set_use_markup(True)
label.show()
self.confirm = Gtk.Label()
self.confirm.set_line_wrap(True)
self.confirm.set_use_markup(True)
self.confirm.show()
page = label
image = Gtk.Image()
image.set_from_file(SPLASH)
box = Gtk.VBox()
box.set_border_width(12)
box.set_spacing(6)
box.pack_start(image, False, False, 5)
box.pack_start(self.confirm, False, False, 5)
page = box
self.append_page(page)
self.set_page_header_image(page, self.logo)
self.set_page_title(page, _('Final confirmation'))
self.set_page_type(page, Gtk.AssistantPageType.CONFIRM)
self.set_page_complete(page, True)
@ -383,26 +349,27 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
# Construct summary page
# As this is the last page needs to be of page_type
# Gtk.AssistantPageType.CONFIRM or Gtk.AssistantPageType.SUMMARY
page = Gtk.Alignment.new(xalign=0.5, yalign=0.5, xscale=0,
yscale=0)
vbox = Gtk.VBox()
vbox.set_border_width(12)
vbox.set_spacing(6)
image = Gtk.Image()
image.set_from_file(SPLASH)
vbox.pack_start(image, False, False, 5)
self.labelsum = Gtk.Label(label=_("Please wait while your data is selected and exported"))
self.labelsum.set_line_wrap(True)
self.labelsum.set_use_markup(True)
vbox.pack_start(self.labelsum, True, True, 0)
vbox.pack_start(self.labelsum, False, False, 0)
self.progressbar = Gtk.ProgressBar()
vbox.pack_start(self.progressbar, True, True, 0)
page.add(vbox)
page = vbox
page.show_all()
self.append_page(page)
self.set_page_header_image(page, self.logo)
self.set_page_title(page, _('Summary'))
self.set_page_side_image(page, self.splash)
self.set_page_complete(page, False)
self.set_page_type(page, Gtk.AssistantPageType.SUMMARY)
@ -441,18 +408,14 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
self.set_page_complete(self.get_nth_page(self.__previous_page),
False)
elif page_number == _ExportAssistant_pages['options'] :
elif page_number == _ExportAssistant_pages['options']:
self.create_options()
self.set_page_complete(page, True)
##workaround around bug http://bugzilla.gnome.org/show_bug.cgi?id=56070
if self.forward_button:
self.forward_button.hide()
self.forward_button.show()
## end
elif page == self.chooser :
# next page is the file chooser, reset filename, keep folder where user was
folder, name = self.suggest_filename()
if self.folder_is_set :
page.set_action(Gtk.FileChooserAction.SAVE)
if self.folder_is_set:
page.set_current_name(name)
else :
page.set_current_name(name)
@ -461,7 +424,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
# see if page is complete with above
self.check_fileselect(page, show=True)
elif self.get_page_type(page) == Gtk.AssistantPageType.CONFIRM :
elif self.get_page_type(page) == Gtk.AssistantPageType.CONFIRM:
# The confirm page with apply button
# Present user with what will happen
ix = self.get_selected_format_index()
@ -488,7 +451,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
confirm_text = _(
'The data will be saved as follows:\n\n'
'Format:\t%(format)s\nName:\t%(name)s\nFolder:\t%(folder)s\n\n'
'Press Apply to proceed, Back to revisit '
'Press Apply to proceed, Go Back to revisit '
'your options, or Cancel to abort') % {
'format': format.replace("_",""),
'name': name,
@ -509,7 +472,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
hasattr(self.option_box_instance, "confirm_text")):
# Override message
confirm_text = self.option_box_instance.confirm_text
page.set_label(confirm_text)
self.confirm.set_label(confirm_text)
elif self.get_page_type(page) == Gtk.AssistantPageType.SUMMARY :
# The summary page
@ -547,12 +510,6 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
else :
#whatever other page, if we show it, it is complete to
self.set_page_complete(page, True)
if page_number == _ExportAssistant_pages['exporttypes'] :
##workaround around bug http://bugzilla.gnome.org/show_bug.cgi?id=56070
if self.forward_button:
self.forward_button.hide()
self.forward_button.show()
## end
#remember previous page for next time
self.__previous_page = page_number
@ -649,15 +606,15 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
def set_busy_cursor(self,value):
"""Set or unset the busy cursor while saving data.
Note : self.window is the Gtk.Assistant Gtk.Window, not
Note : self.get_window() is the Gtk.Assistant Gtk.Window, not
a part of ManagedWindow
"""
if value:
self.window.set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH))
self.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH))
#self.set_sensitive(0)
else:
self.window.set_cursor(None)
self.get_window().set_cursor(None)
#self.set_sensitive(1)
while Gtk.events_pending():
@ -671,6 +628,3 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
self.progressbar.set_text("%d%%" % value)
while Gtk.events_pending():
Gtk.main_iteration()

View File

@ -140,7 +140,7 @@ class WriterOptionBox(object):
widget = Gtk.VBox()
full_database_row = Gtk.HBox()
full_database_row.pack_start(Gtk.Label(_("Unfiltered Family Tree:", True, True, 0)), False)
full_database_row.pack_start(Gtk.Label(_("Unfiltered Family Tree:")), True, True, 0)
people_count = len(self.dbstate.db.get_person_handles())
button = Gtk.Button(ngettext("%d Person", "%d People", people_count) %
people_count)
@ -264,7 +264,7 @@ class WriterOptionBox(object):
box.pack_start(
gui.widgets.SimpleButton(Gtk.STOCK_EDIT,
lambda obj: self.edit_filter('Person', self.filter_obj)),
False)
False, True, 0)
button.set_tooltip_text(_("Click to see preview after person filter"))
elif proxy_name == "note":
# Frame Note:
@ -281,7 +281,7 @@ class WriterOptionBox(object):
box.pack_start(
gui.widgets.SimpleButton(Gtk.STOCK_EDIT,
lambda obj: self.edit_filter('Note', self.filter_note)),
False)
False, True, 0)
button.set_tooltip_text(_("Click to see preview after note filter"))
elif proxy_name == "privacy":
# Frame 3:

View File

@ -85,15 +85,12 @@ class MediaMan(tool.Tool):
self.build_batch_ops()
self.assistant = Gtk.Assistant()
self.logo = GdkPixbuf.Pixbuf.new_from_file(ICON)
self.splash = GdkPixbuf.Pixbuf.new_from_file(SPLASH)
self.assistant.set_title(_('Gramps Media Manager'))
self.assistant.connect('close', self.close)
self.assistant.connect('cancel', self.close)
self.assistant.connect('apply', self.run)
self.assistant.connect('prepare', self.prepare)
self.assistant.set_forward_page_func(self.forward_page, None)
intro = IntroductionPage()
self.add_page(intro, Gtk.AssistantPageType.INTRO, _('Introduction'))
@ -109,6 +106,7 @@ class MediaMan(tool.Tool):
self.add_page(self.conclusion, Gtk.AssistantPageType.SUMMARY)
self.assistant.show()
self.assistant.set_forward_page_func(self.forward_page, None)
def close(self, assistant):
"""
@ -144,7 +142,6 @@ class MediaMan(tool.Tool):
"""
page.show_all()
self.assistant.append_page(page)
self.assistant.set_page_header_image(page, self.logo)
self.assistant.set_page_title(page, title)
self.assistant.set_page_type(page, page_type)
@ -197,7 +194,7 @@ class MediaMan(tool.Tool):
# Assistant pages
#
#------------------------------------------------------------------------
class IntroductionPage(Gtk.HBox):
class IntroductionPage(Gtk.VBox):
"""
A page containing introductory text.
"""
@ -214,7 +211,7 @@ class IntroductionPage(Gtk.HBox):
label.set_use_markup(True)
self.pack_start(image, False, False, 0)
self.pack_start(label, True, True, 0)
self.pack_start(label, False, False, 5)
def __get_intro_text(self):
"""
@ -254,15 +251,13 @@ class SelectionPage(Gtk.VBox):
table.set_row_spacings(6)
table.set_col_spacings(6)
group = None
button = None
for index in range(len(batch_ops)):
title = batch_ops[index].title
description = batch_ops[index].description
button = Gtk.RadioButton(group, title)
button = Gtk.RadioButton.new_with_mnemonic_from_widget(button, title)
button.set_tooltip_text(description)
if not group:
group = button
self.batch_op_buttons.append(button)
table.attach(button, 0, 2, 2 * index, 2 * index + 1, yoptions=0)
@ -302,6 +297,7 @@ class SettingsPage(Gtk.VBox):
self.show_all()
return True
else:
self.assistant.set_page_title(self, '')
return False
class ConfirmationPage(Gtk.VBox):
@ -353,7 +349,7 @@ class ConfirmationPage(Gtk.VBox):
for path in path_list:
self.path_model.append(row=[path])
class ConclusionPage(Gtk.HBox):
class ConclusionPage(Gtk.VBox):
"""
A page to display the summary of the proposed action, as well as the
list of affected paths.
@ -363,8 +359,6 @@ class ConclusionPage(Gtk.HBox):
self.assistant = assistant
# Using set_page_side_image causes window sizing problems, so put the
# image in the main page instead.
image = Gtk.Image()
image.set_from_file(SPLASH)
@ -372,7 +366,7 @@ class ConclusionPage(Gtk.HBox):
self.label.set_line_wrap(True)
self.pack_start(image, False, False, 0)
self.pack_start(self.label, True, True, 0)
self.pack_start(self.label, False, False, 5)
def set_result(self, success):
if success: