Changeset 3929
- Timestamp:
- Apr 24, 2019 9:18:45 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/makeBat.py
r3927 r3929 97 97 oldBat = winreg.QueryValue(oldopen,None).split()[0] 98 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',99 dlg = wx.MessageDialog(None,'gpx files already assigned in registry to: \n'+oldBat+'\n Replace with: '+G2bat+'?','GSAS-II gpx in use', 100 100 wx.YES_NO | wx.ICON_QUESTION) 101 101 if dlg.ShowModal() == wx.ID_YES: … … 106 106 if new: 107 107 # Associate a script and icon with .gpx files 108 #gpxkey = winreg.CreateKey(winreg.HKEY_CLASSES_ROOT, '.gpx')109 108 gpxkey = winreg.CreateKey(winreg.HKEY_CURRENT_USER,r'Software\CLASSES\.gpx') 110 109 winreg.SetValue(gpxkey, None, winreg.REG_SZ, 'GSAS-II.project') … … 119 118 winreg.CloseKey(openkey) 120 119 winreg.CloseKey(gpxkey) 121 print('Assigned icon and batch file to .gpx files ')120 print('Assigned icon and batch file to .gpx files in registery') 122 121 else: 123 print('old assignment of icon and batch file i s retained')122 print('old assignment of icon and batch file in registery is retained') 124 123 125 124 try: … … 139 138 desktop = win32com.shell.shell.SHGetFolderPath( 140 139 0, win32com.shell.shellcon.CSIDL_DESKTOP, None, 0) 141 shortcut = os.path.join(desktop, "GSAS-II.lnk") 142 shell = win32com.client.Dispatch('WScript.Shell') 143 shobj = shell.CreateShortCut(shortcut) 144 shobj.Targetpath = G2bat 145 #shobj.WorkingDirectory = wDir # could specify a default project location here 146 shobj.IconLocation = G2icon 147 shobj.save() 148 print('Created shortcut to start GSAS-II on desktop') 140 shortbase = "GSAS-II.lnk" 141 shortcut = os.path.join(desktop, shortbase) 142 save = True 143 if win32com.shell.shell.SHGetFileInfo(shortcut,0,0)[0]: 144 print('GSAS-II shortcut exists!') 145 dlg = wx.FileDialog(None, 'Choose new GSAS-II shortcut name', desktop, shortbase, 146 wildcard='GSAS-II shortcut (*.lnk)|*.lnk',style=wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) 147 try: 148 if dlg.ShowModal() == wx.ID_OK: 149 shortcut = dlg.GetPath() 150 else: 151 save = False 152 finally: 153 dlg.Destroy() 154 if save: 155 shell = win32com.client.Dispatch('WScript.Shell') 156 shobj = shell.CreateShortCut(shortcut) 157 shobj.Targetpath = G2bat 158 #shobj.WorkingDirectory = wDir # could specify a default project location here 159 shobj.IconLocation = G2icon 160 shobj.save() 161 print('Created shortcut to start GSAS-II on desktop') 162 else: 163 print('No shortcut for this GSAS-II created on desktop') 149 164 except ImportError: 150 165 print('Module pywin32 not present, will not make desktop shortcut')
Note: See TracChangeset
for help on using the changeset viewer.