Ignore:
Timestamp:
Jul 4, 2017 9:37:13 AM (4 years ago)
Author:
toby
Message:

reorg for GUI separation pretty much complete (GSASIIIO.py still needs some thought)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branch/2frame/GSASII.py

    r2899 r2900  
    1818import os
    1919import sys
     20import GSASIIpath
     21GSASIIpath.SetVersionNumber("$Revision$")
     22GSASIIpath.InvokeDebugOpts()
    2023
    2124__version__ = '0.3.0'
    2225
    23 # PATCH: for Mavericks (OS X 10.9.x), wx produces an annoying warning about LucidaGrandeUI.
    24 # In case stderr has been suppressed there, redirect python error output to stdout. Nobody
    25 # else should care much about this.
    26 sys.stderr = sys.stdout
    2726
    28 #def create(parent):
    29 #    return GSASII(parent)
    30 
    31 # class GSASIIsplit(wx.SplitterWindow):
    32 #     def __init__(self,parent,ID):
    33 #         wx.SplitterWindow.__init__(self, parent, ID,style = wx.SP_BORDER|wx.SP_LIVE_UPDATE)
    34 #         self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnSashChanged)
    35 #         self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.OnSashChanging)
    36 
    37 #     def OnSashChanged(self, evt):
    38 #         evt.Skip()
    39 # #        print "sash changed to %s\n" % str(evt.GetSashPosition())
    40 
    41 #     def OnSashChanging(self, evt):
    42 #         evt.Skip()
    43 # #        print "sash changing to %s\n" % str(evt.GetSashPosition())
    44    
    4527if __name__ == '__main__':
    46     import numpy as np
    47     import scipy as sp
    48     import wx
    49     import wx.lib.scrolledpanel as wxscroll
    50     try:  # patch for LANG environment var problem on occasional OSX machines
    51         import locale
    52         locale.getdefaultlocale()
    53     except ValueError:
    54         print('Fixing location (see https://github.com/matplotlib/matplotlib/issues/5420.)')
    55         os.environ['LC_ALL'] = 'en_US.UTF-8'
    56         locale.getdefaultlocale()
    57     import matplotlib as mpl
    58     try:
    59         import OpenGL as ogl
    60     except ImportError:
    61         print('*******************************************************')
    62         print('PyOpenGL is missing from your python installation')
    63         print('     - we will try to install it')
    64         print('*******************************************************')
    65         def install_with_easyinstall(package):
    66             try:
    67                 print "trying a system-wide PyOpenGl install"
    68                 easy_install.main(['-f',os.path.split(__file__)[0],package])
    69                 return
    70             except:
    71                 pass
    72             try:
    73                 print "trying a user level PyOpenGl install"
    74                 easy_install.main(['-f',os.path.split(__file__)[0],'--user',package])
    75                 return
    76             except:
    77                 print "Install of '+package+' failed. Please report this information:"
    78                 import traceback
    79                 print traceback.format_exc()
    80                 sys.exit()
    81         from setuptools.command import easy_install
    82         install_with_easyinstall('PyOpenGl')
    83         print('*******************************************************')         
    84         print('OpenGL has been installed. Restarting GSAS-II')
    85         print('*******************************************************')         
    86         loc = os.path.dirname(__file__)
    87         import subprocess
    88         subprocess.Popen([sys.executable,os.path.join(loc,'GSASII.py')])
    89         sys.exit()
    90 
    91     # load the GSAS routines
    92     import GSASIIpath
    93     GSASIIpath.SetVersionNumber("$Revision$")
    94     import GSASIIIO as G2IO
    95     import GSASIIElem as G2elem
    96     import GSASIIgrid as G2gd
    97     import GSASIIctrls as G2G
    98     import GSASIIplot as G2plt
    99     import GSASIIpwd as G2pwd
    100     import GSASIIpwdGUI as G2pdG
    101     import GSASIIspc as G2spc
    102     import GSASIIstrMain as G2stMn
    103     import GSASIIstrIO as G2stIO
    104     import GSASIImath as G2mth
    105     import GSASIImapvars as G2mv
    106     import GSASIIobj as G2obj
    107     import GSASIIlattice as G2lat
    108     import GSASIIlog as log
    109 #                GSASIIpath.IPyBreak()
    110     # print versions
    111     print "Python module versions loaded:"
    112     print "  Python:     ",sys.version.split()[0]
    113     print "  wx:         ",wx.__version__
    114     print "  matplotlib: ",mpl.__version__
    115     print "  numpy:      ",np.__version__
    116     print "  scipy:      ",sp.__version__
    117     print "  OpenGL:     ",ogl.__version__
    118     try:
    119         from PIL import Image
    120         try:
    121             from PIL import PILLOW_VERSION
    122             version = PILLOW_VERSION
    123         except:
    124             version = Image.VERSION
    125         print "  PIL.Image:  ",version
    126     except ImportError:
    127         try:
    128             import Image
    129             print "Image (PIL):",Image.VERSION
    130         except ImportError:
    131             print "Image module not present; Note that PIL (Python Imaging Library) or pillow is needed for some image operations"
    132     import platform
    133     print "  Platform:   ",sys.platform,platform.architecture()[0],platform.machine()
    134     try:
    135         import mkl
    136         print "  Max threads:",mkl.get_max_threads()
    137     except:
    138         pass
    139     #print "wxPython description",wx.PlatformInfo
    140     print "This is GSAS-II revision "+str(GSASIIpath.GetVersionNumber())+'\n'
    141     GSASIIpath.InvokeDebugOpts()
     28    import GSASIIdataGUI as G2gd   
    14229    G2gd.GSASIImain() # start the GUI
Note: See TracChangeset for help on using the changeset viewer.