Show More
@@ -773,17 +773,17 b' class IPShellGTK(IPThread):' | |||
|
773 | 773 | debug=1,shell_class=MTInteractiveShell): |
|
774 | 774 | |
|
775 | 775 | import gtk |
|
776 | # Check for set_interactive, coming up in new pygtk. | |
|
777 | # Disable it so that this code works, but notify | |
|
778 | # the user that he has a better option as well. | |
|
779 | # XXX TODO better support when set_interactive is released | |
|
780 | try: | |
|
781 | gtk.set_interactive(False) | |
|
782 | print "Your PyGtk has set_interactive(), so you can use the" | |
|
783 | print "more stable single-threaded Gtk mode." | |
|
784 | print "See https://bugs.launchpad.net/ipython/+bug/270856" | |
|
785 | except AttributeError: | |
|
786 | pass | |
|
776 | ## # Check for set_interactive, coming up in new pygtk. | |
|
777 | ## # Disable it so that this code works, but notify | |
|
778 | ## # the user that he has a better option as well. | |
|
779 | ## # XXX TODO better support when set_interactive is released | |
|
780 | ## try: | |
|
781 | ## gtk.set_interactive(False) | |
|
782 | ## print "Your PyGtk has set_interactive(), so you can use the" | |
|
783 | ## print "more stable single-threaded Gtk mode." | |
|
784 | ## print "See https://bugs.launchpad.net/ipython/+bug/270856" | |
|
785 | ## except AttributeError: | |
|
786 | ## pass | |
|
787 | 787 | |
|
788 | 788 | self.gtk = gtk |
|
789 | 789 | self.gtk_mainloop = hijack_gtk() |
@@ -1149,6 +1149,15 b' class IPShellMatplotlibQt4(IPShellQt4):' | |||
|
1149 | 1149 | #----------------------------------------------------------------------------- |
|
1150 | 1150 | # Factory functions to actually start the proper thread-aware shell |
|
1151 | 1151 | |
|
1152 | def check_gtk(mode): | |
|
1153 | import gtk | |
|
1154 | if hasattr(gtk,'set_interactive'): | |
|
1155 | gtk.set_interactive(False) | |
|
1156 | return 'tkthread' | |
|
1157 | else: | |
|
1158 | return mode | |
|
1159 | ||
|
1160 | ||
|
1152 | 1161 | def _select_shell(argv): |
|
1153 | 1162 | """Select a shell from the given argv vector. |
|
1154 | 1163 | |
@@ -1218,6 +1227,9 b' def _select_shell(argv):' | |||
|
1218 | 1227 | else: |
|
1219 | 1228 | # Any other backend, use plain Tk |
|
1220 | 1229 | th_mode = 'tkthread' |
|
1230 | ||
|
1231 | # New versions of pygtk don't need the brittle threaded support. | |
|
1232 | th_mode = check_gtk(th_mode) | |
|
1221 | 1233 | |
|
1222 | 1234 | return mpl_shell[th_mode] |
|
1223 | 1235 | else: |
@@ -1226,6 +1238,9 b' def _select_shell(argv):' | |||
|
1226 | 1238 | th_mode = special_opts.pop() |
|
1227 | 1239 | except KeyError: |
|
1228 | 1240 | th_mode = 'tkthread' |
|
1241 | ||
|
1242 | # New versions of pygtk don't need the brittle threaded support. | |
|
1243 | th_mode = check_gtk(th_mode) | |
|
1229 | 1244 | return th_shell[th_mode] |
|
1230 | 1245 | |
|
1231 | 1246 |
@@ -25,6 +25,7 b' prompts ``Yade [1]:`` and ``-> [1]:``::' | |||
|
25 | 25 | prompt_in2=" .\D..", |
|
26 | 26 | prompt_out=" -> [\#]:" |
|
27 | 27 | ) |
|
28 | id.reconfig_shell() | |
|
28 | 29 | |
|
29 | 30 | import ipython_console_highlighting as ich |
|
30 | 31 | ich.IPythonConsoleLexer.input_prompt= |
@@ -213,7 +214,7 b' class EmbeddedSphinxShell(object):' | |||
|
213 | 214 | argv, self.user_ns, self.user_glocal_ns, embedded=True, |
|
214 | 215 | #shell_class=IPython.Shell.InteractiveShell, |
|
215 | 216 | shell_class=MatplotlibShell, |
|
216 |
rc_override = dict(colors = 'NoColor' |
|
|
217 | rc_override = dict(colors = 'NoColor', **rc_override)) | |
|
217 | 218 | |
|
218 | 219 | self.input = '' |
|
219 | 220 | self.output = '' |
@@ -402,6 +403,13 b' class EmbeddedSphinxShell(object):' | |||
|
402 | 403 | # ipython_directive itself. |
|
403 | 404 | shell = EmbeddedSphinxShell() |
|
404 | 405 | |
|
406 | def reconfig_shell(): | |
|
407 | """Called after setting module-level variables to re-instantiate | |
|
408 | with the set values (since shell is instantiated first at import-time | |
|
409 | when module variables have default values)""" | |
|
410 | global shell | |
|
411 | shell = EmbeddedSphinxShell() | |
|
412 | ||
|
405 | 413 | |
|
406 | 414 | def ipython_directive(name, arguments, options, content, lineno, |
|
407 | 415 | content_offset, block_text, state, state_machine, |
General Comments 0
You need to be logged in to leave comments.
Login now