Author Adnan.Umer
Recipients Adnan.Umer, terry.reedy
Date 2014-04-16.16:50:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1397667005.87.0.0595828877667.issue21192@psf.upfronthosting.co.za>
In-reply-to
Content
I tried to replace RESTART by doing these little changing

# PyShell.Py
class ModifiedInterpreter(InteractiveInterpreter):
    def restart_subprocess(self, with_cwd=False, with_msg=True):
        ...
        if with_msg:
            halfbar = ((int(console.width) - 16) // 2) * '='
            console.write(halfbar + ' RESTART ' + halfbar)

    def runcode(self, code):
        with_msg = True
        if code.co_filename[0] != '<':
            self.tkconsole.write('Executing ' + code.co_filename + '\n')
            with_msg = False
        
        if self.tkconsole.executing:
            self.interp.restart_subprocess(with_msg)

# ScriptBinding.Py
class ScriptBinding:
    def _run_module_event(self, event):
        filename = self.getfilename()
        if not filename:
            return 'break'
        code = self.checksyntax(filename)
        if not code:
            return 'break'
        if not self.tabnanny(filename):
            return 'break'
        interp = self.shell.interp
        if PyShell.use_subprocess:
            interp.restart_subprocess(with_cwd=False, with_msg=False)

This works fine and replaces RESTART with Execute <filename> when file is executed in Python Shell.

Also instead of this

halfbar = ((int(console.width) - 16) // 2) * '='
console.write(halfbar + ' RESTART ' + halfbar)

my recomemdation is:
console.write('[SHELL RESTART]')
History
Date User Action Args
2014-04-16 16:50:05Adnan.Umersetrecipients: + Adnan.Umer, terry.reedy
2014-04-16 16:50:05Adnan.Umersetmessageid: <1397667005.87.0.0595828877667.issue21192@psf.upfronthosting.co.za>
2014-04-16 16:50:05Adnan.Umerlinkissue21192 messages
2014-04-16 16:50:05Adnan.Umercreate