Commit f548a6ea authored by Manish Singh's avatar Manish Singh Committed by Manish Singh

plug-ins/pygimp/plug-ins/pyconsole.py Make CTRL-D close the console.

2006-10-22  Manish Singh  <yosh@gimp.org>

        * plug-ins/pygimp/plug-ins/pyconsole.py
        * plug-ins/pygimp/plug-ins/gimpcons.py: Make CTRL-D close the
        console.
parent 44295d33
2006-10-22 Manish Singh <yosh@gimp.org>
* plug-ins/pygimp/plug-ins/pyconsole.py
* plug-ins/pygimp/plug-ins/gimpcons.py: Make CTRL-D close the
console.
2006-10-21 Manish Singh <yosh@gimp.org>
* plug-ins/pygimp/plug-ins/pyconsole.py: Windows is dumb, special
......
......@@ -65,7 +65,8 @@ def console():
sys.version)
import pyconsole
cons = pyconsole.Console(locals=namespace, banner=banner)
cons = pyconsole.Console(locals=namespace, banner=banner,
quit_func=lambda: gtk.main_quit())
dialog.connect("response", response, cons)
......
......@@ -104,9 +104,11 @@ class _ReadLine(object):
except KeyError:
return self.items[self.ptr]
def __init__(self):
def __init__(self, quit_func=None):
object.__init__(self)
self.quit_func = quit_func
self.set_wrap_mode(gtk.WRAP_CHAR)
self.modify_font(pango.FontDescription("Monospace"))
......@@ -278,6 +280,9 @@ class _ReadLine(object):
start = self.__get_start()
end = self.__get_cursor()
self.__delete(start, end)
elif keyval == _keys.d:
if self.quit_func:
self.quit_func()
else:
handled = False
else:
......@@ -447,8 +452,8 @@ class _ReadLine(object):
class _Console(_ReadLine, code.InteractiveInterpreter):
def __init__(self, locals=None, banner=None,
completer=None, use_rlcompleter=True,
start_script=None):
_ReadLine.__init__(self)
start_script=None, quit_func=None):
_ReadLine.__init__(self, quit_func)
code.InteractiveInterpreter.__init__(self, locals)
self.locals["__console__"] = self
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment