Package Gnumed :: Package wxpython :: Module gmGP_Inbox
[frames] | no frames]

Source Code for Module Gnumed.wxpython.gmGP_Inbox

 1  try: 
 2          import wxversion 
 3          import wx 
 4  except ImportError: 
 5          from wxPython import wx 
 6   
 7  from gmListCtrlMapper import * 
 8   
 9  Inboxdata = { 
10  1 : ("Pathology", "5 unread results (Douglas Pathology)"), 
11  2 : ("Radiology", "1 Xray of femur (Newcastle radiology)"), 
12  3 : ("", "Head CT (Hunter Diagnostic Imaging)"), 
13  4 : ("Internal Mail ", "from practice nurse - non urgent"), 
14  } 
15  ID_INBOX = wx.NewId() 
16   
17 -class Inbox(wx.Panel):
18 - def __init__(self, parent,id):
19 wx.Panel.__init__(self, parent, id, wx.DefaultPosition, wx.DefaultSize, 0 ) 20 list_inbox = wx.ListCtrl(self, ID_INBOX, wx.DefaultPosition, wx.DefaultSize,wx.LC_REPORT|wx.LC_NO_HEADER|wx.SUNKEN_BORDER) 21 list_inbox.InsertColumn(0, "From") 22 list_inbox.InsertColumn(1, "Message", wx.LIST_FORMAT_LEFT) 23 self.list_inbox = list_inbox 24 self.lc_mapper = gmListCtrlMapper(self.list_inbox) 25 #------------------------------------------------------------- 26 #loop through the scriptdata array and add to the list control 27 #note the different syntax for the first coloum of each row 28 #i.e. here > self.List_Script.InsertStringItem(x, data[0])!! 29 self.SetData( Inboxdata) 30 31 list_inbox.SetColumnWidth(0, wx.LIST_AUTOSIZE) 32 list_inbox.SetColumnWidth(1, wx.LIST_AUTOSIZE) 33 sizer = wx.BoxSizer(wx.VERTICAL) 34 sizer.Add(list_inbox,100,wx.EXPAND) 35 self.SetSizer(sizer) #set the sizer 36 sizer.Fit(self) #set to minimum size as calculated by sizer 37 self.SetAutoLayout(True) #tell frame to use the sizer 38 #self.Show(True) 39 40 print self.GetData()
41
42 - def SetData( self, map):
43 self.lc_mapper.SetData( map)
44
45 - def GetData(self):
46 return self.lc_mapper.GetData()
47 48 if __name__ == "__main__": 49 app = wxPyWidgetTester(size = (400, 200)) 50 app.SetWidget(Inbox, -1) 51 app.MainLoop() 52 53 #=========================================================== 54 # $Log: gmGP_Inbox.py,v $ 55 # Revision 1.11 2008-03-06 18:29:29 ncq 56 # - standard lib logging only 57 # 58 # Revision 1.10 2005/09/28 21:27:30 ncq 59 # - a lot of wx2.6-ification 60 # 61 # Revision 1.9 2005/09/28 15:57:48 ncq 62 # - a whole bunch of wx.Foo -> wx.Foo 63 # 64 # Revision 1.8 2005/09/26 18:01:50 ncq 65 # - use proper way to import wx26 vs wx2.4 66 # - note: THIS WILL BREAK RUNNING THE CLIENT IN SOME PLACES 67 # - time for fixup 68 # 69 # Revision 1.7 2004/07/18 20:30:53 ncq 70 # - wxPython.true/false -> Python.True/False as Python tells us to do 71 # 72 # Revision 1.6 2004/06/20 16:01:05 ncq 73 # - please epydoc more carefully 74 # 75