Show More
@@ -1,34 +1,34 b'' | |||
|
1 | 1 | # encoding: utf-8 |
|
2 | 2 | """ |
|
3 | 3 | Enable Gtk3 to be used interacive by IPython. |
|
4 | 4 | |
|
5 | 5 | Authors: Thomi Richards |
|
6 | 6 | """ |
|
7 | 7 | #----------------------------------------------------------------------------- |
|
8 | 8 | # Copyright (c) 2012, the IPython Development Team. |
|
9 | 9 | # |
|
10 | 10 | # Distributed under the terms of the Modified BSD License. |
|
11 | 11 | # |
|
12 | 12 | # The full license is in the file COPYING.txt, distributed with this software. |
|
13 | 13 | #----------------------------------------------------------------------------- |
|
14 | 14 | |
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | # Imports |
|
17 | 17 | #----------------------------------------------------------------------------- |
|
18 | 18 | |
|
19 | 19 | import sys |
|
20 | 20 | from gi.repository import Gtk, GLib |
|
21 | 21 | |
|
22 | 22 | #----------------------------------------------------------------------------- |
|
23 | 23 | # Code |
|
24 | 24 | #----------------------------------------------------------------------------- |
|
25 | 25 | |
|
26 | 26 | def _main_quit(*args, **kwargs): |
|
27 | 27 | Gtk.main_quit() |
|
28 | 28 | return False |
|
29 | 29 | |
|
30 | 30 | |
|
31 | 31 | def inputhook_gtk3(): |
|
32 | GLib.io_add_watch(sys.stdin, GLib.IO_IN, _main_quit) | |
|
32 | GLib.io_add_watch(sys.stdin, GLib.PRIORITY_DEFAULT, GLib.IO_IN, _main_quit) | |
|
33 | 33 | Gtk.main() |
|
34 | 34 | return 0 |
@@ -1,12 +1,12 b'' | |||
|
1 | 1 | """prompt_toolkit input hook for GTK 3 |
|
2 | 2 | """ |
|
3 | 3 | |
|
4 | 4 | from gi.repository import Gtk, GLib |
|
5 | 5 | |
|
6 | 6 | def _main_quit(*args, **kwargs): |
|
7 | 7 | Gtk.main_quit() |
|
8 | 8 | return False |
|
9 | 9 | |
|
10 | 10 | def inputhook(context): |
|
11 | GLib.io_add_watch(context.fileno(), GLib.IO_IN, _main_quit) | |
|
11 | GLib.io_add_watch(context.fileno(), GLib.PRIORITY_DEFAULT, GLib.IO_IN, _main_quit) | |
|
12 | 12 | Gtk.main() |
General Comments 0
You need to be logged in to leave comments.
Login now