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