Changeset 4918
- Timestamp:
- Jun 2, 2021 8:49:00 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIIO.py
r4892 r4918 801 801 print('Warning: unable to delete {}'.format(GPXhist)) 802 802 G2frame.SetTitleByGPX() 803 if LastSavedUsing: 804 try: 805 G2G.updateNotifier(G2frame,int(LastSavedUsing)) 806 except: 807 pass 803 808 804 809 def ProjFileSave(G2frame): -
trunk/GSASIIctrlGUI.py
r4914 r4918 5405 5405 self.dlg.Destroy() 5406 5406 ################################################################################ 5407 updateNoticeDict = {} # example: {1234:True, 5000:False} 5408 '''A dict with versions that should be noted. The value associated with the 5409 tag is if all older projects should show the warning, or only the first 5410 to be opened. Version info is found in file versioninfo.txt. 5411 ''' 5412 def updateNotifier(G2frame,fileVersion): 5413 '''Posts an update notice when a a specially tagged GSAS-II version 5414 is seen for the first time. Versions to be tagged are set in global 5415 updateNoticeDict; version info is found in file versioninfo.txt. 5416 5417 :param wx.Frame G2frame: GSAS-II main window 5418 :param int fileVersion: version of GSAS-II used to create the current 5419 .gpx file 5420 ''' 5421 def tblLine(): 5422 txtbox = wx.StaticText(dlg,wx.ID_ANY,'',size=(-1,3)) 5423 txtbox.SetBackgroundColour(wx.Colour(0,0,0)) 5424 tblSizer.Add(txtbox,0,wx.EXPAND) 5425 txtbox = wx.StaticText(dlg,wx.ID_ANY,'',size=(-1,3)) 5426 txtbox.SetBackgroundColour(wx.Colour(0,0,0)) 5427 tblSizer.Add(txtbox,0,wx.EXPAND) 5428 5429 rev = GSASIIpath.svnGetRev() 5430 if rev is None: rev = GSASIIpath.GetVersionNumber() 5431 if rev is None: return 5432 lastNotice = max(GSASIIpath.GetConfigValue('lastUpdateNotice',0),fileVersion) 5433 show = None # first version number to show 5434 allProjects = False # if True notice is shown for all projects, otherwise only once 5435 for key in updateNoticeDict: 5436 if updateNoticeDict[key]: 5437 if key >= fileVersion: 5438 if show is None: 5439 show = fileVersion 5440 else: 5441 show = min(show,fileVersion) 5442 allProjects = True 5443 else: 5444 if key >= lastNotice: 5445 if show is None: 5446 show = lastNotice 5447 else: 5448 show = min(show,lastNotice) 5449 if show is None: return 5450 5451 fp = open(os.path.join(GSASIIpath.path2GSAS2,'versioninfo.txt'),'r') 5452 vers = None 5453 noticeDict = {} 5454 for line in fp: 5455 if line.strip().startswith('#'): continue 5456 if vers is not None: 5457 if len(line.strip()) == 0: 5458 vers = None 5459 continue 5460 else: 5461 noticeDict[vers] += ' ' 5462 noticeDict[vers] += line.strip().replace('%%','\n') 5463 elif ':' in line: 5464 vers,tag = line.strip().split(':',1) 5465 try: 5466 vers = int(vers) 5467 except: 5468 continue 5469 noticeDict[vers] = tag.strip().replace('%%','\n') 5470 fp.close() 5471 for key in list(noticeDict.keys()): 5472 if key <= show: del noticeDict[key] 5473 if len(noticeDict) == 0: return 5474 5475 dlg = wx.Dialog(G2frame,wx.ID_ANY,'Update notices', 5476 style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) 5477 sizer = wx.BoxSizer(wx.VERTICAL) 5478 txtbox = wx.StaticText(dlg,wx.ID_ANY, 5479 'Please read the notices below about GSAS-II updates since' 5480 ' this project was last saved') 5481 txtbox.Wrap(490) 5482 sizer.Add(txtbox,0) 5483 sizer.Add((10,10)) 5484 tblSizer = wx.FlexGridSizer(0,2,5,10) 5485 tblLine() 5486 txtbox = wx.StaticText(dlg,wx.ID_ANY,'version') 5487 tblSizer.Add(txtbox,0,wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL) 5488 txtbox = wx.StaticText(dlg,wx.ID_ANY,'notice') 5489 tblSizer.Add(txtbox,0,wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) 5490 tblLine() 5491 sizer.Add(tblSizer) 5492 sizer.Add((10,10)) 5493 btnsizer = wx.StdDialogButtonSizer() 5494 if allProjects: # will be shown again 5495 OKbtn = wx.Button(dlg, wx.ID_OK) 5496 else: 5497 OKbtn = wx.Button(dlg, wx.ID_OK,label='Record as seen') 5498 btn = wx.Button(dlg, wx.ID_CANCEL,label='Show again') 5499 btnsizer.AddButton(btn) 5500 OKbtn.SetDefault() 5501 btnsizer.AddButton(OKbtn) 5502 btnsizer.Realize() 5503 sizer.Add((-1,5)) 5504 sizer.Add(btnsizer,0,wx.ALIGN_CENTER,50) 5505 for key in reversed(sorted(list(noticeDict.keys()))): 5506 txtbox = wx.StaticText(dlg,wx.ID_ANY,str(key)) 5507 txtbox.SetBackgroundColour(wx.Colour(250,250,250)) 5508 tblSizer.Add(txtbox,0,wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL) 5509 txtbox = wx.StaticText(dlg,wx.ID_ANY,noticeDict[key]) 5510 txtbox.Wrap(420) 5511 txtbox.SetBackgroundColour(wx.Colour(250,250,250)) 5512 tblSizer.Add(txtbox) 5513 tblLine() 5514 5515 dlg.SetSizer(sizer) 5516 sizer.Fit(dlg) 5517 dlg.CenterOnParent() 5518 if dlg.ShowModal() == wx.ID_OK: 5519 if not allProjects: 5520 vars = GetConfigValsDocs() 5521 vars['lastUpdateNotice'][1] = rev 5522 GSASIIpath.SetConfigValue(vars) 5523 SaveConfigVars(vars) 5524 dlg.Destroy() 5525 return 5526 dlg.Destroy() 5527 5528 ################################################################################ 5407 5529 class MyHtmlPanel(wx.Panel): 5408 5530 '''Defines a panel to display HTML help information, as an alternative to … … 6848 6970 pnl.SetSizer(sizer) 6849 6971 sizer.Fit(dlg) 6850 self.CenterOnParent()6972 dlg.CenterOnParent() 6851 6973 if dlg.ShowModal() != wx.ID_OK: 6852 6974 dlg.Destroy() -
trunk/config_example.py
r4654 r4918 19 19 directory (GSASIIpath.Path2GSAS2) or a directory for local GSAS-II 20 20 modifications (~/.G2local/ or /Documents and Settings/<User>/.G2local/). 21 Note that the contents of config.py is usually changed 22 using GSASIIctrlGUI.SelectConfigSetting. 21 23 22 24 When defining new config variables for GSAS-II, define them here with a … … 24 26 values. Include a doc string after each variable is defined to explain 25 27 what it does. Use names ending in _location or _directory for items 26 that will contain directory names. 28 that will contain directory names. Use names ending in _exec for executable 29 files (.exe on windows). 27 30 28 31 For example:: … … 238 241 when the GPX file is opened. Default is False. 239 242 ''' 243 244 fullrmc_exec = None 245 '''Defines the full path to a Python executable that has been configured 246 with the fullrmc package. If None (the default), GSAS-II will see if fullrmc 247 can be imported into the current Python and if not a executable named fullrmc* 248 (or fullrmc*.exe on Windows) can be found in the GSAS-II binary directory 249 or in the system path. 250 ''' 251 252 lastUpdateNotice = 0 253 '''Defines the version number for the last update notice that has been 254 shown. This should not need to be changed manually. 255 ''' -
trunk/imports/G2img_PILTIF.py
r4917 r4918 26 26 Note that capitalization of keywords is ignored. Defined keywords are in table below. Any line 27 27 without one of these keywords will be ignored. 28 29 .. Next command allows \\AA to be used in HTML 30 31 .. only:: html 32 33 :math:`\\require{mediawiki-texvc}` 28 34 29 35 .. tabularcolumns:: |l|p{4.5in}|
Note: See TracChangeset
for help on using the changeset viewer.