Changeset 4289 for trunk/GSASIIphsGUI.py
- Timestamp:
- Feb 5, 2020 7:06:40 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r4272 r4289 283 283 parent.Raise() 284 284 self.EndModal(wx.ID_CANCEL) 285 286 ################################################################################ 287 class CompareDialog(wx.Dialog): 288 def __init__(self,parent,phase): 289 wx.Dialog.__init__(self,parent,wx.ID_ANY,'Setup polyhedron comparison', 290 pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) 291 self.panel = wxscroll.ScrolledPanel(self) #just a dummy - gets destroyed in Draw! 292 self.OPhase = copy.deepcopy(phase) #will be a new phase! 293 self.OName = self.OPhase['General']['Name'] 294 self.TPhase = copy.deepcopy(phase) 295 self.TName = self.OName 296 self.PhaseNames = parent.GetPhaseNames() 297 self.PhaseData = parent.GetPhaseData() 298 self.Oatoms = ['',''] 299 self.Tatoms = ['',''] 300 self.ONeighbors = [] 301 self.Tneighbors = [] 302 self.Draw() 303 304 def Draw(self): 305 306 def OnPhaseSel(event): 307 self.TName = phasesel.GetStringSelection() 308 self.Tphase = self.PhaseData[self.TName] 309 wx.CallAfter(self.Draw) 310 311 def OnOatmOsel(event): 312 self.Oatoms[0] = oatmosel.GetStringSelection() 313 314 def OnTatmOsel(event): 315 self.Tatoms[0] = tatmosel.GetStringSelection() 316 print(G2mth.FindAllNeighbors(self.OPhase,self.Oatoms[0],self.Tatoms[0])[0]) 317 318 self.panel.Destroy() 319 self.panel = wxscroll.ScrolledPanel(self,style = wx.DEFAULT_DIALOG_STYLE) 320 OgeneralData = self.OPhase['General'] 321 OatTypes = OgeneralData['AtomTypes'] 322 TgeneralData = self.OPhase['General'] 323 TatTypes = TgeneralData['AtomTypes'] 324 325 mainSizer = wx.BoxSizer(wx.VERTICAL) 326 mainSizer.Add(wx.StaticText(self.panel,label='Compare polyhedra in %s to target phase %s:(TBD)'%(self.OName,self.TName)),0,WACV) 327 328 Pchoice = self.PhaseNames 329 phaseselSizer = wx.BoxSizer(wx.HORIZONTAL) 330 phaseselSizer.Add(wx.StaticText(self.panel,label=' Select target phase: '),0,WACV) 331 phasesel = wx.ComboBox(self.panel,choices=Pchoice,value=self.OName, 332 style=wx.CB_READONLY|wx.CB_DROPDOWN) 333 phasesel.Bind(wx.EVT_COMBOBOX,OnPhaseSel) 334 phaseselSizer.Add(phasesel,0,WACV) 335 mainSizer.Add(phaseselSizer,0,WACV) 336 337 mainSizer.Add(wx.StaticText(self.panel,label=' For origin phase %s:'%self.OName),0,WACV) 338 oatmoselSizer = wx.BoxSizer(wx.HORIZONTAL) 339 oatmoselSizer.Add(wx.StaticText(self.panel,label=' Select origin atom type: '),0,WACV) 340 oatmosel = wx.ComboBox(self.panel,choices=OatTypes,style=wx.CB_READONLY|wx.CB_DROPDOWN) 341 oatmosel.Bind(wx.EVT_COMBOBOX,OnOatmOsel) 342 oatmoselSizer.Add(oatmosel,0,WACV) 343 mainSizer.Add(oatmoselSizer,0,WACV) 344 345 tatmoselSizer = wx.BoxSizer(wx.HORIZONTAL) 346 tatmoselSizer.Add(wx.StaticText(self.panel,label=' Select target atom type: '),0,WACV) 347 tatmosel = wx.ComboBox(self.panel,choices=OatTypes,style=wx.CB_READONLY|wx.CB_DROPDOWN) 348 tatmosel.Bind(wx.EVT_COMBOBOX,OnTatmOsel) 349 tatmoselSizer.Add(tatmosel,0,WACV) 350 mainSizer.Add(tatmoselSizer,0,WACV) 351 352 mainSizer.Add(wx.StaticText(self.panel,label=' For target phase %s:'%self.TName),0,WACV) 353 354 355 OkBtn = wx.Button(self.panel,-1,"Ok") 356 OkBtn.Bind(wx.EVT_BUTTON, self.OnOk) 357 cancelBtn = wx.Button(self.panel,-1,"Cancel") 358 cancelBtn.Bind(wx.EVT_BUTTON, self.OnCancel) 359 btnSizer = wx.BoxSizer(wx.HORIZONTAL) 360 btnSizer.Add((20,20),1) 361 btnSizer.Add(OkBtn) 362 btnSizer.Add((20,20),1) 363 btnSizer.Add(cancelBtn) 364 btnSizer.Add((20,20),1) 365 366 mainSizer.Add(btnSizer,0,wx.EXPAND|wx.BOTTOM|wx.TOP, 10) 367 368 self.panel.SetSizer(mainSizer) 369 self.panel.SetAutoLayout(1) 370 self.panel.SetScrollRate(10,10) 371 size = np.array(self.GetSize()) 372 size = [size[0]-5,size[1]-20] #this fiddling is needed for older wx! 373 self.panel.SetSize(size) 374 375 def GetSelection(self): 376 return None 377 378 def OnOk(self,event): 379 parent = self.GetParent() 380 parent.Raise() 381 self.EndModal(wx.ID_OK) 382 383 def OnCancel(self,event): 384 parent = self.GetParent() 385 parent.Raise() 386 self.EndModal(wx.ID_CANCEL) 387 285 388 286 389 ################################################################################ … … 2682 2785 else: 2683 2786 break 2684 2787 2685 2788 NShkl = len(G2spc.MustrainNames(SGData)) 2686 2789 NDij = len(G2spc.HStrainNames(SGData)) … … 2699 2802 G2frame.GPXtree.SelectItem(sub) 2700 2803 2804 def OnCompare(event): 2805 while True: 2806 dlg = CompareDialog(G2frame,data) 2807 try: 2808 if dlg.ShowModal() == wx.ID_OK: 2809 print('Compare polyhedra in structures - TBD') 2810 return 2811 else: 2812 return 2813 finally: 2814 dlg.Destroy() 2815 2816 2701 2817 def OnUseBilbao(event): 2702 2818 PatternName = data['magPhases'] … … 4415 4531 def OnRMCselect(event): 4416 4532 G2frame.RMCchoice = RMCsel.GetStringSelection() 4417 G2frame.runtext.SetValue('')4533 # G2frame.runtext.SetValue('') 4418 4534 UpdateRMC() 4419 4535 … … 5133 5249 import subprocess as sb 5134 5250 batch = open('fullrmc.bat','w') 5135 batch.write(sys.exec_prefix+'\\activate\n') 5251 batch.write('run '+sys.exec_prefix+'\\Scripts\\activate\n') 5252 batch.write('SET PYTHONPATH=%s\\fullrmc\n'%GSASIIpath.path2GSAS2) 5136 5253 batch.write(sys.exec_prefix+'\\python.exe '+dlg.GetPath()+'\n') 5137 5254 batch.write('pause') … … 10796 10913 G2frame.Bind(wx.EVT_MENU, OnRunMultiMCSA, id=G2G.wxID_MULTIMCSA) 10797 10914 G2frame.Bind(wx.EVT_MENU, OnTransform, id=G2G.wxID_TRANSFORMSTRUCTURE) 10915 G2frame.Bind(wx.EVT_MENU, OnCompare, id=G2G.wxID_COMPARESTRUCTURE) 10798 10916 G2frame.Bind(wx.EVT_MENU, OnUseBilbao, id=G2G.wxID_USEBILBAOMAG) 10799 10917 G2frame.Bind(wx.EVT_MENU, OnValidProtein, id=G2G.wxID_VALIDPROTEIN)
Note: See TracChangeset
for help on using the changeset viewer.