Changeset 4604
- Timestamp:
- Oct 17, 2020 5:49:37 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIconstrGUI.py
r4603 r4604 3018 3018 Indx[refSel.GetId()] = i 3019 3019 refAtmSizer.Add(refSel,0,WACV) 3020 refHelpInfo = ''' 3021 The Orientation reference control is used to tranform 3022 the Cartesian 3023 axes for rigid bodies with three atoms, A, B and C. 3024 The vector from A to B defines the x-axis and the z axis is placed 3025 in the plane defined by A to B and A to C. 3026 ''' 3027 hlp = G2G.HelpButton(VectorRBDisplay,refHelpInfo,wrap=400) 3028 refAtmSizer.Add(hlp,0,wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL,2) 3020 3029 return refAtmSizer 3021 3030 … … 3372 3381 RefObjs.append(refObj) 3373 3382 if 'molCent' not in rbData: rbData['molCent'] = False #patch 3374 molcent = wx.Button(ResidueRBDisplay,label=' Use RB center?')3383 molcent = wx.Button(ResidueRBDisplay,label=' Center RB?') 3375 3384 molcent.Bind(wx.EVT_BUTTON,OnMolCent) 3376 3385 Indx[molcent.GetId()] = resGrid 3377 3386 refAtmSizer.Add(molcent,0,WACV) 3387 refHelpInfo = ''' 3388 * The "Orientation Reference" control is used to tranform 3389 the Cartesian 3390 axes for rigid bodies with three atoms, A, B and C. 3391 The vector from A to B defines the x-axis and the z axis is placed 3392 in the plane defined by A to B and A to C. 3393 3394 %%* The "Center RB?" button will redefine the origin of the 3395 rigid body to the midpoint of all atoms in the body (not mass weighted) 3396 ''' 3397 hlp = G2G.HelpButton(ResidueRBDisplay,refHelpInfo,wrap=400) 3398 refAtmSizer.Add(hlp,0,wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL,2) 3378 3399 3379 3400 mainSizer = wx.BoxSizer(wx.VERTICAL) -
trunk/GSASIIctrlGUI.py
r4594 r4604 5166 5166 5167 5167 :param parent: the panel/frame where the button will be placed 5168 :param str msg: the help text to be displayed 5168 :param str msg: the help text to be displayed. Indentation on 5169 multiline help text is stripped (see :func:`StripIndents`). If wrap 5170 is set as non-zero, all new lines are 5169 5171 :param str helpIndex: location of the help information in the gsasII.html 5170 5172 help file in the form of an anchor string. The URL will be 5171 5173 constructed from: location + gsasII.html + "#" + helpIndex 5174 :param int wrap: if specified, the text displayed is reformatted by 5175 wrapping it to fit in wrap pixels. Default is None which prevents 5176 wrapping. 5172 5177 ''' 5173 def __init__(self,parent,msg='',helpIndex='' ):5178 def __init__(self,parent,msg='',helpIndex='',wrap=None): 5174 5179 if sys.platform == "darwin": 5175 5180 wx.Button.__init__(self,parent,wx.ID_HELP) … … 5177 5182 wx.Button.__init__(self,parent,wx.ID_ANY,'?',style=wx.BU_EXACTFIT) 5178 5183 self.Bind(wx.EVT_BUTTON,self._onPress) 5179 self.msg=StripIndents(msg) 5184 if wrap: 5185 self.msg=StripIndents(msg,True) 5186 else: 5187 self.msg=StripIndents(msg) 5180 5188 self.parent = parent 5181 5189 self.helpIndex = helpIndex 5190 self.wrap = wrap 5182 5191 def _onClose(self,event): 5183 5192 self.dlg.EndModal(wx.ID_CANCEL) … … 5193 5202 mainSizer = wx.BoxSizer(wx.VERTICAL) 5194 5203 txt = wx.StaticText(self.dlg,wx.ID_ANY,self.msg) 5204 if self.wrap: 5205 txt.Wrap(self.wrap) 5195 5206 mainSizer.Add(txt,1,wx.ALL|wx.EXPAND,10) 5196 5207 txt.SetBackgroundColour(wx.WHITE) … … 5268 5279 ################################################################################ 5269 5280 def StripIndents(msg,singleLine=False): 5270 'Strip indentation from multiline strings' 5281 '''Strip unintended indentation from multiline strings. 5282 When singleLine is True, all newline are removed, but inserting "%%" 5283 into the string will cause a blank line to be inserted at that point 5284 5285 :param str msg: a string containing one or more lines of text. 5286 spaces or tabs following a newline are removed. 5287 :returns: the string but reformatted 5288 ''' 5271 5289 msg1 = msg.replace('\n ','\n') 5272 5290 while msg != msg1: 5273 5291 msg = msg1 5274 5292 msg1 = msg.replace('\n ','\n') 5275 msg = msg.replace('\n\t','\n') 5293 msg1 = msg1.replace(' ',' ') 5294 msg1 = msg.replace('\n\t','\n') 5295 while msg != msg1: 5296 msg = msg1 5297 msg1 = msg.replace('\n\t','\n') 5276 5298 if singleLine: 5277 return msg.replace('\n',' ') 5299 msg = msg.replace('\n',' ') 5300 msg1 = msg.replace(' ',' ') 5301 while msg != msg1: 5302 msg = msg1 5303 msg1 = msg1.replace(' ',' ') 5304 msg = msg.replace('%%','\n\n') 5278 5305 return msg 5279 5306
Note: See TracChangeset
for help on using the changeset viewer.