Changeset 2895 for branch/2frame/GSASIIctrls.py
- Timestamp:
- Jul 2, 2017 7:27:09 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branch/2frame/GSASIIctrls.py
r2890 r2895 2722 2722 else: 2723 2723 return '.' 2724 2725 ################################################################################ 2726 class SGMessageBox(wx.Dialog): 2727 ''' Special version of MessageBox that displays space group & super space group text 2728 in two blocks 2729 ''' 2730 def __init__(self,parent,title,text,table,): 2731 wx.Dialog.__init__(self,parent,wx.ID_ANY,title,pos=wx.DefaultPosition, 2732 style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) 2733 self.text = text 2734 self.table = table 2735 self.panel = wx.Panel(self) 2736 mainSizer = wx.BoxSizer(wx.VERTICAL) 2737 mainSizer.Add((0,10)) 2738 for line in text: 2739 mainSizer.Add(wx.StaticText(self.panel,label=' %s '%(line)),0,WACV) 2740 ncol = self.table[0].count(',')+1 2741 tableSizer = wx.FlexGridSizer(0,2*ncol+3,0,0) 2742 for j,item in enumerate(self.table): 2743 num,flds = item.split(')') 2744 tableSizer.Add(wx.StaticText(self.panel,label=' %s '%(num+')')),0,WACV|wx.ALIGN_LEFT) 2745 flds = flds.replace(' ','').split(',') 2746 for i,fld in enumerate(flds): 2747 if i < ncol-1: 2748 tableSizer.Add(wx.StaticText(self.panel,label='%s, '%(fld)),0,WACV|wx.ALIGN_RIGHT) 2749 else: 2750 tableSizer.Add(wx.StaticText(self.panel,label='%s'%(fld)),0,WACV|wx.ALIGN_RIGHT) 2751 if not j%2: 2752 tableSizer.Add((20,0)) 2753 mainSizer.Add(tableSizer,0,wx.ALIGN_LEFT) 2754 btnsizer = wx.StdDialogButtonSizer() 2755 OKbtn = wx.Button(self.panel, wx.ID_OK) 2756 OKbtn.Bind(wx.EVT_BUTTON, self.OnOk) 2757 OKbtn.SetDefault() 2758 btnsizer.AddButton(OKbtn) 2759 btnsizer.Realize() 2760 mainSizer.Add((0,10)) 2761 mainSizer.Add(btnsizer,0,wx.ALIGN_CENTER) 2762 self.panel.SetSizer(mainSizer) 2763 self.panel.Fit() 2764 self.Fit() 2765 size = self.GetSize() 2766 self.SetSize([size[0]+20,size[1]]) 2767 2768 def Show(self): 2769 '''Use this method after creating the dialog to post it 2770 ''' 2771 self.ShowModal() 2772 return 2773 2774 def OnOk(self,event): 2775 parent = self.GetParent() 2776 parent.Raise() 2777 self.EndModal(wx.ID_OK) 2724 2778 2725 2779 ################################################################################
Note: See TracChangeset
for help on using the changeset viewer.