This repository was archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGSASII.py
executable file
·101 lines (97 loc) · 3.73 KB
/
GSASII.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#GSASII
########### SVN repository information ###################
# $Date: 2024-03-04 13:37:23 -0600 (Mon, 04 Mar 2024) $
# $Author: toby $
# $Revision: 5750 $
# $URL: https://subversion.xray.aps.anl.gov/pyGSAS/trunk/GSASII.py $
# $Id: GSASII.py 5750 2024-03-04 19:37:23Z toby $
########### SVN repository information ###################
'''
A single class, :class:`G2App`, is defined here to create
an wxPython application. This is only used on
MacOS. For other platforms ``wx.App()`` is called directly.
'''
import sys
#import os
import platform
import scipy.optimize # addresses problem with build for wx on Pi
try:
import wx
# the next line removes the need for pythonw. Thanks to Matt Newville!
# appears unneaded from wx 4.2.1 on
if sys.platform.lower() == 'darwin': wx.PyApp.IsDisplayAvailable = lambda _: True
# importing the following wx modules at the same time as wx seems to eliminate
# the "Debug: Adding duplicate image handler for 'Windows bitmap file'"
# error message
import wx.grid as wg
import wx.aui
import wx.lib.scrolledpanel as wxscroll
import wx.html # could postpone this for quicker startup
import wx.lib.mixins.listctrl as listmix
import wx.richtext as wxrt
import wx.lib.filebrowsebutton as wxfilebrowse
except ImportError:
pass
import GSASIIpath
GSASIIpath.SetVersionNumber("$Revision: 5750 $")
__version__ = '1.0.0'
class G2App(wx.App):
'''Used to create a wx python application for the GUI for Mac.
Customized to implement drop of GPX files onto app.
'''
startupMode = True
def ClearStartup(self):
'''Call this after app startup complete because a Drop event is posted
when GSAS-II is initially started.
'''
self.startupMode = False
def MacOpenFiles(self, filenames):
if self.startupMode:
return
import GSASIIctrlGUI as G2G
for project in filenames:
#print("Start GSAS-II with project file "+str(project))
#GSASIIpath.MacStartGSASII(__file__,project)
G2G.openInNewTerm(project)
if __name__ == '__main__':
if sys.platform == "darwin":
application = G2App(0) # create the GUI framework
else:
application = wx.App(0) # create the GUI framework
try:
GSASIIpath.SetBinaryPath(True)
except:
print('Unable to run with current installation, please reset or reinstall')
# if GSASIIpath.HowIsG2Installed().startswith('git'):
# print('use this command w/gitstrap')
# elif GSASIIpath.HowIsG2Installed().startswith('svn'):
# print('use this command w/bootstrap')
sys.exit()
# print('Unable to run with current setup, do you want to update to the')
# try:
# if '2' in platform.python_version_tuple()[0]:
# ans = raw_input("latest GSAS-II version? Update ([Yes]/no): ")
# else:
# ans = input("latest GSAS-II version? Update ([Yes]/no): ")
# except:
# ans = 'no'
# if ans.strip().lower() == "no":
# import sys
# print('Exiting')
# sys.exit()
# print('Updating...')
# import GSASIIctrlGUI as G2G
#GSASIIpath.svnUpdateProcess()
# if GSASIIpath.HowIsG2Installed().startswith('git'):
# gitCheckUpdates(None)
# elif GSASIIpath.HowIsG2Installed().startswith('svn'):
# svnCheckUpdates(None)
# else:
import GSASIIdataGUI as G2gd
G2gd.GSASIImain(application) # start the GUI
if sys.platform == "darwin":
wx.CallLater(100,application.ClearStartup)
GSASIIpath.InvokeDebugOpts()
application.MainLoop()