# -*- coding: utf-8 -*-
from ppms.migration.packet import *


class ChangeInterfaceDialogMessageToStatusbar(ChangeDTPPacket):
    '''Change the "critical error occurred" dialog message to a statusbar notice'''
    version = 1
    done_after_success = True
    run_on_startup = True
    category = PacketCategory.CATEGORY_MANDATORY
    wi_number = 12065

    def fix(self, runner):
        record = self.get_record(428, ['0990'], ['output_type_2', 'ole_symbol'])
        if not self.change_value(record, 'output_type_2', 1, 0):
            return self.fail('Could not change dialog message 000357 to a statusbar notice')

        if not self.change_value(record, 'ole_symbol', '000205', ''):
            return self.fail('Could not change dialog message 000357 to a statusbar notice')

        return self.success()
