def _on_dialog_main_response(self, dialog, response): dialog.destroy() error_text = self.errors['stderr'] missing_dlls = self.errors['missing-dlls'] if response == 10: show_explanation = False text = _( "A possible cause of the error could be one or more of the following:" ) + "\n" for dll in missing_dlls.keys(): text += "\n\t" + _( "The library file (DLL) <b>%s</b> wasn't found.") % dll missing_packages = [] for packages in missing_dlls.values(): for package in packages: if package not in missing_packages: missing_packages.append(package) if len(missing_packages): if len(missing_packages) == 1: text += str( "\n\n" + _("Based on this output it looks like " + "you need to install <b>{package}</b> in order " + "to get <b>{program}</b> to run successfully.") ).format(package=missing_packages[0], program=common.escape_xml(self.name)) else: list_of_packages = ( _("{comma_separated_list} and {last_part}").format( comma_separated_list=_(", ").join([ "<b>{0}</b>".format(i) for i in missing_packages[:-1] ]), last_part=missing_packages[-1])) text += str( "\n\n" + _("Based on this output it looks like " + "you need to install {packages} in order to get " + "<b>{program}</b> to run successfully.")).format( packages=list_of_packages, program=common.escape_xml(self.name)) show_explanation = True # We didn't find anything, just display the raw output else: text = _("When running <b>{program_name}</b> " + "Wine returned the following errors:").format( program_name=common.escape_xml(self.name)) self._show_dialog_program_error(self.name, text, error_text, show_explanation) else: sys.stdout.write(error_text + '\n')
def _show_dialog_program_error_question(self, offer_info=True): dialog = gtk.MessageDialog(parent=common.get_main_window(), flags=gtk.DIALOG_DESTROY_WITH_PARENT, type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK) dialog.set_icon_name('vineyard-preferences') dialog.set_markup('<span weight="bold" size="larger">%s</span>' % \ _("The program exited with an error")) if self.name == 'winetricks': dialog.format_secondary_markup(unicode('The installation program did ' + \ 'not exit cleanly. You may have success with simply running it again.')) else: dialog.format_secondary_markup(unicode('The program <b>%(program)s</b> did ' + \ 'not exit cleanly and any work or progress you may have ' + \ 'done in the program may have been lost.') % \ {'program': common.escape_xml(self.name)}) settings = gtk.settings_get_default() settings.set_property('gtk-alternative-button-order', True) if offer_info: button_info = gtk.Button(_("More info")) dialog.add_action_widget(button_info, 10) dialog.set_alternative_button_order([10, gtk.RESPONSE_OK]) dialog.set_default_response(gtk.RESPONSE_OK) dialog.connect("response", self._on_dialog_main_response) dialog.show_all()
def _on_dialog_main_response(self, dialog, response): dialog.destroy() error_text = self.errors['stderr'] missing_dlls = self.errors['missing-dlls'] if response == 10: show_explanation = False text = _("A possible cause of the error could be one or more of the following:")+"\n" for dll in missing_dlls.keys(): text += "\n\t"+_("The library file (DLL) <b>%s</b> wasn't found.") % dll missing_packages = [] for packages in missing_dlls.values(): for package in packages: if package not in missing_packages: missing_packages.append(package) if len(missing_packages): if len(missing_packages) == 1: text += str("\n\n"+_( "Based on this output it looks like " + "you need to install <b>{package}</b> in order " + "to get <b>{program}</b> to run successfully." )).format( package = missing_packages[0], program = common.escape_xml(self.name) ) else: list_of_packages = ( _("{comma_separated_list} and {last_part}").format( comma_separated_list = _(", ").join( [ "<b>{0}</b>".format(i) for i in missing_packages[:-1] ] ), last_part = missing_packages[-1] )) text += str("\n\n"+_( "Based on this output it looks like " + "you need to install {packages} in order to get " + "<b>{program}</b> to run successfully." )).format( packages = list_of_packages, program = common.escape_xml(self.name) ) show_explanation = True # We didn't find anything, just display the raw output else: text = _( "When running <b>{program_name}</b> " + "Wine returned the following errors:" ).format(program_name = common.escape_xml(self.name)) self._show_dialog_program_error(self.name, text, error_text, show_explanation) else: sys.stdout.write(error_text+'\n')