'A function to generate prompts so that we can do dynamic prompts.'

def promptf(self):

    if self.in_macro:
        promptstr = self.promptstrs['macro']
    elif (not self.p.online):
        promptstr = self.promptstrs['offline']
    elif self.status.extruder_enabled:
        promptstr = self.promptstrs['online']
    else:
        promptstr = self.promptstrs['fallback']
    if ('%' not in promptstr):
        return promptstr
    else:
        specials = {}
        specials['extruder_temp'] = str(int(self.status.extruder_temp))
        specials['extruder_temp_target'] = str(int(self.status.extruder_temp_target))
        specials['port'] = self.settings.port[5:]
        if (self.status.extruder_temp_target == 0):
            specials['extruder_temp_fancy'] = (str(int(self.status.extruder_temp)) + DEG)
        else:
            specials['extruder_temp_fancy'] = ('%s%s/%s%s' % (str(int(self.status.extruder_temp)), DEG, str(int(self.status.extruder_temp_target)), DEG))
        if self.p.printing:
            progress = (int(((1000 * float(self.p.queueindex)) / len(self.p.mainqueue))) / 10)
        elif self.sdprinting:
            progress = self.percentdone
        else:
            progress = 0.0
        specials['progress'] = str(progress)
        if (self.p.printing or self.sdprinting):
            specials['progress_fancy'] = (('    ' + str(progress)) + '%')
        else:
            specials['progress_fancy'] = ''
        specials['red'] = '\x1b[31m'
        specials['green'] = '\x1b[32m'
        specials['white'] = '\x1b[37m'
        specials['bold'] = '\x1b[01m'
        specials['normal'] = '\x1b[00m'
        return (promptstr % specials)
