Changeset 1109


Ignore:
Timestamp:
Oct 15, 2013 5:08:50 PM (8 years ago)
Author:
toby
Message:

minor doc updates, no rebuild

Location:
trunk
Files:
3 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/gltext.py

    r1077 r1109  
     1'''
     2*gltext: draw OpenGL text*
     3==========================
     4
     5Routines that render text on OpenGL without use of GLUT.
     6
     7Code written by Christian Brugger & Stefan Hacker and
     8distributed under GNU General Public License.
     9'''
     10
    111#!/usr/bin/env python
    212# -*- coding: utf-8
  • trunk/makeMacApp.py

    r1077 r1109  
    11#!/usr/bin/env python
    2 '''This script creates an AppleScript app to launch GSAS-II. The app is
     2'''
     3*makeMacApp: Create Mac Applet*
     4===============================
     5
     6This script creates an AppleScript app to launch GSAS-II. The app is
    37created in the directory where the GSAS-II script is located.
    48A softlink to Python is created, but is named GSAS-II, so that
     
    2226project="GSAS-II"
    2327
    24 # find the main GSAS-II script if not on command line
    25 if len(sys.argv) == 1:
    26     script = os.path.abspath(os.path.join(
    27         os.path.split(__file__)[0],
    28         "GSASII.py"
    29         ))
    30 elif len(sys.argv) == 2:
    31     script = os.path.abspath(sys.argv[1])
    32 else:
    33     Usage()
     28if __name__ == '__main__':
     29    # find the main GSAS-II script if not on command line
     30    if len(sys.argv) == 1:
     31        script = os.path.abspath(os.path.join(
     32            os.path.split(__file__)[0],
     33            "GSASII.py"
     34            ))
     35    elif len(sys.argv) == 2:
     36        script = os.path.abspath(sys.argv[1])
     37    else:
     38        Usage()
    3439
    35 # make sure we found it
    36 if not os.path.exists(script):
    37     print("\nFile "+script+" not found")
    38     Usage()
    39 if os.path.splitext(script)[1].lower() != '.py':
    40     print("\nScript "+script+" does not have extension .py")
    41     Usage()
    42 # where the app will be created
    43 scriptdir = os.path.split(script)[0]
    44 # name of app
    45 apppath = os.path.abspath(os.path.join(scriptdir,project+".app"))
    46 iconfile = os.path.join(scriptdir,'gsas2.icns') # optional icon file
     40    # make sure we found it
     41    if not os.path.exists(script):
     42        print("\nFile "+script+" not found")
     43        Usage()
     44    if os.path.splitext(script)[1].lower() != '.py':
     45        print("\nScript "+script+" does not have extension .py")
     46        Usage()
     47    # where the app will be created
     48    scriptdir = os.path.split(script)[0]
     49    # name of app
     50    apppath = os.path.abspath(os.path.join(scriptdir,project+".app"))
     51    iconfile = os.path.join(scriptdir,'gsas2.icns') # optional icon file
    4752
    48 # find the python application; must be an OS X app
    49 pythonpath,top = os.path.split(os.path.realpath(sys.executable))
    50 while top:
    51     if 'Resources' in pythonpath:
    52         pass
    53     elif os.path.exists(os.path.join(pythonpath,'Resources')):
    54         break
    55     pythonpath,top = os.path.split(pythonpath)
    56 else:
    57     print("\nSorry, failed to find a Resources directory associated with "+str(sys.executable))
    58     sys.exit()
    59 pythonapp = os.path.join(pythonpath,'Resources','Python.app','Contents','MacOS','Python')
    60 if not os.path.exists(pythonapp):
    61     print("\nSorry, failed to find a Python app in "+str(pythonapp))
    62     sys.exit()
     53    # find the python application; must be an OS X app
     54    pythonpath,top = os.path.split(os.path.realpath(sys.executable))
     55    while top:
     56        if 'Resources' in pythonpath:
     57            pass
     58        elif os.path.exists(os.path.join(pythonpath,'Resources')):
     59            break
     60        pythonpath,top = os.path.split(pythonpath)
     61    else:
     62        print("\nSorry, failed to find a Resources directory associated with "+str(sys.executable))
     63        sys.exit()
     64    pythonapp = os.path.join(pythonpath,'Resources','Python.app','Contents','MacOS','Python')
     65    if not os.path.exists(pythonapp):
     66        print("\nSorry, failed to find a Python app in "+str(pythonapp))
     67        sys.exit()
    6368
    64 # new name to call python
    65 newpython =  os.path.join(apppath,"Contents","MacOS",project)
     69    # new name to call python
     70    newpython =  os.path.join(apppath,"Contents","MacOS",project)
    6671
    67 if os.path.exists(apppath): # cleanup
    68     print("\nRemoving old "+project+" app ("+str(apppath)+")")
    69     shutil.rmtree(apppath)
     72    if os.path.exists(apppath): # cleanup
     73        print("\nRemoving old "+project+" app ("+str(apppath)+")")
     74        shutil.rmtree(apppath)
    7075
    71 # create an AppleScript that launches python with the requested app
    72 shell = os.path.join("/tmp/","appscrpt.script")
    73 f = open(shell, "w")
    74 f.write('''(*   GSAS-II AppleScript by B. Toby (brian.toby@anl.gov)
     76    # create an AppleScript that launches python with the requested app
     77    AppleScript = '''(*   GSAS-II AppleScript by B. Toby (brian.toby@anl.gov)
    7578     It can launch GSAS-II by double clicking or by dropping a data file
    7679     or folder over the app.
     
    132135        end repeat
    133136end open
    134 '''.format(newpython,script,newpython,script))
    135 f.close()
     137'''
     138    shell = os.path.join("/tmp/","appscrpt.script")
     139    f = open(shell, "w")
     140    f.write(AppleScript.format(newpython,script,newpython,script))
     141    f.close()
    136142
    137 try:
    138     subprocess.check_output(["osacompile","-o",apppath,shell],stderr=subprocess.STDOUT)
    139 except subprocess.CalledProcessError, msg:
    140     print '''Error compiling AppleScript.
    141     Report the next message along with details about your Mac to toby@anl.gov'''
    142     print msg.output
    143     sys.exit()
     143    try:
     144        subprocess.check_output(["osacompile","-o",apppath,shell],stderr=subprocess.STDOUT)
     145    except subprocess.CalledProcessError, msg:
     146        print '''Error compiling AppleScript.
     147        Report the next message along with details about your Mac to toby@anl.gov'''
     148        print msg.output
     149        sys.exit()
    144150
    145 # create a link to the python app, but named to match the project
    146 os.symlink(pythonapp,newpython)
     151    # create a link to the python app, but named to match the project
     152    os.symlink(pythonapp,newpython)
    147153
    148 # change the icon
    149 oldicon = os.path.join(apppath,"Contents","Resources","droplet.icns")
    150 if os.path.exists(iconfile) and os.path.exists(oldicon):
    151     shutil.copyfile(iconfile,oldicon)
     154    # change the icon
     155    oldicon = os.path.join(apppath,"Contents","Resources","droplet.icns")
     156    if os.path.exists(iconfile) and os.path.exists(oldicon):
     157        shutil.copyfile(iconfile,oldicon)
    152158
    153 # Edit the app plist file to restrict the type of files that can be dropped
    154 d = plistlib.readPlist(os.path.join(apppath,"Contents",'Info.plist'))
    155 d['CFBundleDocumentTypes'] = [{
    156     'CFBundleTypeExtensions': ['gpx'],
    157     'CFBundleTypeName': 'GSAS-II project',
    158     'CFBundleTypeRole': 'Editor'}]
    159 plistlib.writePlist(d,os.path.join(apppath,"Contents",'Info.plist'))
     159    # Edit the app plist file to restrict the type of files that can be dropped
     160    d = plistlib.readPlist(os.path.join(apppath,"Contents",'Info.plist'))
     161    d['CFBundleDocumentTypes'] = [{
     162        'CFBundleTypeExtensions': ['gpx'],
     163        'CFBundleTypeName': 'GSAS-II project',
     164        'CFBundleTypeRole': 'Editor'}]
     165    plistlib.writePlist(d,os.path.join(apppath,"Contents",'Info.plist'))
    160166
    161 print("\nCreated "+project+" app ("+str(apppath)+
    162       ").\nViewing app in Finder so you can drag it to the dock if, you wish.")
    163 subprocess.call(["open","-R",apppath])
     167    print("\nCreated "+project+" app ("+str(apppath)+
     168          ").\nViewing app in Finder so you can drag it to the dock if, you wish.")
     169    subprocess.call(["open","-R",apppath])
  • trunk/sphinxdocs/Makefile

    r907 r1109  
    4141clean:
    4242        #-rm -rf $(BUILDDIR)/*
    43         rm $(BUILDDIR)/doctrees/* $(BUILDDIR)/html/*.html $(BUILDDIR)/html/*/*.html
     43        rm $(BUILDDIR)/doctrees/* $(BUILDDIR)/html/*.html $(BUILDDIR)/html/*.js $(BUILDDIR)/html/*/*.html
    4444
    4545html:
  • trunk/sphinxdocs/find_undoc.py

    r939 r1109  
    1111                     
    1212# loop over python files in subversion
    13 #for fil in glob.iglob(os.path.join(loc,'..','GSAS*.py')):
    1413proc = sp.Popen(["svn","list",os.path.join(loc,'..')],stdout=sp.PIPE)
     14undoc = []
    1515for fil in proc.stdout.readlines():
     16    fil = fil.strip()
     17    print fil+'...',
    1618    if os.path.splitext(fil.strip())[1] != ".py": continue
    1719    if os.path.splitext(os.path.split(fil)[1])[0] in documented:
    18         #print 'doc'
     20        print 'doc'
    1921        continue
    2022    else:
    21         print ".. automodule:: "+os.path.splitext(os.path.split(fil)[1])[0]
    22         print "    :members: "
    23         print ""
     23        print '\n'+fil+' undocumented'
     24        undoc.append(fil)
     25for fil in undoc:
     26    print ".. automodule:: "+os.path.splitext(os.path.split(fil)[1])[0]
     27    print "    :members: "
     28    print ""
  • trunk/sphinxdocs/source/GSASIIutil.rst

    r939 r1109  
    2626    :members:
    2727
     28.. automodule:: gltext
     29    :members:
     30
     31.. automodule:: makeMacApp
     32    :members:
     33
    2834.. automodule:: unit_tests
    2935    :members:
  • trunk/sphinxdocs/source/index.rst

    r946 r1109  
    1 .. Manually coded file based on a sphinx-quickstart example
    2    You can adapt this file completely to your liking, but it should at least
    3    contain the root `toctree` directive.
     1.. This lists all the sections of the documentation. Some of the below
     2.. reference a single file. Others reference multiple files.
    43
    54GSAS-II Developer's Documentation
     
    2019  GSASIIplot.rst
    2120  GSASIIpwd.rst
    22   GSASIIsolve.rst
    2321
    2422Note that this program requires the Python wxPython, NumPy, SciPy,
Note: See TracChangeset for help on using the changeset viewer.