def p_panel(self): self.SetSizeHintsSz(wx.DefaultSize,wx.DefaultSize) self.p_boxsizer=wx.BoxSizer(wx.VERTICAL) self.p_boxsizer1 = wx.BoxSizer(wx.HORIZONTAL) self.p_boxsizer2 = wx.BoxSizer(wx.VERTICAL) self.panel = wx.Panel(self, -1) # grid constructor self.m_gridctrl = wx.grid.Grid(self.panel,) #self.py_colables = [u"货号",u"品名",u"规格",u"单位",u'产品类别',u"内箱长",u"内箱宽",u'内箱高', u'每内箱数量', u'外箱长',u'外箱宽',u'外箱高', u'每外箱数量', u"单件净重",u"总毛重",u"EXW",u"FOB中山港",u"FOB深圳",u"FOB香港"] self.py_colables = [(0, u"货号"), (1, u"品名"), (2, u"规格"), (3, u"单位"), (4, u'产品类别')] #, (5, u"内箱长"), (6, u"内箱宽"), (7, u'内箱高'), (8, u'每内箱数量'), (9, u'外箱长'), # (10, u'外箱宽'), (11, u'外箱高'), (12, u'每外箱数量'), (13, u"单件净重"), (14, u"总毛重"), (15, u"EXW"), (16, u"FOB中山港"), (17, u"FOB深圳")] #, (18, u"FOB香港")] data = self.getPyData(self.cntx) #print "data is",data table = GenericGridTable(data, colLabels=self.py_colables) self.GetptypeData() self.m_gridctrl.SetTable(table) self.m_gridctrl.SetRowLabelSize(10) #self.m_gridctrl.SetDefaultRowSize(20) self.m_gridctrl.EnableDragRowSize(False) #self.m_gridctrl.SetDefaultCellFont(wx.Font(12,wx.DEFAULT,wx.NORMAL,wx.NORMAL,False,u'宋体')) self.m_gridctrl.EnableEditing(False) self.m_gridctrl.AutoSizeColumns() self.cuselrow=0 self.m_treectrl=gsTreeCtrl(self.panel,-1,wx.DefaultPosition,wx.Size(200, 400),wx.TR_DEFAULT_STYLE|wx.STATIC_BORDER|wx.TR_EDIT_LABELS,self.cntx) self.m_staticbitmap = wx.StaticBitmap(self.panel, -1, wx.Bitmap( u"D:\\gstar\\gstar\\bitmaps\\find.png", wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.Size(200, 150), 0) self.p_boxsizer2.Add(self.m_treectrl, 1, wx.ALL, 2) self.p_boxsizer2.Add(self.m_staticbitmap, 0, wx.ALL, 2) self.p_boxsizer1.Add(self.p_boxsizer2, 0, wx.EXPAND, 2) self.p_boxsizer1.Add(self.m_gridctrl, 1, wx.EXPAND, 2) self.panel.SetSizer(self.p_boxsizer1) self.panel.Layout() self.p_boxsizer1.Fit(self.panel) self.SetSizer(self.p_boxsizer) self.p_boxsizer.Add(self.panel,1,wx.EXPAND|wx.ALL,1) self.Layout()
def __init__(self, parent, cntx): wx.MDIChildFrame.__init__(self, parent, title=u'产品类别管理', pos=(0, 0), size=(800, 600)) self.cntx=cntx self.ptypeChanged = False self.popupName=[u"新增同级",u"新增下级",u"重命名",u"删除"] self.popupid=[ wx.NewId() for i in range(len(self.popupName))] self.createPtypeToolbar() self.panel = wx.Panel(self, -1) self.m_treectrl=gsTreeCtrl(self.panel,-1,wx.DefaultPosition,wx.Size(800, 500),wx.TR_DEFAULT_STYLE|wx.STATIC_BORDER|wx.TR_EDIT_LABELS|wx.TR_EXTENDED,self.cntx) self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnNodeManager) self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged) self.Bind(wx.EVT_CLOSE, self.OncloseWindow)