source: trunk/GSASII.py @ 4800

Last change on this file since 4800 was 4800, checked in by toby, 10 months ago

finish up docs cleanups

  • 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.7 KB
RevLine 
[762]1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3#GSASII
4########### SVN repository information ###################
5# $Date: 2021-02-03 17:50:38 +0000 (Wed, 03 Feb 2021) $
6# $Author: toby $
7# $Revision: 4800 $
8# $URL: trunk/GSASII.py $
9# $Id: GSASII.py 4800 2021-02-03 17:50:38Z toby $
10########### SVN repository information ###################
[903]11'''
[4800]12*GSASII: GSAS-II GUI*
[903]13=====================
[762]14
[4800]15File GSASII.py is the script to start the GSAS-II graphical user
16interface (GUI).
[4148]17This script imports GSASIIpath, which does some minor initialization
18and then (before any wxPython calls can be made) creates a wx.App application.
19A this point :func:`GSASIIpath.SetBinaryPath` is called to establish
20the directory where GSAS-II binaries are found. If the binaries
21are not installed or are incompatible with the OS/Python packages,
22the user is asked if they should be updated from the subversion site.
23The wxPython app is then passed to :func:`GSASIIdataGUI.GSASIImain`,
24which creates the GSAS-II GUI and finally the event loop is started.
[903]25'''
26
[4154]27import sys
[4349]28#import os
[3674]29import platform
[4148]30import wx
[762]31import GSASIIpath
[4148]32GSASIIpath.SetVersionNumber("$Revision: 4800 $")
[762]33
[3000]34__version__ = '1.0.0'
[762]35
[4154]36class G2App(wx.App):
37    '''Used to create a wx python application for the GUI for Mac.
38    Customized to implement drop of GPX files onto app.
39    '''
40    startupMode = True
41    def ClearStartup(self):
42        '''Call this after app startup complete because a Drop event is posted
43        when GSAS-II is initially started.
44        '''
45        self.startupMode = False       
46    def MacOpenFiles(self, filenames):
47        if self.startupMode:
48            return
49        for project in filenames:
50            #print("Start GSAS-II with project file "+str(project))
51            GSASIIpath.MacStartGSASII(__file__,project)
52
[762]53if __name__ == '__main__':
[4154]54    if sys.platform == "darwin": 
55        application = G2App(0) # create the GUI framework
56    else:
57        application = wx.App(0) # create the GUI framework
[3123]58    try:
[3420]59        GSASIIpath.SetBinaryPath(True)
[3123]60    except:
61        print('Unable to run with current setup, do you want to update to the')
62        try:
[3674]63            if '2' in platform.python_version_tuple()[0]:           
64                ans = raw_input("latest GSAS-II version? Update ([Yes]/no): ")
65            else:
66                ans = input("latest GSAS-II version? Update ([Yes]/no): ")               
[3123]67        except:
68            ans = 'no'
69        if ans.strip().lower() == "no":
70            import sys
71            print('Exiting')
72            sys.exit()
73        print('Updating...')
74        GSASIIpath.svnUpdateProcess()
[3000]75    import GSASIIdataGUI as G2gd   
[4148]76    G2gd.GSASIImain(application) # start the GUI
[4154]77    if sys.platform == "darwin": 
78        wx.CallLater(100,application.ClearStartup)
[4361]79    GSASIIpath.InvokeDebugOpts()
[4148]80    application.MainLoop()
Note: See TracBrowser for help on using the repository browser.