Changeset 4687


Ignore:
Timestamp:
Dec 30, 2020 11:44:57 AM (3 years ago)
Author:
toby
Message:

Add e key for excluded region creation; switch to hist in tree after m is pressed; macApp new arg; syntax corrections use of is where == needed

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/CifFile/CifFile.py

    r4123 r4687  
    291291        elif self.diclang == "DDLm":
    292292            self.scoping = 'dictionary'   #expose all save frames
    293             if do_imports is not 'No':
     293            if do_imports != 'No':
    294294               self.ddlm_import(import_mode=do_imports)#recursively calls this routine
    295295            self.create_alias_table()
  • trunk/GSASIIdataGUI.py

    r4685 r4687  
    86758675            G2plt.PlotSngl(G2frame,newPlot=True,Data=controls,hklRef=refList)
    86768676    G2frame.dataWindow.SetDataSize()
     8677    # make sure parent histogram item is displayed
     8678    if item != G2frame.GPXtree.GetSelection():
     8679        wx.CallAfter(G2frame.GPXtree.SelectItem,item)
    86778680                 
    86788681################################################################################
  • trunk/GSASIIfiles.py

    r4656 r4687  
    8585      (capitalization and additional letters ignored.)
    8686    '''
    87     if G2printLevel is 'none': return
     87    if G2printLevel == 'none': return
    8888    if kwargs.get('mode') is None:
    8989        testStr = str(args[0]).lower()
  • trunk/GSASIIpath.py

    r4645 r4687  
    248248                p = subprocess.Popen([exe_file,'help'],stdout=subprocess.PIPE)
    249249                res = p.stdout.read()
     250                if not res: return
    250251                p.communicate()
    251252                svnLocCache = os.path.abspath(exe_file)
     
    658659        for i in cmd: s += i + ' '
    659660        print(s)
    660         if svnCleanup(fpath):
     661        if svnCleanup(loadpath):
    661662            s = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
    662663            out,err = MakeByte2str(s.communicate())
     
    12521253    time.sleep(1) # delay to give the main process a chance to exit
    12531254    # perform an update and restart GSAS-II
    1254     project,version = sys.argv[1:3]
     1255    try:
     1256        project,version = sys.argv[1:3]
     1257    except ValueError:
     1258        project = None
     1259        version = 'trunk'
    12551260    loc = os.path.dirname(__file__)
    12561261    if version == 'trunk':
  • trunk/GSASIIplot.py

    r4671 r4687  
    18741874                Page.plotStyle['qPlot'] = False
    18751875                Page.plotStyle['dPlot'] = False
     1876        elif (event.key == 'e' and 'PWDR' in plottype and G2frame.SinglePlot and ifLimits
     1877                  and not G2frame.Contour):
     1878            Page.excludeMode = not Page.excludeMode
     1879            if Page.excludeMode:
     1880                try: # fails from key menu
     1881                    Page.startExclReg = event.xdata
     1882                except AttributeError:
     1883                    G2G.G2MessageBox(G2frame,'To create an excluded region, after clicking on "OK", move to the beginning of the region and press the "e" key. Then move to the end of the region and press "e" again','How to exclude')
     1884                    return
     1885                Plot.axvline(Page.startExclReg,color='b',dashes=(2,3))
     1886                Page.canvas.draw()
     1887                Page.savedplot = Page.canvas.copy_from_bbox(Page.figure.gca().bbox)
     1888                y1, y2= Page.figure.axes[0].get_ylim()
     1889                Page.vLine = Plot.axvline(Page.startExclReg,color='b',
     1890                                               dashes=(2,3))
     1891                Page.canvas.draw()
     1892            else:
     1893                Page.savedplot = None
     1894                wx.CallAfter(PlotPatterns,G2frame,newPlot=False,
     1895                                 plotType=plottype,extraKeys=extraKeys)
     1896                if abs(Page.startExclReg - event.xdata) < 0.1: return
     1897                LimitId = G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Limits')
     1898                data = G2frame.GPXtree.GetItemPyData(LimitId)
     1899                mn = min(Page.startExclReg, event.xdata)
     1900                mx = max(Page.startExclReg, event.xdata)
     1901                data.append([mn,mx])
     1902                G2pdG.UpdateLimitsGrid(G2frame,data,plottype)
     1903            return
    18761904        elif event.key == 'a' and 'PWDR' in plottype and G2frame.SinglePlot and not (
    18771905                 Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour):
     
    19571985       
    19581986    def OnMotion(event):
    1959         'Update the status line with infor based on the mouse position'       
     1987        'Update the status line with info based on the mouse position'
    19601988        SetCursor(Page)
     1989        # excluded region animation
     1990        if Page.excludeMode and Page.savedplot:
     1991            if event.xdata is None or G2frame.GPXtree.GetItemText(
     1992                    G2frame.GPXtree.GetSelection()) != 'Limits': # reset if out of bounds or not on limits
     1993                Page.savedplot = None
     1994                Page.excludeMode = False
     1995                wx.CallAfter(PlotPatterns,G2frame,newPlot=False,
     1996                                 plotType=plottype,extraKeys=extraKeys)
     1997                return
     1998            else:
     1999                Page.canvas.restore_region(Page.savedplot)
     2000                Page.vLine.set_xdata([event.xdata,event.xdata])
     2001                Page.figure.gca().draw_artist(Page.vLine)
     2002                Page.canvas.blit(Page.figure.gca().bbox)
     2003                return
     2004        elif Page.excludeMode or Page.savedplot: # reset if out of mode somehow
     2005            Page.savedplot = None           
     2006            Page.excludeMode = False
     2007            wx.CallAfter(PlotPatterns,G2frame,newPlot=False,
     2008                                 plotType=plottype,extraKeys=extraKeys)
     2009            return
    19612010        if event.button and G2frame.Contour and G2frame.TforYaxis:
    19622011            ytics = imgAx.get_yticks()
     
    22182267                LimitId = G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Limits')
    22192268                data = G2frame.GPXtree.GetItemPyData(LimitId)
     2269                # likely that these conversions are not needed, Q & d not allowed on limits (BHT)
    22202270                if Page.plotStyle['qPlot']:                              #qplot - convert back to 2-theta
    22212271                    xy[0] = G2lat.Dsp2pos(Parms,2*np.pi/xy[0])
     
    26752725    global Pattern,mcolors,Plot,Page,imgAx,Temps
    26762726    plottype = plotType
    2677    
     2727
    26782728    if not G2frame.PatternId:
    26792729        return
     
    26882738        publish = None
    26892739    new,plotNum,Page,Plot,limits = G2frame.G2plotNB.FindPlotTab('Powder Patterns','mpl',publish=publish)
     2740    Page.excludeMode = False  # True when defining an excluded region
     2741    Page.savedplot = None
    26902742#patch
    26912743    if 'Offset' not in Page.plotStyle and plotType in ['PWDR','SASD','REFD']:     #plot offset data
     
    28252877                Page.Choice += ['o: add obs, calc,... to legend',]
    28262878            if ifLimits:
    2827                 Page.Choice += ['s: toggle sqrt plot','w: toggle (Io-Ic)/sig plot',
    2828                     '+: no selection']
     2879                Page.Choice += ['e: create excluded region',
     2880                        's: toggle sqrt plot','w: toggle (Io-Ic)/sig plot',
     2881                        '+: no selection']
    28292882            else:
    28302883                Page.Choice += ['q: toggle q plot','s: toggle sqrt plot',
     
    70667119                artist = Circle(spot[:2],radius=spot[2]/2,fc='none',ec='r',
    70677120                                picker=True)
    7068                 GSASIIpath.IPyBreak()
     7121                #GSASIIpath.IPyBreak()
    70697122                Page.figure.gca().add_artist(artist)
    70707123                artist.itemNumber = len(Masks['Points'])-1
  • trunk/makeMacApp.py

    r3997 r4687  
    55
    66This script creates an AppleScript app bundle to launch GSAS-II. The app is
    7 created in the directory where the GSAS-II script (GSASII.py) is located.
    8 A softlink to Python is created, but is named GSAS-II, and placed inside
    9 the bundle so that GSAS-II shows up as the name of the app rather than
    10 Python in the menu bar, etc. A soft link named GSAS-II.py, referencing
    11 GSASII.py, is created so that appropriate menu items also are labeled with
    12 GSAS-II (but not the right capitalization, alas).
     7created in the directory where the GSAS-II script (.../GSASII/GSASII.py)
     8is located. A softlink to Python is created inside that app bundle,
     9but the softlink name is GSAS-II so that GSAS-II shows up as the name
     10of the app rather than  Python in the menu bar, etc. A soft link named
     11GSAS-II.py, referencing the GSASII.py script, is created so that some file
     12menu items also are labeled with GSAS-II (but not the right capitalization,
     13alas).
    1314
    1415This has been tested with several versions of Python interpreters
     
    1718it searches for a pythonw image and tries that.
    1819
    19 Run this script with no arguments or with one optional argument,
    20 a reference to the GSASII.py, with a relative or absolute path. Either way
    21 the path will be converted via an absolute path. If no arguments are
    22 supplied, the GSASII.py script must be located in the same directory as
    23 this file.
    24 
    25 '''
     20Run this script with no arguments or with one or two arguments.
     21The first argument, if supplied, is a reference to the GSASII.py script,
     22which can have a relative or absolute path (the absolute path is determined).
     23If not supplied, the GSASII.py script will be used from the directory where
     24this (makeMacApp.py) script is found. The second argument, if supplied,
     25provides the name for the app to be created. This can be used to create
     26multiple copies of the app using different Python versions (likely use for
     27development only).
     28'''
     29
    2630from __future__ import division, print_function
    2731import sys, os, os.path, stat, shutil, subprocess, plistlib
    2832def Usage():
    29     print("\n\tUsage: python "+sys.argv[0]+" [<GSAS-II script>]\n")
     33    print("\n\tUsage: python "+sys.argv[0]+" [<GSAS-II script>] [project]\n")
    3034    sys.exit()
    3135
     
    5761                ))
    5862    elif len(sys.argv) == 2:
    59             script = os.path.abspath(sys.argv[1])
     63        script = os.path.abspath(sys.argv[1])
     64    elif len(sys.argv) == 3:
     65        script = os.path.abspath(sys.argv[1])
     66        project = sys.argv[2]
    6067    else:
    6168        Usage()
     
    139146'''
    140147    # create a link named GSAS-II.py to the script
    141     newScript = os.path.join(scriptdir,project+'.py')
     148    newScript = os.path.join(scriptdir,'GSAS-II.py')
    142149    if os.path.exists(newScript): # cleanup
    143150        print("\nRemoving sym link",newScript)
Note: See TracChangeset for help on using the changeset viewer.