Changeset 3927


Ignore:
Timestamp:
Apr 23, 2019 3:26:36 PM (2 years ago)
Author:
vondreele
Message:

modified makeBat to check about old .gpx registry entries
add options for rotating the selected view axis down onto plane; currently hidden from users

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r3911 r3927  
    62946294                    A = acosd(max((2.-np.sum((VB-VC)**2))/2.,-1.))
    62956295                    QV = G2mth.AVdeg2Q(A,VX)
     6296                    if len(viewDir) > 3:
     6297                        Model = drawingData['modelView'][:3,:3]
     6298                        invModel = nl.inv(Model)
     6299                        rt2 = np.sqrt(2.)/2.
     6300                        VX0 = np.array([-1.,0.,0.])
     6301                        VY0 = np.array([0.,-1.,0.])
     6302                        if 'H' == viewDir[3].upper():
     6303                            QV = G2mth.prodQQ(np.array([0.,rt2,0.,rt2]),QV)
     6304                            VD = np.inner(invModel.T,VX0)
     6305                        elif 'V' == viewDir[3].upper():
     6306                            QV = G2mth.prodQQ(np.array([rt2,0.,0.,-rt2]),QV)
     6307                            VD = np.inner(invModel.T,VY0)
     6308                        VD /= np.sqrt(np.sum(VD**2))
    62966309                    Q = drawingData['Quaternion']
    62976310                    drawingData['Quaternion'] = G2mth.prodQQ(Q,QV)
  • trunk/makeBat.py

    r3913 r3927  
    2020import os, sys
    2121import datetime
     22import wx
    2223try:
    2324    import _winreg as winreg
     
    4748
    4849if __name__ == '__main__':
     50    app = wx.App()
     51    app.MainLoop()
    4952    gsaspath = os.path.split(sys.argv[0])[0]
    5053    if not gsaspath: gsaspath = os.path.curdir
     
    8386    fp.close()
    8487    print('\nCreated GSAS-II batch file RunGSASII.bat in '+gsaspath)
    85 
    86     # Associate a script and icon with .gpx files
    87     #gpxkey = winreg.CreateKey(winreg.HKEY_CLASSES_ROOT, '.gpx')
    88     gpxkey = winreg.CreateKey(winreg.HKEY_CURRENT_USER,r'Software\CLASSES\.gpx')
    89     winreg.SetValue(gpxkey, None, winreg.REG_SZ, 'GSAS-II.project')
    90     winreg.CloseKey(gpxkey)
    91     gpxkey = winreg.CreateKey(winreg.HKEY_CURRENT_USER,r'Software\CLASSES\GSAS-II.project')
    92     winreg.SetValue(gpxkey, None, winreg.REG_SZ, 'GSAS-II project')
    93     iconkey = winreg.CreateKey(gpxkey, 'DefaultIcon')
    94     winreg.SetValue(iconkey, None, winreg.REG_SZ, G2icon)
    95     openkey = winreg.CreateKey(gpxkey, r'shell\open\command')
    96     winreg.SetValue(openkey, None, winreg.REG_SZ, G2bat+' "%1"')
    97     winreg.CloseKey(iconkey)
    98     winreg.CloseKey(openkey)
    99     winreg.CloseKey(gpxkey)
    100     print('Assigned icon and batch file to .gpx files')
     88   
     89    new = False
     90    try:
     91        oldgpx = winreg.OpenKey(winreg.HKEY_CURRENT_USER,r'Software\CLASSES\GSAS-II.project')
     92        oldopen = winreg.OpenKey(oldgpx,r'shell\open\command')
     93    except FileNotFoundError:
     94        new = True
     95    if not new:
     96        try:
     97            oldBat = winreg.QueryValue(oldopen,None).split()[0]
     98            if oldBat != G2bat:
     99                dlg = wx.MessageDialog(None,'gpx files already assigned to: \n'+oldBat+'\n Replace with: '+G2bat+'?','GSAS-II gpx in use',
     100                        wx.YES_NO | wx.ICON_QUESTION)
     101                if dlg.ShowModal() == wx.ID_YES:
     102                    new = True
     103                dlg.Destroy()
     104        finally:
     105            pass
     106    if new:
     107        # Associate a script and icon with .gpx files
     108        #gpxkey = winreg.CreateKey(winreg.HKEY_CLASSES_ROOT, '.gpx')
     109        gpxkey = winreg.CreateKey(winreg.HKEY_CURRENT_USER,r'Software\CLASSES\.gpx')
     110        winreg.SetValue(gpxkey, None, winreg.REG_SZ, 'GSAS-II.project')
     111        winreg.CloseKey(gpxkey)
     112        gpxkey = winreg.CreateKey(winreg.HKEY_CURRENT_USER,r'Software\CLASSES\GSAS-II.project')
     113        winreg.SetValue(gpxkey, None, winreg.REG_SZ, 'GSAS-II project')
     114        iconkey = winreg.CreateKey(gpxkey, 'DefaultIcon')
     115        winreg.SetValue(iconkey, None, winreg.REG_SZ, G2icon)
     116        openkey = winreg.CreateKey(gpxkey, r'shell\open\command')
     117        winreg.SetValue(openkey, None, winreg.REG_SZ, G2bat+' "%1"')
     118        winreg.CloseKey(iconkey)
     119        winreg.CloseKey(openkey)
     120        winreg.CloseKey(gpxkey)
     121        print('Assigned icon and batch file to .gpx files')
     122    else:
     123        print('old assignment of icon and batch file is retained')
    101124
    102125    try:
Note: See TracChangeset for help on using the changeset viewer.