Revision 593 org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/scripting/lib/console/console.py

View differences:

console.py
18 18
import traceback
19 19
from code import InteractiveInterpreter
20 20
from org.python.util import InteractiveConsole
21
#InteractiveConsole=sys.gvSIG.classForName("org.python.util.InteractiveConsole")
22 21

  
23 22
__author__ = "Don Coleman <dcoleman@chariotsolutions.com>"
24 23
__cvsid__ = "$Id: console.py 5910 2006-06-20 10:03:31Z jmvivo $"
......
374 373
    def __init__(self):
375 374
        self.title = "Jython"
376 375
        self.size = (600, 400)
377
        try:
378
            #No queremos que se salga cuando cerremos la ventana
379
            ##self.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE)            
380
            self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
381
        except:
382
            # assume jdk < 1.4
383
            self.addWindowListener(KillListener())
384
            self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
376
        self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
385 377

  
386
class KillListener(WindowAdapter):
387
    """
388
    Handle EXIT_ON_CLOSE for jdk < 1.4
389
    Thanks to James Richards for this method
390
    """
391
    def windowClosed(self, evt):
392
        import java.lang.System as System
393
        System.exit(0)
394 378

  
395 379
def main():
396 380
    frame = JythonFrame()

Also available in: Unified diff