Package reflectometry :: Package model1d :: Package tableview :: Module removeGlobalParameter

Source Code for Module reflectometry.model1d.tableview.removeGlobalParameter

  1  #!/usr/bin/env python 
  2   
  3  import wx 
  4  from   reflectometry.model1d.profileview.reflutils import CheckValid 
  5   
  6   
  7  #========================================================================== 
8 -class RemoveGlobalParameter(wx.Dialog):
9 - def __init__( 10 self, 11 parent, 12 ID, 13 title = "Remove a global parameter", 14 size = (300, 300),#wx.DefaultSize, 15 pos = wx.DefaultPosition, 16 style = wx.DEFAULT_DIALOG_STYLE, 17 useMetal = False, 18 attrList = None 19 ):
20 self.parent = parent 21 self.attrChoices = attrList 22 23 pre = wx.PreDialog() 24 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) 25 pre.Create(parent, ID, title, pos, size, style) 26 27 self.PostCreate(pre) 28 29 # This extra style can be set after the UI object has been created. 30 if 'wxMac' in wx.PlatformInfo and useMetal: 31 self.SetExtraStyle(wx.DIALOG_EX_METAL) 32 33 self._mgr = wx.aui.AuiManager(self) 34 35 36 wx.StaticText(self, 37 -1, 38 "Remove a global parameter:", 39 (20, 40) 40 ) 41 42 self.removeComboBox = wx.ComboBox(choices=self.attrChoices, 43 id=-1, 44 name=u'typeComboBox', 45 parent=self, 46 pos=wx.Point(175, 40), 47 size=wx.Size(160, 20), 48 style= 0, 49 value=u'Flat' 50 ) 51 52 self.removeComboBox.SetSelection(0) 53 self.Bind(wx.EVT_COMBOBOX, self.OnRemoveCombobox, self.removeComboBox) 54 self.selection = 0 55 56 self._mgr.Update() 57 58 self.button = wx.Button(self, 59 wx.ID_OK, 60 '', 61 (120, 90) 62 ) 63 self.cancelbutton = wx.Button(self, 64 wx.ID_CANCEL, 65 '', 66 (220, 90) 67 ) 68 self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.OnClosePage) 69 self.Bind(wx.EVT_CLOSE, self.OnClose) 70 71 # error flag 72 self._error = 0
73 74
75 - def getParInfo(self):
76 ret = [] 77 ret.append( self.getAttrValue() ) 78 ret.append( self._error ) 79 80 return ret
81 82
83 - def getAttrValue(self):
84 return self.removeComboBox.GetValue().strip()
85 86
87 - def GetOwnerManager(self):
88 return ret 89 90 return self._mgr
91 92
93 - def OnClose(self, event):
94 self._mgr.UnInit() 95 event.Skip() 96 return ret
97 98 99
100 - def OnClosePage(self, event):
101 event.Veto()
102 103
104 - def OnRemoveCombobox(self, event):
105 self.selection = self.removeComboBox.GetSelection() 106 self.removeComboBox.SetLabel( self.attrChoices[self.selection] ) 107 self.removeComboBox.SetValue( self.attrChoices[self.selection] )
108 109 110
111 - def OnRemoveComboboxTextLL(self, event):
112 if self.selection < 0: 113 return 114 else: 115 txt = self.removeComboBox.GetValue() 116 self.TypeDepos[self.selection] = txt 117 self.removeComboBox.SetString(self.selection,txt)
118