Package reflectometry :: Package model1d :: Package profileview :: Module auiPanel

Source Code for Module reflectometry.model1d.profileview.auiPanel

 1  import wx 
 2  import traceback 
 3   
4 -class AuiPanel(wx.Panel):
5 """ A base panel to support AUI managerment. """
6 - def __init__(self, 7 parent, 8 id = -1, 9 pos = wx.DefaultPosition, 10 size = wx.DefaultSize, 11 style = wx.TAB_TRAVERSAL, 12 name = '' 13 ):
14 """ Constructor""" 15 super(AuiPanel, self).__init__(parent=parent, id=id, pos=pos, 16 size=size, style=style, name=name ) 17 self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDClick)
18 19
20 - def OnLeftDClick(self, event):
21 self.RestorePerspective() 22 event.Skip()
23 24
25 - def SetPerspective(self, perspective):
26 """ Set the perspective to restore itself in AUI """ 27 self._perspective = perspective
28 29
30 - def GetPerspective(self):
31 """ Get the perspective to restore itself in AUI """ 32 return self._perspective
33 34
35 - def RestorePerspective(self):
36 """ Restore itself in AUI """ 37 try: 38 mgr = self.GetParent().GetOwnerManager() 39 40 mgr.LoadPerspective(self.GetPerspective()) 41 all_panes = mgr.GetAllPanes() 42 for pane in xrange(len(all_panes)): 43 all_panes[pane].Show() 44 mgr.Update() 45 46 except: 47 pass 48 49 return
50
51 - def ShowErrorMsg(self, msg, title):
52 msg = wx.MessageDialog(self, msg, title, wx.ICON_ERROR|wx.OK) 53 msg.ShowModal() 54 msg.Destroy()
55