source: trunk/GSASII.py @ 4148

Last change on this file since 4148 was 4148, checked in by toby, 4 years ago

refactor to create wx app before anything else gets done

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Date Author Revision URL Id
File size: 1.8 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3#GSASII
4########### SVN repository information ###################
5# $Date: 2019-09-13 22:06:45 +0000 (Fri, 13 Sep 2019) $
6# $Author: toby $
7# $Revision: 4148 $
8# $URL: trunk/GSASII.py $
9# $Id: GSASII.py 4148 2019-09-13 22:06:45Z toby $
10########### SVN repository information ###################
11'''
12*GSAS-II GUI*
13=====================
14
15This is the script to start the GSAS-II graphical user interface (GUI).
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.
24'''
25
26import platform
27import wx
28import GSASIIpath
29GSASIIpath.SetVersionNumber("$Revision: 4148 $")
30
31__version__ = '1.0.0'
32
33if __name__ == '__main__':
34    application = wx.App(0) # create the GUI framework
35    try:
36        GSASIIpath.SetBinaryPath(True)
37    except:
38        print('Unable to run with current setup, do you want to update to the')
39        try:
40            if '2' in platform.python_version_tuple()[0]:           
41                ans = raw_input("latest GSAS-II version? Update ([Yes]/no): ")
42            else:
43                ans = input("latest GSAS-II version? Update ([Yes]/no): ")               
44        except:
45            ans = 'no'
46        if ans.strip().lower() == "no":
47            import sys
48            print('Exiting')
49            sys.exit()
50        print('Updating...')
51        GSASIIpath.svnUpdateProcess()
52    GSASIIpath.InvokeDebugOpts()
53    import GSASIIdataGUI as G2gd   
54    G2gd.GSASIImain(application) # start the GUI
55    application.MainLoop()
Note: See TracBrowser for help on using the repository browser.