Beispiel #1
0
class Xml(wx.App) :
    def OnInit(self) :
        self.db = WCDB('welcome_code_manager.db.rev2') ;
        self.res = xrc.XmlResource(sys.argv[1]) ;
        self.init_frame() ;
        print self.db ;
        return True ;

    def init_frame(self) :
		# self.frame = self.res.LoadFrame(None, 'XrcMain') ;
        self.frame = self.res.LoadObject(None, 'XrcMain', 'wxFrame') ;

        self.lc = xrc.XRCCTRL(self.frame, 'wxID_MY_LISTCTRL') ;

        productTableColumn = [
            ('No.',     50 ,    wx.LIST_FORMAT_RIGHT) ,
            ('Serial',  100 ,   wx.LIST_FORMAT_LEFT) ,
            ('EUID',    165 ,   wx.LIST_FORMAT_LEFT) ,
            ('UUID',    270 ,   wx.LIST_FORMAT_LEFT) ,
            ] ;
        ci = 0 ;
        for col in productTableColumn :
            self.lc.InsertColumn(ci, col[0], col[2], width=col[1]) ;
            ci = ci + 1 ;
        ri = 0 ;
        productData = self.db.getProductTable() ;
        for row in productData :
            ri = ri + 1 ;
            idx = self.lc.InsertStringItem(sys.maxint, str(ri)) ;
            if idx & 1 :
                self.lc.SetItemBackgroundColour(idx, '#E0E0E0') ;
            ii = 0 ;
            for item in row :
                if ii < 3 :
                    self.lc.SetStringItem(idx, ii+1, row[ii]) ;
                    ii = ii + 1 ;


        self.frame.Center() ;
        self.frame.Show(True) ;
Beispiel #2
0
 def OnInit(self) :
     self.db = WCDB('welcome_code_manager.db.rev2') ;
     self.res = xrc.XmlResource(sys.argv[1]) ;
     self.init_frame() ;
     print self.db ;
     return True ;