source: trunk/GSASII.py @ 4361

Last change on this file since 4361 was 4361, checked in by toby, 20 months ago

fix hist CIF export, remove dev. ver of IntPDFtool

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Date Author Revision URL Id
File size: 2.6 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3#GSASII
4########### SVN repository information ###################
5# $Date: 2020-03-11 21:43:45 +0000 (Wed, 11 Mar 2020) $
6# $Author: toby $
7# $Revision: 4361 $
8# $URL: trunk/GSASII.py $
9# $Id: GSASII.py 4361 2020-03-11 21:43: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 sys
27#import os
28import platform
29import wx
30import GSASIIpath
31GSASIIpath.SetVersionNumber("$Revision: 4361 $")
32
33__version__ = '1.0.0'
34
35class G2App(wx.App):
36    '''Used to create a wx python application for the GUI for Mac.
37    Customized to implement drop of GPX files onto app.
38    '''
39    startupMode = True
40    def ClearStartup(self):
41        '''Call this after app startup complete because a Drop event is posted
42        when GSAS-II is initially started.
43        '''
44        self.startupMode = False       
45    def MacOpenFiles(self, filenames):
46        if self.startupMode:
47            return
48        for project in filenames:
49            #print("Start GSAS-II with project file "+str(project))
50            GSASIIpath.MacStartGSASII(__file__,project)
51
52if __name__ == '__main__':
53    if sys.platform == "darwin": 
54        application = G2App(0) # create the GUI framework
55    else:
56        application = wx.App(0) # create the GUI framework
57    try:
58        GSASIIpath.SetBinaryPath(True)
59    except:
60        print('Unable to run with current setup, do you want to update to the')
61        try:
62            if '2' in platform.python_version_tuple()[0]:           
63                ans = raw_input("latest GSAS-II version? Update ([Yes]/no): ")
64            else:
65                ans = input("latest GSAS-II version? Update ([Yes]/no): ")               
66        except:
67            ans = 'no'
68        if ans.strip().lower() == "no":
69            import sys
70            print('Exiting')
71            sys.exit()
72        print('Updating...')
73        GSASIIpath.svnUpdateProcess()
74    import GSASIIdataGUI as G2gd   
75    G2gd.GSASIImain(application) # start the GUI
76    if sys.platform == "darwin": 
77        wx.CallLater(100,application.ClearStartup)
78    GSASIIpath.InvokeDebugOpts()
79    application.MainLoop()
Note: See TracBrowser for help on using the repository browser.