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