Changeset 4148 for trunk/GSASII.py


Ignore:
Timestamp:
Sep 13, 2019 5:06:45 PM (2 years ago)
Author:
toby
Message:

refactor to create wx app before anything else gets done

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r3858 r4148  
    1414
    1515This is the script to start the GSAS-II graphical user interface (GUI).
    16 This script imports GSASIIpath, does some minor initialization
    17 and then launches :func:`GSASIIdataGUI.GSASIImain`,
    18 which creates a wx.Application that in turns creates the GUI.
    19 If the GSAS-II binaries are not installed or are incompatible with
    20 the OS/Python packages, the user is asked if they should be updated
    21 from the subversion site.
     16This script imports GSASIIpath, which does some minor initialization
     17and then (before any wxPython calls can be made) creates a wx.App application.
     18A this point :func:`GSASIIpath.SetBinaryPath` is called to establish
     19the directory where GSAS-II binaries are found. If the binaries
     20are not installed or are incompatible with the OS/Python packages,
     21the user is asked if they should be updated from the subversion site.
     22The wxPython app is then passed to :func:`GSASIIdataGUI.GSASIImain`,
     23which creates the GSAS-II GUI and finally the event loop is started.
    2224'''
    2325
    2426import platform
     27import wx
    2528import GSASIIpath
     29GSASIIpath.SetVersionNumber("$Revision$")
    2630
    2731__version__ = '1.0.0'
    2832
    2933if __name__ == '__main__':
     34    application = wx.App(0) # create the GUI framework
    3035    try:
    3136        GSASIIpath.SetBinaryPath(True)
     
    4550        print('Updating...')
    4651        GSASIIpath.svnUpdateProcess()
    47     GSASIIpath.SetVersionNumber("$Revision$")
    4852    GSASIIpath.InvokeDebugOpts()
    4953    import GSASIIdataGUI as G2gd   
    50     G2gd.GSASIImain() # start the GUI
     54    G2gd.GSASIImain(application) # start the GUI
     55    application.MainLoop()
Note: See TracChangeset for help on using the changeset viewer.