Changeset 4345 for trunk/GSASIIctrlGUI.py
- Timestamp:
- Mar 6, 2020 3:05:22 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIctrlGUI.py
r4330 r4345 1070 1070 :param wx.Panel parent: the parent to the :class:`~wxpython.ComboBox` (usually a 1071 1071 frame or panel) 1072 :param d ict dct: a dict (or list)to contain the value set1072 :param dct: a dict or list to contain the value set 1073 1073 for the :class:`~wxpython.ComboBox`. 1074 1074 :param item: the dict key (or list index) where ``dct[item]`` will … … 1094 1094 The default for :data:`values` is to use the same list as 1095 1095 specified for :data:`choices`. 1096 :param function onChange: an optional routine that will be called 1097 when the 1098 :class:`~wxpython.ComboBox` can be specified. 1096 1099 :param (other): additional keyword arguments accepted by 1097 1100 :class:`~wxpython.ComboBox` can be specified. 1098 1101 ''' 1099 def __init__(self,parent,dct,item,choices,values=None, **kw):1102 def __init__(self,parent,dct,item,choices,values=None,OnChange=None,**kw): 1100 1103 if values is None: 1101 1104 values = choices … … 1113 1116 self.dct = dct 1114 1117 self.item = item 1118 self.OnChange = OnChange 1115 1119 self.Bind(wx.EVT_COMBOBOX, self.onSelection) 1116 1120 def onSelection(self,event): … … 1120 1124 else: 1121 1125 self.dct[self.item] = self.values[0] # unknown 1126 if self.OnChange: self.OnChange(event) 1122 1127 1123 1128 ################################################################################ … … 4707 4712 return d 4708 4713 4714 inhibitSave = False 4709 4715 def SaveConfigVars(vars,parent=None): 4710 4716 '''Write the current config variable values to config.py … … 4716 4722 :returns: True if unable to write the file, None otherwise 4717 4723 ''' 4724 if inhibitSave: 4725 if GSASIIpath.GetConfigValue('debug'): 4726 print('inhibitSave prevents saving configuration') 4727 return 4728 4718 4729 # try to write to where an old config file is located 4719 4730 try: … … 4878 4889 GSASIIpath.SetConfigValue(self.vars) 4879 4890 self.EndModal(wx.ID_OK) 4891 global inhibitSave 4892 if event is not None: inhibitSave = True 4880 4893 import GSASIImpsubs as G2mp 4881 4894 G2mp.ResetMP() … … 4885 4898 as the current settings 4886 4899 ''' 4900 global inhibitSave 4901 inhibitSave = False 4887 4902 if not SaveConfigVars(self.vars,parent=self): 4888 4903 self.OnApplyChanges() # force a reload of the config settings … … 4963 4978 style=wx.CB_READONLY|wx.CB_DROPDOWN) 4964 4979 self.colSel.Bind(wx.EVT_COMBOBOX, OnNewColorBar) 4980 self.varsizer.Add(self.colSel, 0, wx.ALIGN_CENTRE|wx.ALL, 5) 4981 elif var == 'Image_calibrant': 4982 import ImageCalibrants as calFile 4983 calList = sorted([m for m in calFile.Calibrants.keys()], 4984 key=lambda s: s.lower()) 4985 self.colSel = EnumSelector(self,self.vars[var],1,calList, 4986 OnChange=self.OnChange) 4965 4987 self.varsizer.Add(self.colSel, 0, wx.ALIGN_CENTRE|wx.ALL, 5) 4966 4988 else:
Note: See TracChangeset
for help on using the changeset viewer.