Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept --gui=<...> switch in IPython qtconsole. #1707

Merged
merged 4 commits into from May 31, 2012

Conversation

bfroehle
Copy link
Contributor

@bfroehle bfroehle commented May 7, 2012

If both --gui and --pylab are given, we use the value in --pylab, just
like the terminal IPython application.

Closes #1532.

gui, backend = pylabtools.find_gui_and_backend(self.pylab)
shell.enable_pylab(gui, import_all=self.pylab_import_all)
else:
shell.enable_gui(self.gui)
except Exception:
self.log.error("Pylab initialization failed", exc_info=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this error message be updated?

@bfroehle
Copy link
Contributor Author

bfroehle commented May 7, 2012

Yes, how about these error messages?

@takluyver
Copy link
Member

Yep, that looks OK.

@takluyver
Copy link
Member

Test results for commit 17481d8 merged into master
Platform: linux2

  • python2.7: OK
  • python3.1: OK (libraries not available: matplotlib pymongo qt wx wx.aui zmq)
  • python3.2: OK (libraries not available: pymongo wx wx.aui)

Not available for testing: python2.6

@minrk
Copy link
Member

minrk commented May 7, 2012

Don't the gui/pylab flags belong in the InteractiveShellApp base class? (Sorry for putting our code cleanup/consolidation on you again).

@bfroehle
Copy link
Contributor Author

bfroehle commented May 8, 2012

@minrk: Yes the gui/pylab flags do belong in InteractiveShellApp but it's somewhat complicated. I've updated the pull request accordingly.

@minrk
Copy link
Member

minrk commented May 8, 2012

Hm, perhaps the best way is to include 'inline' in the Enum, and define _pylab_changed to raise an exception on inline in the TerminalIPythonApp.

@bfroehle
Copy link
Contributor Author

bfroehle commented May 8, 2012

The behavior I implemented replaces 'inline' with 'auto' in TerminalIPythonApp. It'd be easy to raise an exception instead. Any thoughts?

@bfroehle
Copy link
Contributor Author

bfroehle commented May 8, 2012

Test results for commit a327cb1 merged into master
Platform: linux2

  • python2.7: OK
  • python3.2: OK (libraries not available: matplotlib pymongo tornado wx wx.aui)

Not available for testing:

shell._showtraceback = _showtraceback


def init_gui_pylab(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this method differ from the one in the parent, or should it be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read below:

   # Provide a wrapper for :meth:`InteractiveShellApp.init_gui_pylab`
   # to ensure that any exception is printed straight to stderr.
   # Normally _showtraceback associates the reply with an execution,
   # which means frontends will never draw it, as this exception
   # is not associated with any execute request.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, sorry about that. Nevermind.

@minrk
Copy link
Member

minrk commented May 8, 2012

And a warning is fine, no need for the error I mentioned.

@minrk
Copy link
Member

minrk commented May 31, 2012

Can you rebase? This has developed a conflict. But after a rebase, I think it's ready.

@bfroehle
Copy link
Contributor Author

Rebased. The conflict was because of

- # Local imports.
+ # Local imports

in 6174cb0

@minrk
Copy link
Member

minrk commented May 31, 2012

lol, that's a rough one. I'll give this one more look over, then it should be set.

@@ -151,6 +165,15 @@ def _extra_extension_changed(self, name, old, new):
module_to_run = Unicode('', config=True,
help="Run the module as a script."
)
gui = CaselessStrEnum(('qt', 'wx', 'gtk', 'glut', 'pyglet'), config=True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 'osx' should be an option here.

@minrk
Copy link
Member

minrk commented May 31, 2012

Other than adding 'osx' as an option (or reminding me why that's stupid), this is ready to go.

@@ -246,15 +235,6 @@ def _quick_changed(self, name, old, new):
self.load_config_file = lambda *a, **kw: None
self.ignore_old_config=True

gui = CaselessStrEnum(('qt', 'wx', 'gtk', 'glut', 'pyglet'), config=True,
help="Enable GUI event loop integration ('qt', 'wx', 'gtk', 'glut', 'pyglet')."
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding 'osx' as an option: I have no idea...

The list of options was formed by copy & paste from here.

@bfroehle
Copy link
Contributor Author

Rebased again, added --gui=osx option.

Seems to work:

$ ipython --gui=wx
...
In [1]: from IPython.lib.inputhook import inputhook_manager; inputhook_manager.current_gui()
wx

@minrk
Copy link
Member

minrk commented May 31, 2012

Thanks, seems to be working for me. Merging away.

minrk added a commit that referenced this pull request May 31, 2012
move gui/pylab to shellapp base class

If both --gui and --pylab are given, we use the value in --pylab, just
like the terminal IPython application.

Closes #1532
@minrk minrk merged commit bd1da13 into ipython:master May 31, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
move gui/pylab to shellapp base class

If both --gui and --pylab are given, we use the value in --pylab, just
like the terminal IPython application.

Closes ipython#1532
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

qtconsole does not accept --gui switch
3 participants