Initialize Python before constructing the python console

Python was being initialized when executing code in the pqPythonShell
constructor. Instead, Python should be initialized explicitly by the
pqPythonManager before constructing the pqPythonDialog object.
The pqPythonShell does not need to handle the EnterEvent anymore.

Change-Id: Ib7d97929f989687194ab4a91f1fae6397eb4fc50
Remove pqPythonShell::initPythonInerpreter callback.

Now, the pyPythonManager calls pqPythonShell::setupInterpreter() after
the pqPythonShell has been created.  This way, the pyPythonShell does
not execute an python code in its constructor, but the pqPythonManager
guarantees that it is fully initialized after construction.

Executing python code in the constructor is bad because of the way stdout
is handled in a callback by the pqPythonManager, and using a timer to
initialize later is bad because the stdout won't be routed correctly
until after the timer callback.

This commit also removes the ExitEvent handling from the pyPythonShell
since ParaView only finializes Python once at exit, there is no need to
have a handler to reset the pyPythonShell.

Change-Id: Ib9b53f38f4b7fc558823dcb11c029554bd23828c
Remove unused methods in pqPythonManager

Change-Id: I6786ecfa3905e447c8926022f764cf2130067d63
Use the python main context instead of the interactive console for trace.

The record trace and trace state features can execute in the __main__
python context using vtkPythonInterpreter::RunSimpleString() instead
of executing in the context of the interactive console owned by the
pqPythonShell.

I can't think of a reason to prefer one context instead of the other, but
using the __main__ context simplifies the code in pqPythonManager.
In either case, the only variables written to the context is the imported
smtrace module name and the __smtraceString str object.

Change-Id: I5239067c9d95a27f9a5867fd075b4bc146c4da76
Remove the call to smtrace.print_trace from smstate.trace_state.

The print statement is unnecessary.  The trace is saved to a file, so the
printing is probably a remnant from development and debugging of smstate.

Change-Id: I626dcb1be4a745bec59e81e2b09e5824995107a5
Merge topic 'python-refactoring' into next

417805d Remove the call to smtrace.print_trace from smstate.trace_state.
bb42bba Use the python main context instead of the interactive console for trace.
51ea4d2 Remove unused methods in pqPythonManager
e8f63bb Remove pqPythonShell::initPythonInerpreter callback.
90286ff Initialize Python before constructing the python console