Package reflectometry :: Package model1d :: Package profileview :: Module saveFigureDialog

Source Code for Module reflectometry.model1d.profileview.saveFigureDialog

 1  import wx 
 2   
 3  # ------------------------------------------------------------------------ 
4 -class saveFigureDialog(wx.Dialog):
5 - def __init__( 6 self, 7 parent, 8 ID, 9 title = "Save Figure", 10 size = (300, 300),#wx.DefaultSize, 11 pos = wx.DefaultPosition, 12 style = wx.DEFAULT_DIALOG_STYLE, 13 useMetal = False, 14 model = None 15 ):
16 self.parent = parent 17 self.model = model 18 19 pre = wx.PreDialog() 20 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) 21 pre.Create(parent, ID, title, pos, size, style) 22 23 self.PostCreate(pre) 24 25 # This extra style can be set after the UI object has been created. 26 if 'wxMac' in wx.PlatformInfo and useMetal: 27 self.SetExtraStyle(wx.DIALOG_EX_METAL) 28 29 self._mgr = wx.aui.AuiManager(self) 30 31 32 self.Layernum = len( self.model.depth ) -2 33 34 wx.StaticText(self, 35 -1, 36 "Save the figure as", 37 (20, 40) 38 ) 39 40 self.Bind(wx.EVT_COMBOBOX, self.OnRemoveCombobox, self.removeComboBox) 41 self.selection = 0 42 43 self._mgr.Update() 44 45 self.button = wx.Button(self, 46 wx.ID_OK,'', 47 (50, 90) 48 ) 49 self.cancelbutton = wx.Button(self, 50 wx.ID_CANCEL, 51 '', 52 (150, 90) 53 ) 54 self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.OnClosePage) 55 self.Bind(wx.EVT_CLOSE, self.OnClose)
56 57 58
59 - def getLayerInfo(self):
60 ret = [] 61 ret.append( self.getLayerNumValue() ) 62 63 return ret
64 65
66 - def getLayerNumValue(self):
67 s = self.removeComboBox.GetValue().split(":")[-1].strip() 68 return int( s )
69 70
71 - def GetOwnerManager(self):
72 return self._mgr
73 74
75 - def OnClose(self, event):
76 self._mgr.UnInit() 77 event.Skip()
78 79
80 - def OnClosePage(self, event):
81 event.Veto()
82
83 - def OnRemoveCombobox(self, event):
84 self.selection = self.removeComboBox.GetSelection() 85 self.removeComboBox.SetLabel( self.layerChoices[self.selection] ) 86 self.removeComboBox.SetValue( self.layerChoices[self.selection] )
87 88
89 - def OnRemoveComboboxText(self, event):
90 if self.selection < 0: 91 return 92 else: 93 txt = self.removeComboBox.GetValue() 94 self.TypeDepos[self.selection] = txt 95 self.removeComboBox.SetString(self.selection,txt)
96