\(\renewcommand\AA{\text{Å}}\)
4. GSASII: GSAS-II GUI
4.1. Script G2.py
File G2.py can be used to start the GSAS-II graphical user interface (GUI), particularly when GSAS-II has been installed in a location outside of Python and thus requires changing the Python path. When GSAS-II is installed in a location that is on the default Python path, this command is sufficient to start the GSAS-II GUI:
python -c “from GSASII.GSASIIGUI import main; main()”
The G2.py script checks to see if GSAS-II is on the path. If not, the directory where the G2.py file is located is placed into the Python path. At this point the func:GSASIIGUI.main routine is called to start the GSAS-II GUI.
4.2. Module GSASIIGUI.py
The GSASIIGUI.py script imports GSASIIpath, which does some minor initialization
and then (before any wxPython calls can be made) creates a wx.App application.
At this point GSASIIpath.SetBinaryPath() is called to establish
the directory where GSAS-II binaries are found. If the binaries
are not installed or are incompatible with the OS/Python packages,
the user is asked if they should be updated from the subversion site.
The wxPython app is then passed to GSASIIdataGUI.GSASIImain(),
which creates the GSAS-II GUI and finally the event loop is started.
GSASIIGUI provides a short file that is used to start the GSAS-II GUI.
It is usually called from G2.py but this routine can also be invoked
directly when GSAS-II has been installed into Python.
On MacOS, a class, G2App, is defined inside main() that creates
a wxPython application. For other platforms wx.App() is called directly.